Advanced Strategic Command
base.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  base.cpp - description
3  -------------------
4  begin : Fri Mar 30 2001
5  copyright : (C) 2001 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "ai_common.h"
19 
20 #include "../replaymapdisplay.h"
21 #include "../turncontrol.h"
22 #include "../widgets/textrenderer.h"
23 #include "../mapdisplay.h"
24 #include "../asc-mainscreen.h"
25 #include "../gameeventsystem.h"
26 #include "../actions/diplomacycommand.h"
27 
28 AI :: AI ( GameMap* _map, int _player ) : activemap ( _map ) , sections ( this )
29 {
30  strictChecks = false;
31  benchMark = false;
32 
33  player = _player;
34 
35  isRunning(false);
36  fieldInformation = NULL;
37 
38  reset();
39 }
40 
41 void AI :: reset ( void )
42 {
43  maxTrooperMove = 0;
44  maxTransportMove = 0;
45  maxUnitMove = 0;
46 
47  for ( int i= 0; i < 8; i++ )
48  maxWeapDist[i] = -1;
49  baseThreatsCalculated = 0;
50 
51  if ( fieldInformation )
52  delete[] fieldInformation;
53 
54  fieldInformation = NULL;
55  fieldNum = 0;
56 
57  config.wholeMapVisible = 1;
58  config.lookIntoTransports = 1;
59  config.lookIntoBuildings = 1;
60  config.aggressiveness = 3;
61  config.damageLimit = 70;
62  config.resourceLimit = Resources ( 0, 5, 20 );
63  config.ammoLimit= 10;
64  config.maxCaptureTime = 15;
65  config.maxTactTime = 10*100;
66  config.waitForResourcePlus = 2;
67 
68  sections.reset();
69 }
70 
71 
72 
73 void AI :: setup (void)
74 {
75  unitsWorkedInTactics.clear();
76 
77  displaymessage2("calculating all threats ... ");
78  calculateAllThreats ();
79 
80  displaymessage2("calculating field threats ... ");
81  calculateFieldInformation();
82 
83  displaymessage2("calculating sections ... ");
84  sections.calculate();
85 
86 /*
87  for ( i = 0; i <= 8; i++) {
88  Building* building = actmap->player[i].firstbuilding;
89  while (building != NULL) {
90  generatethreatvaluebuilding(building);
91  building = building->next;
92  }
93  if (i == actmap->actplayer) {
94  building = actmap->player[i].firstbuilding;
95  while (building != NULL) {
96  tcmpcheckreconquerbuilding ccrcb;
97  ccrcb.init(3);
98  ccrcb.initsuche(building->xpos,building->ypos,(maxfusstruppenmove + maxtransportmove) / 8 + 1,0);
99  ccrcb.startsuche();
100  int j;
101  ccrcb.returnresult( &j );
102  ccrcb.done();
103  building = building->next;
104  }
105  }
106  }
107  */
108 
109  /*
110  punits units = new tunits;
111  tjugdesituationspfd jugdesituationspfd;
112  jugdesituationspfd.init(units,1);
113  jugdesituationspfd.startsuche();
114  jugdesituationspfd.done();
115  delete units;
116  */
117 
118  for ( int p = 0; p < 8; p++ )
120 
121 
122  for ( Player::VehicleList::iterator i = getPlayer().vehicleList.begin(); i != getPlayer().vehicleList.end(); ++i)
123  if ( (*i)->typ->hasFunction( ContainerBaseType::MoveWithReactionFire ) )
124  if ( (*i)->reactionfire.getStatus() == Vehicle::ReactionFire::off )
125  (*i)->reactionfire.enable();
126 
127 /*
128  // this is a cheat to speed up movement and improve Ai behaviour
129  // setting all fields to FogOfWar
130  for ( int y = 0; y < getMap()->ysize; ++y )
131  for ( int x = 0; x < getMap()->xsize; ++x ) {
132  tfield* fld = getMap()->getField(x,y);
133  if ( fieldVisibility(fld) == visible_not )
134  fld->setVisibility( visible_ago, getPlayerNum( ));
135  }
136  */
137 
138 
139 
140  // showthreats("init: threatvals generated");
141  displaymessage2("setup completed ... ");
142 }
143 
144 
145 void AI::checkKeys ( void )
146 {
147  ASC_PG_App* app = &getPGApplication();
148  if ( app )
149  for ( int i = 0; i < 5; ++i )
150  app->processEvent();
151 }
152 
153 void AI::removeDisplay()
154 {
155  mapDisplay = NULL;
156 }
157 
158 
159 typedef Loki::Functor<void> CloseScreenCallback;
160 
161 
162 class AI_KeyboardWatcher : public sigc::trackable {
163  CloseScreenCallback callback;
165  PG_Widget* w;
167 
168  bool keyPressed( const PG_MessageObject* object , const SDL_KeyboardEvent* key )
169  {
170  if ( key->keysym.sym == SDLK_ESCAPE ) {
171  callback();
172 
173  if ( !lock )
174  lock = new MapDisplayPG::LockDisplay;
175 
176  return true;
177  } else
178  return false;
179  }
180 
181  public:
182  AI_KeyboardWatcher( CloseScreenCallback callback ) : lock(NULL), w(NULL), menuLocker( mainScreenWidget, MainScreenWidget::LockOptions::Menu + MainScreenWidget::LockOptions::MapActions + MainScreenWidget::LockOptions::MapControl)
183  {
184 
185  // w = new PG_Widget(NULL);
186  // w->SetCapture();
187  this->callback = callback;
188  // w->sigKeyDown.connect( sigc::mem_fun( *this, &AI_KeyboardWatcher::keyPressed ));
189  if ( PG_Application::GetApp() )
190  PG_Application::GetApp()->sigKeyDown.connect( sigc::mem_fun( *this, &AI_KeyboardWatcher::keyPressed ));
191 
192  };
193 
194  void release()
195  {
196  delete w;
197  w = NULL;
198  delete lock;
199  lock = NULL;
200  }
201 
203  {
204  release();
205  }
206 };
207 
208 void AI :: checkGameEvents()
209 {
210  while ( getMap()->player[ getMap()->actplayer ].queuedEvents ) {
211  if ( !checkevents( getMap(), mapDisplay ))
212  return ;
213 
214  for ( Player::VehicleList::iterator vi = getPlayer().vehicleList.begin(); vi != getPlayer().vehicleList.end(); vi++ ) {
215  Vehicle* veh = *vi;
216  if ( !veh->aiparam[ getPlayerNum() ] )
217  calculateThreat ( veh );
218  }
219 
220  }
221 
222  checktimedevents( getMap(), mapDisplay );
223 }
224 
226  MapDisplayInterface* mdi;
227  public:
229  this->mdi = mdi;
230  if ( mdi )
231  mdi->setTempView( false );
232  }
233 
235  if ( mdi )
236  mdi->setTempView( true );
237  }
238 };
239 
240 void AI:: run ( bool benchMark, MapDisplayInterface* myMapDisplay )
241 {
242  AI_KeyboardWatcher kw ( CloseScreenCallback( this, &AI::removeDisplay ));
243 
244  this->benchMark = benchMark;
245 
246  auto_ptr<ReplayMapDisplay> rmd;
247  if ( getMap()->getPlayerView() >= 0 && !benchMark && myMapDisplay ) {
248  rmd.reset( new ReplayMapDisplay ( myMapDisplay ) );
249  rmd->setCursorDelay (CGameOptions::Instance()->replayspeed + 30 );
250 
251  mapDisplay = rmd.get();
252  } else
253  mapDisplay = NULL;
254 
255  int startTime = ticker;
256  AiResult res;
257 
258  unitCounter = 0;
259  isRunning(true);
261 
262  int setupTime = ticker;
263 
264  FieldMarkingSuppressor fms( mapDisplay );
265 
266  setup();
267 
268 // GameMap::Weather weatherBackup = getMap()->weather;
269 // for ( int i = 0; i < 3; i++ )
270 // getMap()->weather.wind[i].speed = 0;
271 
272  diplomacy();
273 
274  if ( !originalUnitDistribution.calculated )
275  originalUnitDistribution = calcUnitDistribution();
276 
277  calcReconPositions();
278 
279  setupTime = ticker-setupTime;
280 
281  int serviceTime = ticker;
282  issueServices( );
283  executeServices();
284 
285  checkGameEvents();
286 
287  serviceTime = ticker-serviceTime;
288 
289  int conquerTime = ticker;
290  checkConquer();
291  conquerTime = ticker - conquerTime;
292 
293  runReconUnits ( );
294 
295  int containerTime = ticker;
296  buildings( 3 );
297  transports ( 3 );
298  containerTime = ticker-containerTime;
299 
300  int tacticsTime = ticker;
301  do {
302  res = tactics();
303  checkGameEvents();
304  } while ( res.unitsMoved );
305  tacticsTime = ticker - tacticsTime;
306 
307  int strategyTime = ticker;
308  strategy();
309  checkGameEvents();
310 
311  strategyTime = ticker - strategyTime;
312 
313  buildings( 1 );
314  transports ( 3 );
315 
316  production();
317 
318  checkGameEvents();
319 
320  isRunning(false);
321  if ( !mapDisplay )
322  repaintMap();
323  int duration = ticker-startTime;
324 
325 /*
326  if ( getMap()->replayinfo )
327  getMap()->replayinfo->closeLogging();
328 */
329 
330 // getMap()->weather = weatherBackup;
331 
332  if ( benchMark ) // (CGameOptions::Instance()->runAI == 2 && duration > 100*60) ||
333  displaymessage ("The AI took %.2f seconds to run\n"
334  " setup: %d \n"
335  " service: %d \n"
336  " conquer: %d \n"
337  " container: %d \n"
338  " tactics: %d \n"
339  " strategy: %d \n",
340  3, float(duration)/100,
341  setupTime / 100,
342  serviceTime/100,
343  conquerTime /100,
344  containerTime/100,
345  tacticsTime/100,
346  strategyTime/100 );
347 
348  displaymessage2("AI completed in %d second", duration/100);
349 
350  checkforvictory( getMap(), false );
351 
352  mapDisplay = NULL;
353 
354 }
355 
356 
357 void AI :: diplomacy ()
358 {
359  for ( int i = 0; i < getMap()->getPlayerCount(); ++i ) {
360  if ( i != getPlayerNum() ) {
361  DiplomaticStates proposal;
362  if ( getPlayer().diplomacy.getProposal( i, &proposal )) {
363  // the AI will not accept peace
364  if ( proposal > getPlayer().diplomacy.getState( i ))
365  new Message( "Your diplomatic proposal is declined", getMap(), 1 << i, 1 << getPlayerNum() );
366  else {
367  auto_ptr<DiplomacyCommand> dc ( new DiplomacyCommand( getPlayer()));
368  dc->newstate( proposal, getMap()->getPlayer(i) );
369  ActionResult res = dc->execute( getContext() );
370  if ( res.successful() )
371  dc.release();
372  }
373  }
374  }
375  }
376 }
377 
378 void AI :: showFieldInformation ( int x, int y )
379 {
380  if ( !fieldInformation )
381  calculateFieldInformation();
382 
383  const char* fieldinfo = "#font02#Field Information (%d,%d)#font01##aeinzug20##eeinzug10##crtp10#"
384  "threat orbit: %d\n"
385  "threat high-level flight: %d\n"
386  "threat flight: %d\n"
387  "threat low-level flight: %d\n"
388  "threat ground level: %d\n"
389  "threat floating: %d\n"
390  "threat submerged: %d\n"
391  "threat deep submerged: %d\n"
392  "controlled by %d\n";
393 
394  char text[10000];
395  AiThreat& threat = getFieldThreat ( x, y );
396  sprintf(text, fieldinfo, x,y,threat.threat[7], threat.threat[6], threat.threat[5],
397  threat.threat[4], threat.threat[3], threat.threat[2],
398  threat.threat[1], threat.threat[0], getFieldInformation(x,y).control );
399 
400  MapField* fld = getMap()->getField (x, y );
401  if ( fld->vehicle && fieldvisiblenow ( fld ) && fld->vehicle->aiparam[getPlayerNum()] ) {
402  char text2[1000];
403  sprintf(text2, "\nunit nwid: %d ; typeid: %d", fld->vehicle->networkid, fld->vehicle->typ->id );
404  strcat ( text, text2 );
405  AiParameter& aip = *fld->vehicle->aiparam[getPlayerNum()];
406 
407  if ( fld->vehicle->aiparam ) {
408 
409  sprintf(text2, "\nunit value: %d; xtogo: %d, ytogo: %d; ztogo: %d;\njob %s ; task %s \n", aip.getValue(), aip.dest.x, aip.dest.y, aip.dest.getBitmappedHeight(), AIjobs[aip.getJob()], AItasks[aip.getTask()] );
410  strcat ( text, text2 );
411  }
412 
413  if ( aip.dest.x >= 0 && aip.dest.y >= 0 ) {
414  getMap()->cleartemps ( 1 );
415  getMap()->getField ( aip.dest.x, aip.dest.y )->setaTemp(1);
416  }
417 
418 
419  }
420 
421  for ( ReconPositions::iterator i = reconPositions.begin(); i != reconPositions.end(); i++ )
422  getMap()->getField( i->first )->setaTemp2(1);
423 
424  repaintMap();
425 
426 
427  strcat ( text, "\n#font02#Section Information#font01##aeinzug20##eeinzug10##crtp10#");
428  string s;
429 
430  Section& sec = sections.getForCoordinate ( x, y );
431 
432  s += "xp = ";
433  s += strrr ( sec.xp );
434  s += " ; yp = ";
435  s += strrr ( sec.yp );
436  s += "\n";
437  const char* threattypes[4] = { "absUnitThreat", "avgUnitThreat", "absFieldThreat", "avgFieldThreat" };
438 
439  for ( int i = 0; i < 4; i++ ) {
440  for ( int h = 0; h < 8; h++ ) {
441  s += threattypes[i];
442  s += " ";
443  s += choehenstufen [h];
444  s += " ";
445  switch ( i ) {
446  case 0: s += strrr ( sec.absUnitThreat.threat[h] );
447  break;
448  case 1: s += strrr ( sec.avgUnitThreat.threat[h] );
449  break;
450  case 2: s += strrr ( sec.absFieldThreat.threat[h] );
451  break;
452  case 3: s += strrr ( sec.avgFieldThreat.threat[h] );
453  break;
454  }
455  s += "\n";
456  }
457  s += "\n";
458  }
459 
460  for ( int j = 0; j < aiValueTypeNum; j++ ) {
461  s+= "\nvalue ";
462  s+= strrr ( j );
463  s+= " = ";
464  s+= strrr ( sec.value[j] );
465  }
466 
467  strcat ( text, s.c_str() );
468 
469  ViewFormattedText vft( "AI information", text, PG_Rect( -1, -1, 500, 550 ) );
470  vft.Show();
471  vft.RunModal();
472 }
473 
474 
475 const int currentAiStreamVersion = 104;
476 
477 void AI :: read ( tnstream& stream )
478 {
479  int version = stream.readInt ( );
480  if ( version > currentServiceOrderVersion )
481  throw tinvalidversion ( "AI :: read", currentServiceOrderVersion, version );
482  isRunning(stream.readInt ());
483  setVision(VisibilityStates(stream.readInt ( )));
484  unitCounter = stream.readInt ( );
485 
486  int i = stream.readInt();
487  while ( i ) {
488  ServiceOrder so ( this, stream );
489  serviceOrders.push_back ( so );
490  i = stream.readInt();
491  }
492 
493  for_each ( serviceOrders.begin(), serviceOrders.end(), ServiceOrder::activate );
494 
495  i = stream.readInt();
496  while ( i ) {
497  MapCoordinate mc;
498  mc.read ( stream );
499 
500  AI::BuildingCapture bc;
501  bc.read ( stream );
502 
503  buildingCapture[mc] = bc;
504 
505  i = stream.readInt();
506  }
507 
508  config.lookIntoTransports = stream.readInt();
509  config.lookIntoBuildings = stream.readInt( );
510  config.wholeMapVisible = stream.readInt( );
511  config.aggressiveness = stream.readFloat( );
512  config.damageLimit = stream.readInt();
513  config.resourceLimit.read( stream );
514  config.ammoLimit = stream.readInt();
515  config.maxCaptureTime = stream.readInt();
516  if ( version >= 102 )
517  config.waitForResourcePlus = stream.readInt();
518 
519  if ( version >= 101 )
520  config.maxTactTime = stream.readInt();
521 
522  if ( version >= 102 )
523  originalUnitDistribution.read ( stream );
524 
525  if ( version >= 103 ) {
526  int id = stream.readInt();
527  while ( id >= 0 ) {
528  float enemyValue = stream.readFloat();
529  float ownValue = stream.readFloat();
530  unitTypeSuccess[id] = make_pair ( enemyValue, ownValue );
531  id = stream.readInt();
532  }
533  }
534 
535  if ( version >= 104 ) {
536  int id = stream.readInt();
537  while ( id >= 0 ) {
538  stream.readFloat(); // enemyValue
539  stream.readFloat(); // ownValue
540  id = stream.readInt();
541  }
542  }
543 
544  int version2 = stream.readInt();
545  if ( version != version2 )
546  throw tinvalidversion ( "AI :: read", version, version2 );
547 
548 
549 }
550 
551 void AI :: write ( tnstream& stream ) const
552 {
553  const int version = currentAiStreamVersion;
554  stream.writeInt ( version );
555  stream.writeInt ( isRunning() );
556  stream.writeInt ( getVision() );
557  stream.writeInt ( unitCounter );
558 
559  for ( ServiceOrderContainer::const_iterator i = serviceOrders.begin(); i != serviceOrders.end(); i++) {
560  stream.writeInt ( 1 );
561  i->write ( stream );
562  }
563 
564  stream.writeInt ( 0 );
565 
566  for ( map<MapCoordinate,BuildingCapture>::const_iterator i = buildingCapture.begin(); i != buildingCapture.end(); i++ ) {
567  stream.writeInt ( 1 );
568  i->first.write ( stream );
569  i->second.write ( stream );
570  }
571  stream.writeInt ( 0 );
572 
573  stream.writeInt( config.lookIntoTransports ); /* gegnerische transporter einsehen */
574  stream.writeInt( config.lookIntoBuildings );
575  stream.writeInt( config.wholeMapVisible );
576  stream.writeFloat( config.aggressiveness ); // 1: units are equally worth ; 2
577  stream.writeInt( config.damageLimit );
578  config.resourceLimit.write( stream );
579  stream.writeInt( config.ammoLimit );
580  stream.writeInt( config.maxCaptureTime );
581  stream.writeInt( config.maxTactTime );
582  stream.writeInt( config.waitForResourcePlus );
583 
584  originalUnitDistribution.write( stream );
585 
586  for ( UnitTypeSuccess::const_iterator i = unitTypeSuccess.begin(); i != unitTypeSuccess.end(); ++i ) {
587  stream.writeInt( i->first );
588  stream.writeFloat( i->second.first );
589  stream.writeFloat( i->second.second );
590  }
591  stream.writeInt( -1 );
592  stream.writeInt( -1 );
593 
594  stream.writeInt ( version );
595 }
596 
598 {
599  Context context;
600 
601  context.gamemap = getMap();
602  context.actingPlayer = &getPlayer();
603  context.parentAction = NULL;
604  context.display = mapDisplay;
605  context.viewingPlayer = getMap()->getPlayerView();
606  context.actionContainer = &getMap()->actions;
607  return context;
608 }
609 
611 {
612  if ( fieldInformation ) {
613  delete[] fieldInformation;
614  fieldInformation = NULL;
615  fieldNum = 0;
616  }
617 }
618 
619 
DiplomaticStates getState(PlayerID towardsPlayer) const
Definition: player.cpp:92
Player * actingPlayer
Definition: context.h:37
void setaTemp(Uint8 atemp)
Various algorithms need to store some information in the fields they process.
Definition: mapfield.cpp:49
void cleartemps(int b=-1, int value=0)
Definition: gamemap.cpp:964
virtual void writeInt(int i)
Writes a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is p...
Definition: basestrm.cpp:363
void release()
Definition: base.cpp:194
const char * AItasks[AiParameter::taskNum]
DiplomaticStates
Definition: player.h:53
GameMap * getMap(void)
returns the map this AI runson
Definition: ai.h:486
const int currentAiStreamVersion
Definition: base.cpp:475
Vehicle * vehicle
Definition: mapfield.h:89
const char * AIjobs[AiParameter::jobNum]
AiParameter * aiparam[8]
Definition: vehicle.h:182
Instanciating this class will disable the Controls for interacting with the map or the main menu...
void run(MapDisplayInterface *mapDisplay)
Definition: ai.h:481
virtual int readInt(void)
Reads a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is pe...
Definition: basestrm.cpp:284
DiplomaticStateVector diplomacy
Definition: player.h:209
VisibilityStates
the different states that a player's view on a field can have
Definition: typen.h:403
void processEvent()
Definition: paradialog.cpp:436
void read(tnstream &stream)
Definition: typen.h:213
sigc::signal< void > repaintMap
}@
Definition: spfst.cpp:45
The interface for all kinds of IO stream.
a single field of the map
Definition: mapfield.h:26
int threat[aiValueTypeNum]
AI_KeyboardWatcher(CloseScreenCallback callback)
Definition: base.cpp:182
~AI()
Definition: base.cpp:610
void checktimedevents(GameMap *gamemap, MapDisplayInterface *md)
bool checkevents(GameMap *gamemap, MapDisplayInterface *md)
AI(GameMap *_map, int _player)
Definition: base.cpp:28
const int aiValueTypeNum
how many different target types are there?
FieldMarkingSuppressor(MapDisplayInterface *mdi)
Definition: base.cpp:228
int getPlayerView() const
the player which is currently viewing the map.
Definition: gamemap.cpp:1007
virtual float readFloat(void)
Reads a flaot variable.
Definition: basestrm.cpp:328
int getPlayerNum(void)
returns the number of the player which is controlled by this ai
Definition: ai.h:490
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
Definition: spfst.cpp:399
ASC_PG_App & getPGApplication()
Definition: paradialog.cpp:294
VehicleList vehicleList
a list of all units
Definition: player.h:135
char * strrr(int a)
converts a to a string.
Definition: misc.cpp:66
void setVision(VisibilityStates v)
Definition: ai.h:508
friend class Section
Definition: ai.h:448
Coordinate on the twodimensional map.
Definition: typen.h:202
the threat that a unit poses against other units.
Player & getPlayer(void)
Definition: ai.h:492
GameAction * parentAction
Definition: context.h:38
friend class ServiceOrder
Definition: ai.h:118
void displaymessage(const char *formatstring, int num,...)
displays a dialog box with a message
Definition: dlg_box.cpp:1849
virtual void setTempView(bool view)=0
int getValue()
int viewingPlayer
Definition: context.h:40
bool successful() const
MapDisplayInterface * display
Definition: context.h:39
Player player[9]
Definition: gamemap.h:253
static CGameOptions * Instance()
returns the only Instance
Definition: gameoptions.cpp:38
GameMap * gamemap
Definition: context.h:36
All parameters the AI stores persistently about a unit.
ActionContainer * actionContainer
Definition: context.h:41
VisibilityStates getVision(void)
the AI uses a different vision than human player, to counter the fact that a human player can "know" ...
Definition: ai.h:506
const int currentServiceOrderVersion
Definition: service.cpp:59
const char * choehenstufen[choehenstufennum]
The different levels of height.
Definition: typen.cpp:39
A Message to a player. It may either be send by another player or by the system.
Definition: messages.h:30
void displaymessage2(const char *formatstring,...)
displays a message in the status line of ASC
void checkforvictory(GameMap *gamemap, bool hasTurnControl)
checks if the current player has terminated another player or even won
int getBitmappedHeight() const
Definition: typen.h:241
const VehicleType * typ
Definition: vehicle.h:83
ActionContainer actions
Records all action that have been done for undo/redo purposes.
Definition: gamemap.h:390
bool isRunning(void)
Definition: ai.h:497
virtual void writeFloat(float f)
Write a floating point variable.
Definition: basestrm.cpp:385
ASC_MainScreenWidget * mainScreenWidget
bool existanceAtBeginOfTurn
did the player exist when the turn started? Required for checking if a player has been terminated ...
Definition: player.h:131
void read(tnstream &stream)
Definition: base.cpp:477
Loki::Functor< void > CloseScreenCallback
Definition: base.cpp:159
void setaTemp2(Uint8 atemp2)
Definition: mapfield.cpp:56
Resources are basically the currency of ASC.
Definition: typen.h:97
MapCoordinate3D dest
friend class LockDisplay
Definition: mapdisplay.h:355
bool getProposal(int fromPlayer, DiplomaticStates *state)
Definition: player.cpp:127
int getPlayerCount() const
Definition: gamemap.h:255
int networkid
a unique identification of the unit that is used everywhere in ASC (and not only the network protocol...
Definition: vehicle.h:140
void write(tnstream &stream) const
Definition: base.cpp:551
Context getContext()
Definition: base.cpp:597
bool exist() const
does the player exist at all
Definition: player.cpp:313
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
volatile int ticker
Definition: events.cpp:234
MapField * getField(int x, int y)
Definition: gamemap.h:465
void showFieldInformation(int x, int y)
Definition: base.cpp:378