Advanced Strategic Command
spfst.cpp
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 #include <stdio.h>
26 #include <cstring>
27 #include <utility>
28 #include <map>
29 
30 
31 #include "vehicletype.h"
32 #include "buildingtype.h"
33 
34 #include "typen.h"
35 #include "spfst.h"
36 #include "attack.h"
37 
38 #include "mapalgorithms.h"
39 #include "vehicle.h"
40 #include "buildings.h"
41 #include "mapfield.h"
42 
43 #include "spfst-legacy.h"
44 
45 sigc::signal<void> repaintMap;
46 sigc::signal<void> repaintDisplay;
47 sigc::signal<void> updateFieldInfo;
48 sigc::signal<void> cursorMoved;
49 sigc::signal<void,ContainerBase*> showContainerInfo;
50 sigc::signal<void,VehicleType*> showVehicleTypeInfo;
51 sigc::signal<void> viewChanged;
52 sigc::signal<void,GameMap*> mapChanged;
53 sigc::signal<bool> idleEvent;
54 sigc::signal<void, const Context&> fieldCrossed;
55 
56 
57 
58 void displaymap()
59 {
60  repaintMap();
61 }
62 
63 
64  GameMap* actmap = NULL;
65 
67 
68 
69 
70 int terrainaccessible ( const MapField* field, const Vehicle* vehicle, int uheight )
71 {
72  int res = terrainaccessible2 ( field, vehicle, uheight );
73  if ( res < 0 )
74  return 0;
75  else
76  return res;
77 }
78 
79 int terrainaccessible2 ( const MapField* field, const Vehicle* vehicle, int uheight )
80 {
81  if ( uheight == -1 )
82  uheight = vehicle->height;
83 
84  if ( !(uheight & vehicle->typ->height))
85  return 0;
86 
87 
88  return terrainaccessible2( field, vehicle->typ->terrainaccess, uheight );
89 }
90 
91 int terrainaccessible2 ( const MapField* field, const TerrainAccess& terrainAccess, int uheight )
92 {
93  if ( uheight >= chtieffliegend)
94  return 2;
95  else {
96  if ( uheight == chtiefgetaucht )
97  if ( (field->bdt & getTerrainBitType(cbwater3) ).any() )
98  return 2;
99  else
100  return -1;
101  else
102  if ( uheight == chgetaucht )
103  if ( (field->bdt & ( getTerrainBitType(cbwater3) | getTerrainBitType(cbwater2 )) ).any() )
104  return 2;
105  else
106  return -2;
107  else {
108  if ( terrainAccess.accessible ( field->bdt ) > 0 ) {
109  if ( uheight == chschwimmend ) {
110  if ( (field->bdt & getTerrainBitType(cbwater)).any() )
111  return 2;
112  else
113  return -3;
114  } else
115  return 2;
116  } else
117  return -3;
118  }
119  }
120 }
121 
122 
123 
124 int fieldAccessible( const MapField* field,
125  const Vehicle* vehicle,
126  int uheight,
127  const bool* attacked,
128  bool ignoreVisibility )
129 {
130  if ( !field || !vehicle )
131  return 0;
132 
133  if ( uheight == -2 )
134  uheight = vehicle->height;
135 
136  if ( !ignoreVisibility ) {
137  int c = fieldVisibility ( field, vehicle->getOwner() );
138 
139  if (field == NULL)
140  return 0;
141 
142  if (c == visible_not)
143  return 0;
144  }
145 
146 /*
147  if ( c == visible_all)
148  if ( field->mines.size() )
149  for ( int i = 0; i < field->mines.size(); i++ )
150  if ( field->getMine(i).attacksunit( vehicle ))
151  return 0;
152 */
153 
154 
155  if ( (!field->vehicle || field->vehicle == vehicle) && !field->building ) {
156  if ( vehicle->typ->height & uheight )
157  return terrainaccessible ( field, vehicle, uheight );
158  else
159  return 0;
160  } else {
161  if (field->vehicle) {
162  if ( vehicle->getMap()->getPlayer(vehicle).diplomacy.isAllied( field->vehicle->getOwner()) ) {
163  if ( field->vehicle->vehicleLoadable ( vehicle, uheight ) )
164  return 2;
165  else
166  if ( terrainaccessible ( field, vehicle, uheight ))
167  return 1;
168  else
169  return 0;
170  }
171  else
172  if ( terrainaccessible ( field, vehicle, uheight ) ) {
173  if (vehicleplattfahrbar(vehicle,field))
174  return 2;
175  else {
176  if ( getheightdelta(getFirstBit(field->vehicle->height), getFirstBit(uheight)) || (attackpossible28(field->vehicle,vehicle) == false) || ( vehicle->getMap()->getPlayer(vehicle).diplomacy.getState( field->vehicle->getOwner()) >= PEACE ))
177  return 1;
178  }
179  }
180  }
181  else { // building
182  if ((field->bdt & getTerrainBitType(cbbuildingentry) ).any() && field->building->vehicleLoadable ( vehicle, uheight, attacked ))
183  return 2;
184  else
185  if (uheight >= chtieffliegend || (field->building->typ->height <= chgetaucht && uheight >= chschwimmend && terrainaccessible ( field, vehicle, uheight )))
186  return 1;
187  else
188  return 0;
189  }
190  }
191  return 0;
192 }
193 
194 
195 
196 
197 
198 
200  int y)
201 {
202  if ((x < 0) || (y < 0) || (x >= actmap->xsize) || (y >= actmap->ysize))
203  return NULL;
204  else
205  return ( &actmap->field[y * actmap->xsize + x] );
206 }
207 
208 
209 
210 void putbuilding( GameMap* actmap,
211  const MapCoordinate& entryPosition,
212  int color,
213  const BuildingType* buildingtyp,
214  int completion,
215  int ignoreunits )
216 {
217  if ( color & 7 )
218  fatalError("putbuilding muss eine farbe aus 0,8,16,24,.. uebergeben werden !",2);
219 
220  for ( int a = 0; a < 4; a++)
221  for ( int b = 0; b < 6; b++ )
222  if ( buildingtyp->fieldExists ( BuildingType::LocalCoordinate( a, b ) ) ) {
223  MapField* field = actmap->getField( buildingtyp->getFieldCoordinate( entryPosition, BuildingType::LocalCoordinate(a,b) ));
224  if (field == NULL)
225  return ;
226  else {
227  if ( field->vehicle && (!ignoreunits ) )
228  return;
229  if (field->building != NULL)
230  return;
231  }
232  }
233 
234 
235  Building* gbde = new Building ( actmap , entryPosition, buildingtyp, color/8 );
236 
237  if (completion >= buildingtyp->construction_steps)
238  completion = buildingtyp->construction_steps - 1;
239 
240  gbde->setCompletion ( completion );
241 }
242 
243 
244 
245 
246 
248 {
249  for ( int y = 0; y < gamemap->ysize; y++ )
250  for ( int x = 0; x < gamemap->xsize; x++ ) {
251  MapField* fld = getfield ( x, y );
252  for ( MapField::ObjectContainer::iterator i = fld->objects.begin(); i != fld->objects.end(); )
253  if ( i->typ->getFieldModification(fld->getWeather()).terrainaccess.accessible ( fld->bdt ) < 0 ) {
254  fld->removeObject ( i->typ, true );
255  i = fld->objects.begin();
256  } else
257  i++;
258  }
259 }
260 
261 void checkunitsforremoval ( GameMap* gamemap )
262 {
263  ASCString messages[playerNum];
264  for ( int y = 0; y < gamemap->ysize; y++ )
265  for ( int x = 0; x < gamemap->xsize; x++ ) {
266  MapField* fld = gamemap->getField ( x, y );
267  if ( (fld->building && fld->building->typ->terrainaccess.accessible( fld->bdt ) < 0) && (fld->building->typ->height <= chfahrend) ) {
268  messages[fld->building->getOwner()] += getBuildingReference( fld->building ) + " was destroyed \n\n";
269  delete fld->building;
270  }
271  }
272 
273 
274  for ( int c=0; c<=8 ;c++ ) {
275  ASCString msg = messages[c];
276  for ( Player::VehicleList::iterator i = gamemap->player[c].vehicleList.begin(); i != gamemap->player[c].vehicleList.end(); ) {
277 
278  Vehicle* eht = *i;
279  MapField* field = gamemap->getField(eht->xpos,eht->ypos);
280  bool erase = false;
281 
282  ASCString reason;
283  if (field->vehicle == eht) {
284  if ( eht->height <= chfahrend )
285  if ( eht->typ->terrainaccess.accessible ( field->bdt ) < 0 ) {
286  erase = true;
287  reason = "was swallowed by the ground";
288  }
289  if ( eht )
290  if ( getmaxwindspeedforunit( eht ) < gamemap->weather.windSpeed*maxwindspeed ) {
291  reason = "was blown away by the wind";
292  erase = true;
293  }
294  }
295  if ( erase ) {
296  msg += getUnitReference( eht ) + reason;
297  msg += "\n\n";
298 
299  Vehicle* pv = *i;
300  gamemap->player[c].vehicleList.erase ( i );
301  delete pv;
302 
303 
304 
305  /* if the unit was a transport and had other units loaded, these units have been deleted as well.
306  We don't know which elements of the container are still valid, so we start from the beginning again. */
307  i = gamemap->player[c].vehicleList.begin();
308  } else
309  i++;
310  }
311 
312  if ( !msg.empty() )
313  new Message ( msg, gamemap, 1<<c);
314  }
315 }
316 
317 
318 int getwindheightforunit ( const Vehicle* eht, int uheight )
319 {
320  if ( uheight == -1 )
321  uheight = eht->height;
322 
323  if ( uheight == chfliegend )
324  return 1;
325  else
326  if ( uheight == chhochfliegend )
327  return 2;
328  else
329  return 0;
330 }
331 
332 int getmaxwindspeedforunit ( const Vehicle* eht )
333 {
334  MapField* field = eht->getMap()->getField(eht->xpos,eht->ypos);
335  if ( field->vehicle == eht) {
336  if (eht->height >= chtieffliegend && eht->height <= chhochfliegend ) // || ((eht->height == chfahrend) && ( field->typ->art & cbwater ))) )
337  return eht->typ->movement[getFirstBit(eht->height)] * 256 ;
338 
339  if ( (field->bdt & getTerrainBitType(cbfestland)).none() && eht->height <= chfahrend && eht->height >= chschwimmend && (field->bdt & getTerrainBitType(cbharbour)).none() && (field->bdt & getTerrainBitType(cbwater0)).none())
340  return eht->typ->maxwindspeedonwater * maxwindspeed;
341  }
342  return maxint;
343 }
344 
345 
346 /*
347 
348 
349 void tdrawline8 :: start ( int x1, int y1, int x2, int y2 )
350 {
351  x1 += x1 + (y1 & 1);
352  x2 += x2 + (y2 & 1);
353  tdrawline::start ( x1, y1, x2, y2 );
354 }
355 
356 void tdrawline8 :: putpix ( int x, int y )
357 {
358  if ( (x & 1) == (y & 1) )
359  putpix8( x/2, y );
360 }
361 */
362 /*
363 void EllipseOnScreen :: paint ( void )
364 {
365  if ( active )
366  ellipse ( x1, y1, x2, y2, color, precision );
367 }
368 
369 void EllipseOnScreen :: read( tnstream& stream )
370 {
371  x1 = stream.readInt();
372  y1 = stream.readInt();
373  x2 = stream.readInt();
374  y2 = stream.readInt();
375  color = stream.readInt();
376  precision = stream.readFloat();
377  active = stream.readInt();
378 }
379 
380 void EllipseOnScreen :: write ( tnstream& stream )
381 {
382  stream.writeInt( x1 );
383  stream.writeInt( y1 );
384  stream.writeInt( x2 );
385  stream.writeInt( y2 );
386  stream.writeInt( color );
387  stream.writeFloat( precision );
388  stream.writeInt( active );
389 }
390 
391 */
392 
393 int getheightdelta ( const ContainerBase* c1, const ContainerBase* c2 )
394 {
395  return getheightdelta( getFirstBit(c1->getHeight()), getFirstBit(c2->getHeight() ));
396 }
397 
398 
399 bool fieldvisiblenow( const MapField* pe, Vehicle* veh, int player )
400 {
401  GameMap* gamemap = pe->getMap();
402  if ( player == -1 )
403  return true;
404 
405  if ( player < -1 )
406  return false;
407 
408  if ( !gamemap )
409  return false;
410 
411  if ( pe ) {
412  int c = (pe->visible >> ( player * 2)) & 3;
413 
414  if ( c < gamemap->getInitialMapVisibility( player ) )
415  c = gamemap->getInitialMapVisibility( player );
416 
417  if (c > visible_ago) {
418  if ( !veh )
419  veh = pe->vehicle;
420 
421  if ( veh ) {
422  if ((c == visible_all) || (veh->color / 8 == player ) || ((veh->height >= chschwimmend) && (veh->height <= chhochfliegend)))
423  return true;
424  }
425  else
426  if (pe->building != NULL) {
427  if ((c == visible_all) || (pe->building->typ->height >= chschwimmend) || (pe->building->color == player*8))
428  return true;
429  }
430  else
431  return true;
432  }
433  }
434  return false;
435 }
436 
437 
438 
439 
441 {
442  return fieldVisibility( pe, pe->getMap()->actplayer );
443 }
444 
445 VisibilityStates fieldVisibility( const MapField* pe, int player )
446 {
447  if ( player < 0 )
448  return visible_all;
449 
450  if ( pe ) {
451  GameMap* gamemap = pe->getMap();
452  VisibilityStates c = VisibilityStates((pe->visible >> ( player * 2)) & 3);
453  if ( c < gamemap->getInitialMapVisibility( player ) )
454  c = gamemap->getInitialMapVisibility( player );
455 
456  return c;
457  } else
458  return visible_not;
459 }
460 
461 
462 void calculateobject( const MapCoordinate& pos,
463  bool mof,
464  const ObjectType* obj,
465  GameMap* gamemap )
466 {
467  calculateobject( pos.x, pos.y, mof, obj, gamemap );
468 }
469 
470 
471 void calculateobject( int x,
472  int y,
473  bool mof,
474  const ObjectType* obj,
475  GameMap* actmap )
476 {
478  return;
479 
481  // ForestCalculation::calculateforest( actmap, obj );
482  return;
483  }
484 
485  MapField* fld = actmap->getField(x,y) ;
486  Object* oi2 = fld-> checkForObject ( obj );
487 
488  int c = 0;
489  for ( int dir = 0; dir < sidenum; dir++) {
490  int a = x + getnextdx( dir, y );
491  int b = y + getnextdy( dir);
492  MapField* fld2 = actmap->getField(a,b);
493 
494  if ( fld2 ) {
495  if ( obj->netBehaviour & ObjectType::NetToSelf )
496  if ( fld2->checkForObject ( obj )) {
497  c |= 1 << dir ;
498  if ( mof )
499  calculateobject ( a, b, false, obj, actmap );
500  }
501 
502 
503  for ( int oj = 0; oj < int(obj->linkableObjects.size()); oj++ ) {
504  for ( int id = obj->linkableObjects[oj].from; id <= obj->linkableObjects[oj].to; ++id ) {
505  Object* oi = fld2->checkForObject ( actmap->getobjecttype_byid ( id ) );
506  if ( oi ) {
507  c |= 1 << dir ;
508  if ( mof )
509  calculateobject ( a, b, false, oi->typ, actmap );
510  }
511  }
512  }
513 
514  for ( unsigned int t = 0; t < obj->linkableTerrain.size(); t++ )
515  for ( int id = obj->linkableTerrain[t].from; id <= obj->linkableTerrain[t].to; ++id )
516  if ( fld2->typ->terraintype->id == id )
517  c |= 1 << dir ;
518 
521  c |= 1 << dir;
522 
524  c |= 1 << dir;
525  }
526 
527  }
528  else {
530  c |= 1 << dir;
531  }
532  }
533 
534  if ( obj->netBehaviour & ObjectType::AutoBorder ) {
535  int autoborder = 0;
536  int count = 0;
537  for ( int dir = 0; dir < sidenum; dir++) {
538  int a = x + getnextdx( dir, y );
539  int b = y + getnextdy( dir);
540  MapField* fld2 = actmap->getField(a,b);
541  if ( !fld2 ) {
542  // if the field opposite of the border field is connected to, make a straight line out of the map.
543  if ( c & (1 << ((dir+sidenum/2) % sidenum ))) {
544  autoborder |= 1 << dir;
545  count++;
546  }
547  }
548  }
549  if ( count == 1 )
550  c |= autoborder;
551  }
552 
553  if ( oi2 ) {
554  oi2->setDir ( c );
555  }
556 
557 }
558 
559 
560 
561 
563 {
564  // vector<ObjectType*> forestObjects;
565  for ( int y = 0; y < actmap->ysize ; y++)
566  for ( int x = 0; x < actmap->xsize ; x++) {
567  MapField* fld = actmap->getField(x,y);
568 
569  for ( MapField::ObjectContainer::iterator i = fld->objects.begin(); i != fld->objects.end(); i++ )
570  // if ( !(i->typ->netBehaviour & ObjectType::SpecialForest) )
571  calculateobject( x, y, false, i->typ, actmap );
572  #if 0
573  else
574  if ( find ( forestObjects.begin(), forestObjects.end(), i->typ ) == forestObjects.end())
575  forestObjects.push_back ( i->typ );
576  #endif
577 
578  fld->setparams();
579  }
580 #if 0
581  for ( vector<ObjectType*>::iterator i = forestObjects.begin(); i != forestObjects.end(); i++ )
583 #endif
584 }
585 
586 
587 
DiplomaticStates getState(PlayerID towardsPlayer) const
Definition: player.cpp:92
ASCString getUnitReference(Vehicle *veh)
Definition: vehicle.cpp:1770
TerrainType::Weather * typ
the terraintype of the field
Definition: mapfield.h:38
void displaymap()
Definition: spfst.cpp:58
Schriften schriften
Definition: spfst.cpp:66
sigc::signal< void, GameMap * > mapChanged
Definition: spfst.cpp:52
int fieldAccessible(const MapField *field, const Vehicle *vehicle, int uheight, const bool *attacked, bool ignoreVisibility)
Definition: spfst.cpp:124
Player & getPlayer(PlayerID p)
Definition: gamemap.h:257
int xsize
the size of the map
Definition: gamemap.h:201
MapCoordinate getFieldCoordinate(const MapCoordinate &entryOnMap, const LocalCoordinate &localCoordinate) const
returns the Mapcoordinate of a buildings field
map accessing and usage routines used by ASC and the mapeditor
const BuildingType * typ
Definition: buildings.h:48
#define chschwimmend
Definition: typen.h:412
Vehicle * vehicle
Definition: mapfield.h:89
sigc::signal< void > repaintDisplay
Definition: spfst.cpp:46
bool vehicleLoadable(const Vehicle *vehicle, int uheight=-1, const bool *attacked=NULL) const
can the vehicle be loaded.
int getheightdelta(const ContainerBase *c1, const ContainerBase *c2)
calculate the height difference between two levels of height.
Definition: spfst.cpp:393
int terrainaccessible2(const MapField *field, const Vehicle *vehicle, int uheight)
Checks if the unit can drive on the field.
Definition: spfst.cpp:79
int getFirstBit(int zahl)
Count the number of zero bits on the LSB side of "zahl".
Definition: misc.cpp:45
TerrainType * terraintype
pointer to the outer structure
Definition: terraintype.h:128
DiplomaticStateVector diplomacy
Definition: player.h:209
bool hasFunction(ContainerFunctions function) const
int getOwner() const
returns the number of the player this vehicle/building belongs to
int netBehaviour
specifies how the object is going to connect to other things
Definition: objecttype.h:138
VisibilityStates
the different states that a player's view on a field can have
Definition: typen.h:403
A local coordinate referencing a single field that a building covers.
Definition: buildingtype.h:57
void checkunitsforremoval(GameMap *gamemap)
removes all units that cannot exist any more, either due to invalid terrin (like tanks on melting ice...
Definition: spfst.cpp:261
sigc::signal< void > repaintMap
}@
Definition: spfst.cpp:45
void calculateobject(const MapCoordinate &pos, bool mof, const ObjectType *obj, GameMap *gamemap)
Definition: spfst.cpp:462
#define chhochfliegend
Definition: typen.h:416
The buildings which a placed on the map.
a single field of the map
Definition: mapfield.h:26
MapField * getfield(int x, int y)
returns the field at the given coordinates
Definition: spfst.cpp:199
struct GameMap::Weather weather
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
sigc::signal< void, const Context & > fieldCrossed
Definition: spfst.cpp:54
vector< int > movement
the distance a unit can travel each round. One value for each of the 8 levels of height ...
Definition: vehicletype.h:203
int height
the current level of height ( BITMAPPED ! )
Definition: vehicle.h:118
void calculateforest(GameMap *actmap, ObjectType *woodObj)
Definition: objecttype.cpp:755
int getWeather()
the weather that is on this field
Definition: mapfield.cpp:370
const int sidenum
the number of sides that a field has; is now fixed at 6;
Definition: typen.h:438
bool attackpossible28(const Vehicle *attacker, const Vehicle *target, AttackWeap *atw, int targetHeight)
Is attacker able to attack target ? Distance is assumed one field.
Definition: attack.cpp:983
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
Definition: spfst.cpp:399
bool fieldExists(const LocalCoordinate &localCoordinate) const
returns whether this building covers the given field
Definition: buildingtype.h:108
int terrainaccessible(const MapField *field, const Vehicle *vehicle, int uheight)
Checks if the unit can drive on the field.
Definition: spfst.cpp:70
#define chtiefgetaucht
Definition: typen.h:410
VehicleList vehicleList
a list of all units
Definition: player.h:135
The class describing properties that are common to all buildings of a certain kind.
Definition: buildingtype.h:35
This class is used by buildings, vehicles and objects to specify which terrain it can move to / be bu...
Definition: terraintype.h:42
void setDir(int dir)
Definition: objects.cpp:99
TerrainBits getTerrainBitType(TerrainBitTypes tbt)
const ObjectType * typ
Definition: objects.h:48
#define chtieffliegend
Definition: typen.h:414
GameMap * getMap() const
Definition: mapfield.h:38
An object that can be placed on fields. Roads, pipelines and ditches are examples of objects...
Definition: objecttype.h:30
Coordinate on the twodimensional map.
Definition: typen.h:202
void setparams(ObjectRemovalStrategy *objectRemovalStrategy)
recalculates the terrain properties, movemalus etc from the terraintype and the objects,
Definition: mapfield.cpp:605
Interface for all the fighting routines of ASC.
Uint16 visible
can this field be seen be the player. Variable is bitmapped; two bits for each player. These two bits can have the states defined in VisibilityStates
Definition: mapfield.h:63
virtual int getHeight() const =0
returns the bitmapped level of height. Only one bit will be set, of course
The interface for the buildingtype class.
int getnextdx(int dir, int y)
Definition: mapalgorithms.h:77
sigc::signal< void, ContainerBase * > showContainerInfo
Definition: spfst.cpp:49
int accessible(const TerrainBits &bts) const
checks whether a field with the given terrainbits is accessible.
int getmaxwindspeedforunit(const Vehicle *eht)
returns the maximum wind speed that the unit can endure
Definition: spfst.cpp:332
void calculateallobjects(GameMap *actmap)
recalculates the connection (like road interconnections) of all objects on the map ...
Definition: spfst.cpp:562
sigc::signal< void, VehicleType * > showVehicleTypeInfo
Definition: spfst.cpp:50
vector< IntRange > linkableTerrain
objects can be graphically linked to terrain, as if the terrain was an object of the same type...
Definition: objecttype.h:53
sigc::signal< void > updateFieldInfo
Definition: spfst.cpp:47
void setCompletion(int completion, bool setupImages=true)
Sets the level of completion of the building.
Definition: buildings.cpp:259
signed char actplayer
the player who is currently making his moves (may be human or AI)
Definition: gamemap.h:232
TerrainAccess terrainaccess
the terrain properties which are necessary for the building to be constructed there ...
Definition: buildingtype.h:86
#define chfahrend
Definition: typen.h:413
void putbuilding(GameMap *actmap, const MapCoordinate &entryPosition, int color, const BuildingType *buildingtyp, int completion, int ignoreunits)
puts a building onto the map. To be used by the map editor! For ingame usage, see ConstructBuildingCo...
Definition: spfst.cpp:210
Player player[9]
Definition: gamemap.h:253
VisibilityStates fieldVisibility(const MapField *pe)
}@
Definition: spfst.cpp:440
int getnextdy(int dir)
Definition: mapalgorithms.h:80
int ysize
Definition: gamemap.h:201
sigc::signal< void > viewChanged
the view of the player onto the map changed, for example because he scrolled the map ...
Definition: spfst.cpp:51
TerrainBits bdt
the terraintype properties. They determine which units can move over the field. This variable is reca...
Definition: mapfield.h:161
sigc::signal< bool > idleEvent
Definition: spfst.cpp:53
int height
the levels of height which this unit can enter
A Message to a player. It may either be send by another player or by the system.
Definition: messages.h:30
int color
The owner of the container.
MapField * field
the array of fields
Definition: gamemap.h:204
int xpos
the position on the map
Definition: vehicle.h:124
Definition: player.h:53
int construction_steps
the number of stages that are required to construct a building using a construction unit...
Definition: buildingtype.h:89
const VehicleType * typ
Definition: vehicle.h:83
bool isAllied(PlayerID towardsPlayer) const
Definition: player.h:82
ASCString getBuildingReference(Building *bld)
Definition: buildings.cpp:881
int maxwindspeedonwater
the maximum speed of the wind that the unit can survive when on open water without sinking ...
Definition: vehicletype.h:209
Building * building
Definition: mapfield.h:102
void checkobjectsforremoval(GameMap *gamemap)
removes all objects that cannot exist where they currently are (terrainaccess)
Definition: spfst.cpp:247
sigc::signal< void > cursorMoved
Definition: spfst.cpp:48
#define maxint
Definition: typen.h:462
GameMap * getMap() const
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
vector< IntRange > linkableObjects
some objects are graphically linked with others on neighbouring fields.
Definition: objecttype.h:50
an instance of an object type (ObjectType) on the map
Definition: objects.h:46
#define chgetaucht
Definition: typen.h:411
ObjectType * getobjecttype_byid(int id)
Definition: gamemap.cpp:1783
const int playerNum
the maximum number of players that ASC can manage.
Definition: typen.h:54
Object * checkForObject(const ObjectType *o)
checks if there are objects from the given type on the field and returns them
Definition: mapfield.cpp:648
int ypos
Definition: vehicle.h:124
void fatalError(const ASCString &string)
bool removeObject(const ObjectType *obj, bool force=false, ObjectRemovalStrategy *objectRemovalStrategy=NULL)
removes all objects of the given type from the field
Definition: mapfield.cpp:256
TerrainAccess terrainaccess
the terrain this unit can move to
Definition: vehicletype.h:221
bool vehicleplattfahrbar(const Vehicle *vehicle, const MapField *field)
Can the vehicle drive across the field and destroy any unit there by moving over them?
Definition: attack.cpp:1069
#define chfliegend
Definition: typen.h:415
VisibilityStates getInitialMapVisibility(int player)
Definition: gamemap.cpp:1950
GameMap * actmap
Definition: spfst.cpp:64
int getwindheightforunit(const Vehicle *eht, int uheight)
Wind may be different at different heights.
Definition: spfst.cpp:318
const int maxwindspeed
Wind with its maximum strength of 255 is moving this distance per turn.
Definition: typen.h:501
ObjectContainer objects
Definition: mapfield.h:124
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
MapField * getField(int x, int y)
Definition: gamemap.h:465