File: gun_efsingle.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 (32 lines) | stat: -rw-r--r-- 948 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
#include "gunobj.h"
#include "weaponobj.h"
#include "gun_efsingle.h"
#include "hulls/hull_weapon_s_s.h"
#include "trigtable.h"
#include "spaceobj.h"
#include <vector>

using namespace std;

EnemyFindSingle::EnemyFindSingle( int d, int al ):
WeaponObject( d, "Find Single", 0, al, 0, 0 ){}

void EnemyFindSingle::MakeShot(int x, int y, vector< SpaceObject * > * Ammo, const vector< SpaceObject * > * fight ) {

	setShotCounter( 40 );

	if ( fight == NULL ) return;
	if ( fight->empty() ) return;

	SpaceObject obj( 0, 0, 0, 0, NULL, NULL, PLANE_AIR, this->getTeam() );
	const SpaceObject * use = getCollidableObject( fight, &obj );
	// SpaceObject * use = fight->front();

	if ( use != NULL ) {
		const double FIND_BULLET = 1.2 * 8;
		int sang = getAngle( x, y, use->getX(), use->getY()+7 );
		double sx = Tcos(sang)*FIND_BULLET;
		double sy = Tsine(sang)*FIND_BULLET;
		Ammo->push_back( new WeaponNode(x,y,sx,sy,new SS_WHull(), alignment ) );
	}
}