Advanced Strategic Command
mapfield.cpp
Go to the documentation of this file.
1 
5 /***************************************************************************
6  mapfield.cpp - description
7  -------------------
8  begin : Tue May 21 2005
9  copyright : (C) 2000 by Martin Bickel
10  email : bickel@asc-hq.org
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 
22 #include <algorithm>
23 #include <ctime>
24 #include <cmath>
25 
26 #include "global.h"
27 #include "typen.h"
28 #include "vehicletype.h"
29 #include "buildingtype.h"
30 #include "spfst.h"
31 #include "actions/context.h"
32 #include "actions/removeobject.h"
33 
34 void MapField::init ()
35 {
36  bdt.set ( 0 );
37  typ = NULL;
38  vehicle = NULL;
39  secondvehicle = NULL;
40  building = NULL;
41  visible = 0;
42  fuel = 0;
43  material = 0;
44  resourceview = NULL;
45  connection = 0;
46  gamemap = NULL;
47  viewbonus = 0;
48 }
49 void MapField::setaTemp (Uint8 temp) {
50  gamemap->temp[index] = temp;
51 };
53  return gamemap->temp[index];
54 };
55 
56 void MapField::setaTemp2 (Uint8 temp2) {
57  gamemap->temp2[index] = temp2;
58 };
60  return gamemap->temp2[index];
61 };
62 
63 void MapField::setTempw (Uint16 tempw) {
64  gamemap->temp[index] = tempw>>8;
65  gamemap->temp2[index] = tempw & 0xFF;
66 };
67 Uint16 MapField::getTempw () {
68  return gamemap->temp[index]<<8 | gamemap->temp2[index];
69 };
70 
71 void MapField::setTemp3 (int temp3) {
72  gamemap->temp3[index] = temp3;
73 };
75  return gamemap->temp3[index];
76 };
77 
78 void MapField::setTemp4 (int temp4) {
79  gamemap->temp4[index] = temp4;
80 };
82  return gamemap->temp4[index];
83 };
84 
86 {
87  return material;
88 }
89 
91 {
92  return fuel;
93 }
94 
95 void MapField::setMineralMaterial( int material )
96 {
97  if ( material < 0 )
98  this->material = 0;
99  else
100  if ( material > 255 )
101  this->material = 255;
102  else
103  this->material = material;
104 }
105 void MapField::setMineralFuel( int fuel )
106 {
107  if ( fuel < 0 )
108  this->fuel = 0;
109  else
110  if ( fuel > 255 )
111  this->fuel = 255;
112  else
113  this->fuel = fuel;
114 }
115 
116 void MapField::Resourceview::setview( int player, int material, int fuel )
117 {
118  visible |= 1 << player;
119  materialvisible[player] = material;
120  fuelvisible[player] = fuel;
121 }
122 
124 {
125  visible &= ~(1<<player);
126 }
127 
128 
129 void MapField::endRound( int turn )
130 {
131  bool recalc = false;
132  for ( ObjectContainer::iterator i = objects.begin(); i != objects.end(); ) {
133  if ( AgeableItem::age( *i )) {
134  i = objects.erase(i);
135  recalc = true;
136  } else
137  ++i;
138  }
139  // remove_if( objects.begin(), objects.end(), Object::age );
140 
141  for ( MineContainer::iterator i = mines.begin(); i != mines.end(); ) {
142  if ( AgeableItem::age( *i )) {
143  i = mines.erase(i);
144  recalc = true;
145  } else
146  ++i;
147  }
148  // remove_if( mines.begin(), mines.end(), Object::age );
149 
150  if ( recalc )
151  setparams();
152 }
153 
154 
156 {
157  typ = f.typ;
158  fuel = f.fuel;
159  material = f.material;
160  visible = f.visible;
161  vehicle = f.vehicle;
162  building = f.building;
163  if ( f.resourceview ) {
166  } else
167  resourceview = NULL;
168  mines = f.mines;
169  objects = f.objects;
171  bdt = f.bdt;
172  for ( int i = 0; i < 8; i++ )
173  view[i] = f.view[i];
174 }
175 
176 
178 {
179  return typ->terraintype;
180 }
181 
183 {
184  int weather = getWeather();
185  if ( terrain->weather[weather] )
186  typ = terrain->weather[weather];
187  else
188  typ = terrain->weather[0];
189 
190  setparams ();
191 }
192 
193 
195 {
196  int i = 1;
197  for ( MineContainer::iterator m = mines.begin(); m != mines.end(); m++, i++ )
198  if ( m->attacksunit ( veh ))
199  return i;
200 
201  return 0;
202 }
203 
205 {
206  int c = 0;
207  MineContainer::iterator i;
208  for ( i = mines.begin(); c < n; i++,c++ );
209  return *i;
210 }
211 
212 bool MapField :: addobject( const ObjectType* obj, int dir, bool force, MapField::ObjectRemovalStrategy* objectRemovalStrategy )
213 {
214  if ( !obj )
215  return false;
216 
217  Object* i = checkForObject ( obj );
218  if ( !i ) {
219  int buildable = obj->buildable ( this );
220  if ( !buildable )
221  if ( force )
222  buildable = 1;
223 
224  if ( buildable ) {
225  Object o ( obj );
226  if ( dir != -1 )
227  o.dir = dir;
228  else
229  o.dir = 0;
230 
231  objects.push_back ( o );
232 
233  sortobjects();
234  if ( dir == -1 )
235  calculateobject( getx(), gety(), true, obj, gamemap );
236 
237  if ( objectRemovalStrategy )
238  setparams( objectRemovalStrategy );
239  else
240  setparams();
241  return true;
242  } else
243  return false;
244 
245  } else {
246  if ( dir != -1 )
247  i->dir |= dir;
248 
249  i->lifetimer = obj->lifetime;
250  sortobjects();
251  return true;
252  }
253 }
254 
255 
256 bool MapField :: removeObject( const ObjectType* obj, bool force, ObjectRemovalStrategy* objectRemovalStrategy )
257 {
258  if ( !force && building )
259  return false;
260 
261  #ifndef karteneditor
262  if ( !force )
263  if ( vehicle )
264  if ( vehicle->getOwner() != gamemap->actplayer )
265  return false;
266  #endif
267 
268  bool removed = false;
269 
270  if ( !obj ) {
271  if ( objects.size() ) {
272  obj = objects.rbegin()->typ;
273  objects.pop_back();
274  removed = true;
275  }
276  } else
277  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); )
278  if ( o->typ == obj ) {
279  o = objects.erase( o );
280  removed = true;
281  } else
282  o++;
283 
284  if ( objectRemovalStrategy )
285  setparams( objectRemovalStrategy );
286  else
287  setparams();
288 
289  if ( obj )
290  calculateobject( getx(), gety(), true, obj, gamemap );
291 
292  return removed;
293 }
294 
296 {
297  if ( vehicle ) {
298  delete vehicle;
299  vehicle = NULL;
300  }
301 
302  if ( building ) {
303  delete building;
304  building = NULL;
305  }
306 
307  setparams();
308 }
309 
310 
311 bool MapField :: unitHere ( const Vehicle* veh )
312 {
313  if ( vehicle == veh )
314  return true;
315 
316  if ( vehicle && veh && vehicle->networkid == veh->networkid )
317  return true;
318  return false;
319 }
320 
322 {
323  if ( building && (bdt & getTerrainBitType(cbbuildingentry)).any() )
324  return building;
325  else
326  return NULL;
327 }
328 
329 
330 
332 {
333  if ( vehicle )
334  return vehicle;
335  else
336  return building;
337 }
338 
340 {
341  if ( vehicle )
342  return vehicle;
343  else
344  return building;
345 }
346 
347 
349 {
350  if ( building )
351  delete building;
352 }
353 
355 {
356  if ( vehicle ) {
357  delete vehicle;
358  vehicle = NULL;
359  }
360 }
361 
363 {
364  veh->unregisterPosition();
365  veh->setnewposition( getx(), gety() );
366  vehicle = veh;
367 }
368 
369 
371 {
372  if ( !typ )
373  return 0;
374  for ( int w = 0; w < cwettertypennum; w++ )
375  if ( typ == typ->terraintype->weather[w] )
376  return w;
377  return -1;
378 }
379 
380 void MapField :: setWeather ( int weather )
381 {
382  if ( weather < 0 || weather >= cwettertypennum )
383  return;
384 
385  if (typ->terraintype->weather[ weather ] ) {
386  typ = typ->terraintype->weather[ weather ];
387  setparams();
388  } else {
389  if ( weather == 2 )
390  setWeather(1);
391  else
392  if ( weather == 5 )
393  setWeather(4);
394  else
395  if (weather==4)
396  setWeather(3);
397  else {
398  typ = typ->terraintype->weather[ 0 ];
399  setparams();
400  }
401  }
402 }
403 
404 void MapField::setVisibility ( VisibilityStates valtoset, int actplayer )
405 {
406  int newval = (valtoset ^ 3) << ( 2 * actplayer );
407  int oneval = 3 << ( 2 * actplayer );
408 
409  visible |= oneval;
410  visible ^= newval;
411 };
412 
413 void MapField::resetView( GameMap* gamemap, int playersToReset )
414 {
415  int mask = 0;
416  for ( int i = 0; i < gamemap->getPlayerCount(); ++i )
417  if ( !(playersToReset & (1 << i)))
418  mask |= 3 << (2*i);
419 
420  int l = 0;
421  for ( int y = 0; y < gamemap->ysize; ++y )
422  for ( int x = 0; x < gamemap->xsize; ++x ) {
423  MapField& fld = gamemap->field[l++];
424  fld.visible &= mask;
425  }
426 
427 }
428 
429 
430 
431 bool compareObjectHeight ( const Object& o1, const Object& o2 )
432 {
433  return o1.typ->imageHeight < o2.typ->imageHeight;
434 }
435 
437 {
438  sort ( objects.begin(), objects.end(), compareObjectHeight );
439 }
440 
441 bool MapField :: putmine( int owner, MineTypes typ, int strength )
442 {
443  if ( mineowner() >= 0 && mineowner() != owner )
444  return false;
445 
446  if ( mines.size() >= gamemap->getgameparameter ( cgp_maxminesonfield ))
447  return false;
448 
449  Mine mymine ( typ, strength, owner, gamemap );
450  mines.push_back ( mymine );
451  return true;
452 }
453 
455 {
456  if ( mines.empty() )
457  return -1;
458  else
459  return mines.begin()->player;
460 }
461 
462 
463 void MapField :: removemine( int num )
464 {
465  if ( num == -1 )
466  num = mines.size() - 1;
467 
468  int i = 0;
469  for ( MineContainer::iterator m = mines.begin(); m != mines.end(); i++)
470  if ( i == num )
471  m = mines.erase ( m );
472  else
473  m++;
474 }
475 
476 
477 int MapField :: getx( void )
478 {
479  int n = this - gamemap->field;
480  return n % gamemap->xsize;
481 }
482 
483 int MapField :: gety( void )
484 {
485  int n = this - gamemap->field;
486  return n / gamemap->xsize;
487 }
488 
489 
491 {
492  int a = typ->attackbonus;
493  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); o++ ) {
494  if ( o->typ->attackbonus_abs != -1 )
495  a = o->typ->attackbonus_abs;
496  else
497  a += o->typ->attackbonus_plus;
498  }
499 
500  if ( a > -8 )
501  return a;
502  else
503  return -7;
504 }
505 
507 {
508  int a = typ->defensebonus;
509  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); o++ ) {
510  if ( o->typ->defensebonus_abs != -1 )
511  a = o->typ->defensebonus_abs;
512  else
513  a += o->typ->defensebonus_plus;
514  }
515 
516  if ( a > -8 )
517  return a;
518  else
519  return -7;
520 }
521 
523 {
525  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); o++ ) {
526  if ( o->typ->namingMethod == ObjectType::ReplaceTerrain )
527  a = o->typ->getName();
528  else
529  if ( o->typ->namingMethod == ObjectType::AddToTerrain )
530  a += ", " + o->typ->getName();
531  }
532 
533  return a;
534 }
535 
536 
538 {
539  int a = typ->basicjamming;
540  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); o++ ) {
541  if ( o->typ->basicjamming_abs >= 0 )
542  a = o->typ->basicjamming_abs;
543  else
544  a += o->typ->basicjamming_plus;
545  }
546  if ( a > 0 )
547  return a;
548  else
549  return 0;
550 }
551 
553 {
554  int mnum = mines.size();
555  if ( mnum ) {
556  int movemalus = __movemalus.at(veh->typ->movemalustyp);
557  int col = mineowner();
558  if ( veh->color == col*8 )
559  movemalus += movemalus * mine_movemalus_increase * mnum / 100;
560 
561  if ( movemalus < minmalq )
562  fatalError ( "invalid movemalus for terraintype ID %d used on field %d / %d" , typ->terraintype->id, getx(), gety() );
563 
564  return movemalus;
565  } else {
566  int mm = __movemalus.at(veh->typ->movemalustyp);
567  if ( mm < minmalq )
568  fatalError ( "invalid movemalus for terraintype ID %d used on field %d / %d" , typ->terraintype->id, getx(), gety() );
569  return mm;
570  }
571 }
572 
573 int MapField :: getmovemalus ( int type )
574 {
575  return __movemalus.at(type);
576 }
577 
579 {
580  return MapCoordinate( getx(), gety() );
581 }
582 
583 
585  public:
586  virtual void removeObject( MapField* fld, const ObjectType* obj )
587  {
588  for ( MapField::ObjectContainer::iterator o = fld->objects.begin(); o != fld->objects.end(); ) {
589  if ( o->typ == obj )
590  o = fld->objects.erase( o );
591  else
592  ++o ;
593  }
594  }
595 };
596 
597 
598 
600 {
602  setparams( &sor );
603 }
604 
605 void MapField :: setparams ( ObjectRemovalStrategy* objectRemovalStrategy )
606 {
607  int i;
608  bdt = typ->art;
609 
610  for ( i = 0; i < cmovemalitypenum; i++ ) {
611  __movemalus.at(i) = typ->move_malus[i];
612  if ( __movemalus[i] < minmalq )
613  fatalError ( "invalid movemalus for terraintype ID %d used on field %d / %d" , typ->terraintype->id, getx(), gety() );
614  }
615 
616  viewbonus = 0;
617 
618  for ( ObjectContainer::iterator o = objects.begin(); o != objects.end(); o++ ) {
620  if ( o->typ->getFieldModification(getWeather()).terrainaccess.accessible( bdt ) == -1 ) {
621  objectRemovalStrategy->removeObject( this, o->typ );
622  setparams( objectRemovalStrategy );
623  return;
624  }
625 
626  bdt &= o->typ->getFieldModification(getWeather()).terrain_and;
627  bdt |= o->typ->getFieldModification(getWeather()).terrain_or;
628 
629  for ( i = 0; i < cmovemalitypenum; i++ ) {
630  __movemalus[i] += o->typ->getFieldModification(getWeather()).movemalus_plus[i];
631  if ( (o->typ->getFieldModification(getWeather()).movemalus_abs[i] != 0) && (o->typ->getFieldModification(getWeather()).movemalus_abs[i] != -1) )
632  __movemalus[i] = o->typ->getFieldModification(getWeather()).movemalus_abs[i];
633  if ( __movemalus[i] < minmalq )
634  __movemalus[i] = minmalq;
635  }
636 
637  viewbonus += o->typ->viewbonus_plus;
638  if ( o->typ->viewbonus_abs != -1 )
639  viewbonus = o->typ->viewbonus_plus;
640  }
641 
642  if ( building )
643  if ( this == building->getField( building->typ->entry ))
645 
646 }
647 
649 {
650  for ( ObjectContainer::iterator i = objects.begin(); i != objects.end(); i++ )
651  if ( i->typ == o )
652  return &(*i);
653 
654  return NULL;
655 }
656 
657 
659 {
660  visible = 0;
661  memset ( &fuelvisible, 0, sizeof ( fuelvisible ));
662  memset ( &materialvisible, 0, sizeof ( materialvisible ));
663 }
664 
665 
667 {
668  int size = sizeof(*this);
669  return size;
670 }
671 
672 
674 {
675  if ( resourceview ) {
676  delete resourceview;
677  resourceview = NULL;
678  }
679 }
680 
681 
TerrainType::Weather * typ
the terraintype of the field
Definition: mapfield.h:38
Uint8 materialvisible[8]
Definition: mapfield.h:110
const TerrainType * getTerrainType() const
returns the terrain of the field
Definition: mapfield.cpp:177
The type of a field.
Definition: terraintype.h:75
void setVisibility(VisibilityStates valtoset, int actplayer)
The visibility status for all players is stored in a bitmapped variable.
Definition: mapfield.cpp:404
void setaTemp(Uint8 atemp)
Various algorithms need to store some information in the fields they process.
Definition: mapfield.cpp:49
void deleteeverything(void)
deletes everything placed on the field
Definition: mapfield.cpp:295
int xsize
the size of the map
Definition: gamemap.h:201
Mine & getMine(int n)
returns the nth mine. This function should only be used by legacy code; new code should store an iter...
Definition: mapfield.cpp:204
bool putmine(int owner, MineTypes typ, int strength)
put a mine of type typ for player owner and a punch of strength on the field. Strength is an absolute...
Definition: mapfield.cpp:441
map accessing and usage routines used by ASC and the mapeditor
int getattackbonus(void)
the attack bonus that unit get when they are attacking
Definition: mapfield.cpp:490
const BuildingType * typ
Definition: buildings.h:48
Vehicle * vehicle
Definition: mapfield.h:89
int connection
are any events connected to this field
Definition: mapfield.h:164
ASCString name
Definition: terraintype.h:82
void setnewposition(int x, int y)
checks whether the unit can construct a building of the given type.
Definition: vehicle.cpp:808
void changeTerrainType(const TerrainType *terrain)
changes the terrain type to a new one; weather is not changed
Definition: mapfield.cpp:182
void removeBuilding()
if there is a building on the field, the building is deleted (may affect othere fields too...
Definition: mapfield.cpp:348
int lifetime
the object is removed when it is lifetime turns old. -1 disables removal
Definition: objecttype.h:187
Uint8 material
Definition: mapfield.h:54
TerrainType * terraintype
pointer to the outer structure
Definition: terraintype.h:128
Weather * weather[cwettertypennum]
Definition: terraintype.h:140
int getOwner() const
returns the number of the player this vehicle/building belongs to
bool unitHere(const Vehicle *veh)
checks if the unit is standing on this field. Since units are being cloned for some checks...
Definition: mapfield.cpp:311
struct MapField::View view[8]
VisibilityStates
the different states that a player's view on a field can have
Definition: typen.h:403
bool compareObjectHeight(const Object &o1, const Object &o2)
Definition: mapfield.cpp:431
int getMineralMaterial() const
Definition: mapfield.cpp:85
const int mine_movemalus_increase
every mine on a field increases the field's movemalus by this amount (percent)
Definition: typen.h:507
void calculateobject(const MapCoordinate &pos, bool mof, const ObjectType *obj, GameMap *gamemap)
Definition: spfst.cpp:462
int mineowner(void)
the player who placed the mines on this field.
Definition: mapfield.cpp:454
ContainerBase * getContainer()
returns a pointer to the ContainerBase of the field or NULL if there is none
Definition: mapfield.cpp:331
Global platform dependant definitions. This file just branches to the platform specific files in thei...
a single field of the map
Definition: mapfield.h:26
Interface for removing objects from a field when it turns out that they can no longer exist...
Definition: mapfield.h:127
TerrainBits art
the properties defining which unit can move onto this field and which not
Definition: terraintype.h:125
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
char * temp2
Definition: gamemap.h:188
void setparams()
uses the SimpleObjectRemoval strategy
Definition: mapfield.cpp:599
TerrainType::MoveMalus move_malus
the movement cost for the various units to move across this field
Definition: terraintype.h:115
static void resetView(GameMap *gamemap, int playersToReset)
Definition: mapfield.cpp:413
int getWeather()
the weather that is on this field
Definition: mapfield.cpp:370
char * temp
Definition: gamemap.h:187
void removemine(int num)
removes a mine
Definition: mapfield.cpp:463
int viewbonus
units standing on this object will get a bonus to their view
Definition: mapfield.h:66
void setview(int player, int material, int fuel)
Definition: mapfield.cpp:116
void resetview(int player)
Definition: mapfield.cpp:123
MineTypes
Definition: objects.h:70
Building * getBuildingEntrance()
returns the building if there is one with its entrance on this field
Definition: mapfield.cpp:321
TerrainBits getTerrainBitType(TerrainBitTypes tbt)
void setMineralFuel(int fuel)
Definition: mapfield.cpp:105
void sortobjects(void)
sorts the objects. Since objects can be on different levels of height, the lower one must be displaye...
Definition: mapfield.cpp:436
const ObjectType * typ
Definition: objects.h:48
void setTemp3(int temp3)
Definition: mapfield.cpp:71
Uint8 fuel
mineral resources on this field.
Definition: mapfield.h:54
An object that can be placed on fields. Roads, pipelines and ditches are examples of objects...
Definition: objecttype.h:30
int lifetimer
Definition: objects.h:37
Coordinate on the twodimensional map.
Definition: typen.h:202
void setMineralMaterial(int material)
Definition: mapfield.cpp:95
int imageHeight
the level of height the object is on. This is not the simple system of 8 levels used for units and bu...
Definition: objecttype.h:101
int movemalustyp
The category of the unit. Original used only to distinguish only between different movement costs for...
Definition: vehicletype.h:206
const int cmovemalitypenum
The number of vehicle categories; Each category has its own move malus.
Definition: typen.h:384
MapField * getField(const BuildingType::LocalCoordinate &localCoordinates) const
returns the pointer to the field which the given part of the building is standing on ...
Definition: buildings.cpp:399
Uint8 getaTemp()
Definition: mapfield.cpp:52
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
void removeUnit()
if there is a unit on the field, the unit will be deleted
Definition: mapfield.cpp:354
The interface for the buildingtype class.
int dir
Definition: objects.h:51
bool addobject(const ObjectType *obj, int dir=-1, bool force=false, ObjectRemovalStrategy *objectRemovalStrategy=NULL)
add an object to the field
Definition: mapfield.cpp:212
virtual void removeObject(MapField *fld, const ObjectType *obj)=0
int getx()
Definition: mapfield.cpp:477
signed char actplayer
the player who is currently making his moves (may be human or AI)
Definition: gamemap.h:232
int gety()
Definition: mapfield.cpp:483
int * temp4
Definition: gamemap.h:190
bool buildable(MapField *fld) const
can the object be build on the field fld
Definition: objecttype.cpp:77
int ysize
Definition: gamemap.h:201
TerrainBits bdt
the terraintype properties. They determine which units can move over the field. This variable is reca...
Definition: mapfield.h:161
int basicjamming
the view obstraction of the field
Definition: terraintype.h:112
MineContainer mines
Definition: mapfield.h:117
int getgameparameter(GameParameter num) const
Definition: gamemap.cpp:1047
virtual void removeObject(MapField *fld, const ObjectType *obj)
Definition: mapfield.cpp:586
int color
The owner of the container.
void operator=(const MapField &f)
Definition: mapfield.cpp:155
MapField * field
the array of fields
Definition: gamemap.h:204
void setWeather(int weather)
Definition: mapfield.cpp:380
const VehicleType * typ
Definition: vehicle.h:83
void moveUnitHere(Vehicle *veh)
registers the unit on the field, and unregisters it whereever it previously was
Definition: mapfield.cpp:362
int getTemp4()
Definition: mapfield.cpp:81
Building * building
Definition: mapfield.h:102
int getjamming(void)
the radar jamming that is on this field
Definition: mapfield.cpp:537
void setTempw(Uint16 tempw)
Definition: mapfield.cpp:63
Vehicle * secondvehicle
two units and the same field are only allowed temporary during movement
Definition: mapfield.h:92
Uint16 getTempw()
Definition: mapfield.cpp:67
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
int getMemoryFootprint() const
Definition: mapfield.cpp:666
static bool age(AgeableItem &obj)
ages the object by one turn. Returns true if the object shall be removed
Definition: objects.cpp:71
an instance of an object type (ObjectType) on the map
Definition: objects.h:46
void setaTemp2(Uint8 atemp2)
Definition: mapfield.cpp:56
int getdefensebonus(void)
the defense bonus that unit get when they are attacked
Definition: mapfield.cpp:506
int defensebonus
the defense bonus for the unit standing on this field.
Definition: terraintype.h:106
MapCoordinate getPosition()
Definition: mapfield.cpp:578
Object * checkForObject(const ObjectType *o)
checks if there are objects from the given type on the field and returns them
Definition: mapfield.cpp:648
void setTemp4(int temp4)
Definition: mapfield.cpp:78
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
ASCString getName()
Definition: mapfield.cpp:522
int getMineralFuel() const
Definition: mapfield.cpp:90
void endRound(int turn)
Definition: mapfield.cpp:129
int getPlayerCount() const
Definition: gamemap.h:255
int getmovemalus(const Vehicle *veh)
Definition: mapfield.cpp:552
LocalCoordinate entry
the position of the entrance, which is the field of the building where units can enter and leave ...
Definition: buildingtype.h:74
int getTemp3()
Definition: mapfield.cpp:74
const int cwettertypennum
The number of different weather.
Definition: typen.h:61
int networkid
a unique identification of the unit that is used everywhere in ASC (and not only the network protocol...
Definition: vehicle.h:140
int mineattacks(const Vehicle *veh)
can any of the mines on this field attack this unit
Definition: mapfield.cpp:194
#define minmalq
Definition: typen.h:430
Resourceview * resourceview
the mineral resources that were seen by a player on this field; since the actual amount may have decr...
Definition: mapfield.h:114
void unregisterPosition()
unregisters the unit at its current position (e.g. from a map field, or inside a transport) ...
Definition: vehicle.cpp:830
ObjectContainer objects
Definition: mapfield.h:124
Uint8 getaTemp2()
Definition: mapfield.cpp:59
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
int * temp3
Definition: gamemap.h:189
int attackbonus
the attack bonus for the unit standing on this field.
Definition: terraintype.h:109