File: gun_destruct.cpp

package info (click to toggle)
rafkill 1.2.2-3.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,268 kB
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (39 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "gun_destruct.h"
#include "weaponobj.h"
#include "hulls/hull_weapon_s_s.h"
#include "spaceobj.h"
#include <vector>
#include "defs.h"

using namespace std;

GunDestruct::GunDestruct( int d, int al ):
WeaponObject( d, "Destruct", 0, al, 0, 0 ) {
	ammo = NULL;
}


void GunDestruct::MakeShot(int x, int y, vector< SpaceObject * > * Ammo, const vector< SpaceObject * > * fight ) {
	ammo = Ammo;
	lx = x;
	ly = y;
}


GunDestruct::~GunDestruct() {

	if ( ammo == NULL ) return;

	for ( int q = 0; q < Util::rnd( 10 ) + 10; q++ ) {

		double cx = ( (double)( Util::rnd( 11 ) + 11 ) / 19.0 ) * (Util::rnd(2)*2-1);
		double cy = ( (double)( Util::rnd( 11 ) + 11 ) / 20.0 ) * (Util::rnd(2)*2-1);

		ammo->push_back( new WeaponNode(lx,ly,cx,cy,new SS_WHull(), alignment ) );
	}
}


WeaponObject * GunDestruct::copy() {
	return new GunDestruct( dir, alignment );
}