53 this->gamemap = gamemap;
65 void tsearchreactionfireingunits :: initLimits()
84 void tsearchreactionfireingunits :: findOffensiveUnits(
Vehicle* vehicle,
int height,
int x1,
int y1,
int x2,
int y2 )
97 if ( x2 >= gamemap->
xsize )
98 x2 = gamemap->
xsize -1;
99 if ( y2 >= gamemap->
ysize )
100 y2 = gamemap->
ysize -1;
102 for (
int y = y1; y <= y2; y++ )
103 for (
int x = x1; x <= x2; x++ ) {
118 punitlist ul = unitlist[i];
120 punitlist next = ul->
next;
123 for (
int j = 0; j < atw->
count; ++j )
134 for (
int player = 0; player < gamemap->
getPlayerCount(); ++player ) {
160 for ( AStar3D::Path::const_iterator i = fieldlist.begin(); i != fieldlist.end(); i++) {
178 if ( c < 0 || c >= rfPlayerCount )
183 ul->
next= unitlist[c];
191 if ( c < 0 || c >= rfPlayerCount )
194 punitlist ul = unitlist[c];
195 punitlist last = NULL;
196 while ( ul && ul->
eht != vehicle ) {
200 if ( ul && ul->
eht == vehicle ) {
204 unitlist[c] = ul->
next;
223 for (
int j = 0; j < atw->
count; j++ )
225 if ( atw->
strength[j] > strength ) {
234 MessagingHub::Instance().statusInformation(
"attacking with weapon " +
ASCString::toString( atw->
num[num] ));
256 if ( context.
display && visibility)
288 punitlist ul = unitlist[i];
289 while ( ul && !result ) {
290 punitlist next = ul->
next;
294 int r =
attack( ul->
eht, vehicle, context );
317 int destroyedUnits = 0;
318 for (
int player = 0; player < gamemap->
getPlayerCount(); ++player ) {
320 list<int> exposedTargets;
324 if ( (*exposedTarget)->getMap()->getField( (*exposedTarget)->getPosition() )->unitHere( *exposedTarget ))
325 exposedTargets.push_back( (*exposedTarget )->networkid );
330 for ( list<int>::iterator exposedTargetID = exposedTargets.begin(); exposedTargetID != exposedTargets.end(); ++exposedTargetID ) {
332 if ( exposedTarget ) {
333 bool destroyed =
false;
336 if ( (*enemyUnit)->reactionfire.canPerformAttack( exposedTarget )) {
338 int r =
attack( *enemyUnit, exposedTarget, context );
350 return destroyedUnits;
358 punitlist ul = unitlist[i];
360 punitlist ul2 = ul->
next;
VisibleUnits visibleUnits
Player & getPlayer(PlayerID p)
int xsize
the size of the map
map accessing and usage routines used by ASC and the mapeditor
struct tfight::tavalues dv
punitlist unitlist[rfPlayerCount]
const int choehenstufennum
The number of levels of height.
bool isHostile(PlayerID towardsPlayer) const
Structure to store the weapons which a unit can use to perform an attack.
int getFirstBit(int zahl)
Count the number of zero bits on the LSB side of "zahl".
UnitWeapon weapons
The weapons.
bool shootable(void) const
DiplomaticStateVector diplomacy
int targ
the weapon can attack targets at these levels of height (bitmapped)
int getOwner() const
returns the number of the player this vehicle/building belongs to
static int maxshootdist[8]
vector< int > weaponShots
int getNumericalHeight() const
MapCoordinate3D getPosition() const
returns the units position
The buildings which a placed on the map.
a single field of the map
int checkfield(const MapCoordinate3D &pos, Vehicle *&eht, const Context &context)
void calc(void)
Performs the calculation of the attack. The result is only stored in the av and dv structures and is ...
int height
the current level of height ( BITMAPPED ! )
int beeline(const Vehicle *a, const Vehicle *b)
returns the distance between the units a and b
int getPlayerView() const
the player which is currently viewing the map.
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
The class describing properties that are common to all vehicles of a certain kind.
static ASCString toString(int i)
converts the parameter to a String
class Vehicle::ReactionFire reactionfire
VehicleList vehicleList
a list of all units
ItemRepositoryLoader< VehicleType > vehicleTypeRepository("vehicletype")
Interface for recording and playing replays.
virtual void cursor_goto(const MapCoordinate &pos)=0
Definition of THE central asc class: GameMap.
Interface for all the fighting routines of ASC.
int maxdistance
the maximum distance the weapon can shoot
void setresult(const Context &context)
Writes the result of the attack calculation to the actual units.
bool attackpossible2u(const Vehicle *attacker, const Vehicle *target, AttackWeap *atw, int targetheight)
Is attacker able to attack target ? Distance is not evaluated.
void removeunit(Vehicle *vehicle)
sigc::signal< void > updateFieldInfo
signed char actplayer
the player who is currently making his moves (may be human or AI)
int releasetimeslice(void)
virtual int finalCheck(int currentPlayer, const Context &context)
Vehicle * getUnit(int x, int y, int nwid)
MapDisplayInterface * display
void addunit(Vehicle *vehicle)
int attack(Vehicle *attacker, Vehicle *target, const Context &context)
int height
the levels of height which this unit can enter
int color
The owner of the container.
int xpos
the position on the map
Coordinate on the map including height.
AttackWeap * attackpossible(const Vehicle *attacker, int x, int y)
Is attacker able to attack anything in field x/y ?
tsearchreactionfireingunits(GameMap *gamemap)
bool canPerformAttack(Vehicle *target)
Status getStatus() const
for each player that can still be attacked one bit is set
~tsearchreactionfireingunits()
const int playerNum
the maximum number of players that ASC can manage.
virtual void showBattle(tfight &battle)=0
int getPlayerCount() const
void init(Vehicle *eht, const AStar3D::Path &fieldlist)
struct tunitlist * punitlist
Interface for a small general-purpose stack (not type safe)
int networkid
a unique identification of the unit that is used everywhere in ASC (and not only the network protocol...
The map. THE central structure of ASC, which holds everything not globally available together...
MapField * getField(int x, int y)