Advanced Strategic Command
prehistoricevents.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 
27 #include <cstring>
28 
29 #include "global.h"
30 #include "prehistoricevents.h"
31 #include "gameeventsystem.h"
32 #include "gameevents.h"
33 #include "dialog.h"
34 #include "buildings.h"
35 #include "gamemap.h"
36 
37 // .l .l ! .l ! !
39 // .l ! ! .l ! .l
41 // ! ! ! .l .l
43 // .l .l .l .l .l
45 
46 
47 extern const char* ceventtrigger[];
48 // .l .l .l .l .l
50 // ! . .l .l
52 // . .l .
54 // .l
56 // .l .l .l
58 
59 
60  /* Datenaufbau des triggerData fieldes: [ hi 16 Bit ] [ low 16 Bit ] [ 32 bit Integer ] [ Pointer ] [ low 24 Bit ] [ high 8 Bit ]
61  'turn/move', move turn
62  'building/unit ',Kartened/Spiel Building/Vehicle
63  disk ypos xpos
64  'technology researched', Tech. ID
65  'event', Event ID
66  'tribut required' Hoehe des Tributes Spieler, von dem Tribut gefordert wird
67  'all enemy *.*' Bit 0: alle nicht allierten
68  Bit 1: alle, die ?ber die folgenden Bits festgelegt werden, ob alliiert oder nicht
69  Bit 2 : Spieler 0
70  ...
71  Bit 9 : Spieler 7
72 
73  'unit enters polygon' pointer auf teventtrigger_polygonentered
74 
75  der Rest benoetigt keine weiteren Angaben
76  */
77 
78 
79 
80  /* DatenAufbau des Event-Data-Blocks:
81 
82  TLosecampaign, TEndCampaign, TWeatherchangeCompleted
83  benoetigen keine weiteren Daten
84 
85 
86  TNewTechnologyEvent :
87  data = NULL;
88  SaveAs = TechnologyID;
89  Gilt fuer researched wie auch available
90 
91  TMessageEvent
92  Data = NULL;
93  SaveAs: MessageID des Abschnittes in TextDatei
94 
95  TNextMapEvent:
96  Data = NULL;
97  saveas: ID der nchsten Karte;
98 
99  TRunScript+NextMapEvent:
100  Data = pointer auf Dateinamen des Scriptes ( *.scr );
101  saveas: ID der nchsten Karte;
102 
103  TeraseEvent:
104  data[0] = ^int
105  ID des zu loeschenden Events
106  data[1] = mapid
107 
108  Tweatherchange ( je ein int , alles unter Data )
109  wetter ( -> cwettertypen , Wind ist eigene eventaction )
110  fieldadressierung ( 1: gesamtes map )
111  ( 0: polygone )
112 
113  ��� 0 �� polygonanzahl
114  �� eckenanzahl
115  ��x position
116  y position
117 
118 
119  ��� 1 ��
120 
121 + Twindchange
122  intensitt[3] ( fuer tieffliegend, normalfliegend und hochfliegend ; -1 steht fuer keine Aenderung )
123  Richtung[3] ( dito )
124 
125 
126  Tmapchange ( je ein int , alles unter Data ) { wetter wird beibehalten ! }
127  numberoffields ( nicht die Anzahl fielder insgesamt,
128  �� bodentypid
129  drehrichtung
130  fieldadressierung ( wie bei tweatherchange )
131 
132 
133  Treinforcements ( alles unter DATA )
134  int num // ein int , der die Anzahl der vehicle angibt. Die vehicle, die ein Transporter geladen hat, werden NICHT mitgezhlt.
135  ���> die vehicle, mit tspfldloaders::writeunit in einen memory-stream geschrieben.
136 
137 
138  TnewVehicleDeveloped
139  saveas = ID des nun zur Verf?gung stehenden vehicletypes
140 
141 
142  Tpalettechange
143  Data = Pointer auf String, der den Dateinamen der Palettendatei enthlt.
144 
145  Talliancechange
146  Data : Array[8][8] of int // status der Allianzen. Sollte vorerst symetrisch bleiben, also nur jeweils 7 Werte abfragen.
147  Vorerst einfach Zahlwerte eingeben.
148  256 steht fuer unverndert,
149  257 fuer umkehrung
150 
151 + TGameParameterchange
152  int nummer_des_parameters ( -> gameparametername[] )
153  int neuer_wert_des_parameters
154 
155  Ellipse
156  int x1 , y1, x2, y2, x orientation , y orientation
157 
158 
159  Wenn Data != NULL ist, MUss datasize die Groesse des Speicherbereichs, auf den Data zeigt, beinhalten.
160 
161  */
162 
163 #pragma pack(1)
164 
165  typedef class tevent* pevent ;
166 
168  public:
169  union {
170  struct { Uint16 saveas; Uint8 action, num; }a; /* CEventActions */
171  int id; /* Id-Nr ==> Technology.Requireevent; Tevent.trigger; etc. */
172  } ;
173 
174  Uint8 player; // 0..7 fuer die normalen Spieler
175  // 8 wenn das Event unabh"ngig vom Spieler sofort auftreten soll
176 
177  char description[20];
178 
179  union {
180  void* rawdata;
181  char* chardata;
182  int* intdata;
183  };
184 
185  int datasize;
187  int conn; // wird nur im Spiel gebraucht, BIt 0 gibt an, das andere events abh"nging sind von diesem
188  Uint16 trigger[4]; /* CEventReason */
189 
191  public:
192 
194  public:
195  int dataSize;
196  int dummy;
198  int* data;
199  int tempnwid;
200  int tempxpos;
201  int tempypos;
202  int color; // bitmapped
203  int reserved[7];
204  PolygonEntered ( void );
205  PolygonEntered ( const PolygonEntered& poly );
206  ~PolygonEntered ( );
207  };
208 
210  int xpos, ypos;
213  int dummy;
214  int mapid;
215  int id;
217  int reserved[32];
218  LargeTriggerData ( void );
219  LargeTriggerData ( const LargeTriggerData& data );
221  };
222 
224 
225  Uint8 triggerconnect[4]; /* CEventTriggerConn */
226  Uint8 triggerstatus[4]; /* Nur im Spiel: 0: noch nicht erf?llt
227  1: erf?llt, kann sich aber noch "ndern
228  2: unwiederruflich erf?llt
229  3: unerf?llbar */
230  GameTime triggertime; // Im Karteneditor auf -1 setzen !!
231  // Werte ungleich -1 bedeuten automatisch, dass das event bereits erf?llt ist und evt. nur noch die Zeit abzuwait ist
232 
233  struct {
234  int turn;
235  int move; // negative Zahlen SIND hier zul"ssig !!!
237 
238  /* Funktionsweise der verzoegerten Events:
239  Sobald die Trigger erf?llt sind, wird triggertime[0] ausgef?llt. Dadurch wird das event ausgeloest,
240  sobald das Spiel diese Zeit erreicht ist, unabh"ngig vom Zustand des mapes
241  ( Trigger werden nicht erneut ausgewertet !)
242  */
245 
246  /*EventAction* eventAction;
247  int eventActionType;*/
248 
249  };
250 
251 #pragma pack()
252 
253 
254 extern const char* cconnections[6];
255  #define cconnection_destroy 1
256  #define cconnection_conquer 2
257  #define cconnection_lose 4
258  #define cconnection_seen 8
259  #define cconnection_areaentered_anyunit 16
260  #define cconnection_areaentered_specificunit 32
261  // conquered = You conquered sth.
262  // lost = an enemy conquered sth. from you
263 
264 
265 const int ceventtriggernum = 21;
266 extern const char* ceventtriggerconn[];
267  #define ceventtrigger_and 1
268  #define ceventtrigger_or 2
269  #define ceventtrigger_not 4
270  #define ceventtrigger_klammerauf 8
271  #define ceventtrigger_2klammerauf 16
272  #define ceventtrigger_2klammerzu 32
273  #define ceventtrigger_klammerzu 64
274  /* reihenfolgenprioritt: in der Reihenfolge von oben nach unten wird der TriggerCon ausgewertet
275  AND OR
276  NOT
277  (
278  eigentliches event
279  )
280  */
281 
282 
283 #define ceventactionnum 22
284 extern const char* ceventactions[ceventactionnum]; // not bitmapped
285 
286 
287 
288 
290 const char* cconnections[6] = {"destroyed", "conquered", "lost", "seen", "area entererd by any unit", "area entered by specific unit"};
291 
292 const char* ceventtriggerconn[8] = {"AND ", "OR ", "NOT ", "( ", "(( ", ")) ", ") ", "Clear "};
293 
295 const char* ceventactions[ceventactionnum] = {"message", "weather change", "new technology discovered", "lose campaign", "run script + next map",
296  "new technology researchable", "map change", "discarded [ was erase event ]", "end campaign", "next map",
297  "reinforcement","weather change completed", "new vehicle developed","palette change",
298  "alliance change","wind change", "nothing", "change game parameter","paint ellipse","remove ellipse",
299  "change building damage", "add object"};
300 
301 const char* ceventtrigger[ceventtriggernum] = {"*NONE*", "turn/move >=", "building conquered", "building lost",
302  "building destroyed", "unit lost", "technology researched",
303  "event", "unit conquered", "unit destroyed", "all enemy units destroyed",
304  "all units lost", "all enemy buildings destroyed/captured", "all buildings lost",
305  "energy tribute <", "material tribute <", "fuel tribute <",
306  "any unit enters polygon", "specific unit enters polygon", "building is seen", "irrelevant (used internally)"};
307 
308 Event* readOldEvent( tnstream* stream, GameMap* gamemap, map<int,int>& eventTranslation, map<EventTriggered*,int>& eventTriggerEvents );
309 
310 
311 void readOldEventLists ( tnstream* stream, bool passedEvents, GameMap* spfld )
312 {
313  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
314 
315  if ( sizeof(int*) != 4 ) {
316  displaymessage ("Unable to load map " + stream->getLocation() + " in old file format on a non-32 bit machine\nPlease convert this file to the new file format on a 32 bit little endian machine and try again",1);
317  throw tfileerror();
318  }
319 
320  map<int,int> eventTranslation;
321  map<EventTriggered*,int> eventTriggerEvents;
322 
323  int j = stream->readInt();
324  if ( j )
325  for (int k = 1; k <= j; k++) {
326  Event* ev = readOldEvent ( stream, spfld, eventTranslation, eventTriggerEvents );
327  if ( ev )
328  spfld->events.push_back ( ev );
329  }
330 
331  if ( passedEvents ) {
332  int j = stream->readInt();
333  if ( j )
334  for (int k = 1; k <= j; k++) {
335  Event* ev = readOldEvent ( stream, spfld, eventTranslation, eventTriggerEvents );
336  if ( ev ) {
337  ev->status = Event::Executed;
338  spfld->events.push_back ( ev );
339  }
340  }
341  }
342 
343  for ( map<EventTriggered*,int>::iterator i = eventTriggerEvents.begin(); i != eventTriggerEvents.end(); ++i ) {
344  map<int,int>::iterator e = eventTranslation.find ( i->second );
345  if ( e == eventTranslation.end() ) {
346  displaymessage ("Could not find oldEvent-ID for setting the event Trigger",1);
347  return;
348  }
349 
350  i->first->setEventID ( e->second );
351  }
352  #else
353  displaymessage ("Unable to load map " + stream->getLocation() + " in old file format on a big endian machine\nPlease convert this file to the new file format on a little endian machine and try again",1);
354  throw tfileerror();
355  #endif
356 }
357 
358 
360 {
361  dataSize = 0;
362  vehiclenetworkid = 0;
363  data = NULL;
364  tempnwid = 0;
365  tempxpos = 0;
366  tempypos = 0;
367  color = 0;
368  memset ( reserved, 0, sizeof ( reserved ));
369 }
370 
372 {
373  dataSize = poly.dataSize;
374  vehiclenetworkid = poly.vehiclenetworkid;
375  if ( poly.data ) {
376  data = new int [dataSize];
377  for ( int i = 0; i < dataSize; i++ )
378  data[i] = poly.data[i];
379  } else
380  data = NULL;
381  tempnwid = poly.tempnwid;
382  tempxpos = poly.tempxpos;
383  tempypos = poly.tempypos;
384  color = poly.color;
385  memcpy ( reserved, poly.reserved, sizeof ( reserved ));
386 }
387 
389 {
390  if ( data ) {
391  delete[] data;
392  data = NULL;
393  }
394 }
395 
396 
398 {
399  time.abstime = 0;
400  xpos = -1;
401  ypos = -1;
402  building = NULL;
403  mapid = 0;
404  id = -1;
405  unitpolygon = NULL;
406  networkid = 0;
407  memset ( reserved, 0, sizeof ( reserved ));
408 }
409 
411 {
412  time = data.time;
413  xpos = data.xpos;
414  ypos = data.ypos;
415  networkid = data.networkid;
416  building = data.building;
417  mapid = data.mapid;
418  id = data.id;
419  if ( data.unitpolygon ) {
421  } else
422  unitpolygon = NULL;
423 }
424 
426 {
427  if ( unitpolygon ) {
428  delete unitpolygon;
429  unitpolygon = NULL;
430  }
431 }
432 
434 {
435  a.action= 255;
436  a.saveas = 0;
437  a.num = 0;
438  player = 0;
439  rawdata = NULL;
440  next = NULL;
441  datasize = 0;
442  conn = 0;
443  for ( int i = 0; i < 4; i++) {
444  trigger[i] = 0;
445  triggerstatus[i] = 0;
446  triggerconnect[i] = 0;
447  triggertime.set( -1, -1 );
449  }
450  delayedexecution.turn = 0;
451  delayedexecution.move = 0;
452  description[0] = 0;
453  triggertime.abstime = -1;
454 }
455 
456 
457 
459 {
460  for ( int i = 0; i < 4; i++ )
461  if ( trigger_data[i] ) {
462  delete trigger_data[i];
463  trigger_data[i] = NULL;
464  }
465 
466  if ( rawdata ) {
467  free( rawdata );
468  rawdata = NULL;
469  }
470 }
471 
472 
473 
474 
475 
476 
477 Event* readOldEvent( tnstream* stream, GameMap* gamemap, map<int,int>& eventTranslation, map<EventTriggered*,int>& eventTriggerEvents )
478 {
479 
481 // this code works only on little-endian system,
482 // but there is no need to change this, because it is
483 // only used for converting old maps and savegames
485 
486  map<EventTriggered*,int> localEventTriggerEvents;
487 
488  Event* ev = new Event( *gamemap );
489 
491 
492  int magic = stream->readInt();
493  int version;
494  if ( magic == -1 ) {
495  version = stream->readInt();
496  stream->readdata ( &event1, 85 );
497  } else {
498  memcpy ( &event1, &magic, sizeof ( magic ));
499  int* pi = (int*) &event1;
500  pi++;
501  stream->readdata ( pi, 85 - sizeof ( int ));
502  version = 0;
503  }
504 
505  if ( version > 2 )
506  throw tinvalidversion ( "OldEvent", 2, version );
507 
508  if ( event1.datasize && event1.rawdata ) {
509  event1.rawdata = malloc ( event1.datasize );
510  stream->readdata ( event1.rawdata, event1.datasize );
511  } else {
512  event1.datasize = 0;
513  event1.rawdata = NULL;
514  }
515 
516  EventAction* ea = NULL;
517 
518  switch ( event1.a.action ) {
519  case cewindchange: ea = new WindChange ( event1.intdata[0], event1.intdata[3] );
520  break;
521  case cegameparamchange: ea = new ChangeGameParameter( event1.intdata[0], event1.intdata[1] );
522  break;
523  case cemessage: ea = new DisplayMessage ( event1.a.saveas );
524  break;
525  case cenothing: ea = new Action_Nothing();
526  break;
527  case cechangebuildingdamage: ea = new ChangeBuildingDamage( MapCoordinate( event1.intdata[0], event1.intdata[1]), event1.intdata[2] );
528  break;
530  break;
531  case cenextmap: ea = new NextMap( event1.a.saveas );
532  break;
533  case celosecampaign: ea = new LoseMap();
534  break;
535  case ceaddobject: {
536  AddObject* ao = new AddObject( event1.intdata[2] );
537  ao->setField ( MapCoordinate( event1.intdata[0], event1.intdata[1] ));
538  ea = ao;
539  }
540  break;
541  case ceellipse: ea = new DisplayEllipse( event1.intdata[0], event1.intdata[1], event1.intdata[2], event1.intdata[3], event1.intdata[4], event1.intdata[5] );
542  break;
543  case ceremoveellipse: ea = new RemoveEllipse();
544  break;
545  case ceweatherchange: {
546  WeatherChange* wc = new WeatherChange( event1.intdata[0] );
547  if ( event1.intdata[1] == 0 ) {
548  Poly_gon poly;
549  if ( event1.intdata[2] > 1 )
550  displaymessage("Only the first polygon will be used!", 1 );
551 
552  for ( int i = 0; i < event1.intdata[3]; ++i )
553  poly.vertex.push_back ( MapCoordinate( event1.intdata[4+2*i], event1.intdata[5+2*i] ));
554 
555  wc->setPolygon ( poly );
556  } else
557  wc->setGlobal();
558  ea = wc;
559  }
560  break;
561  case cemapchange: {
562  MapChange* mc = new MapChange( event1.intdata[0] );
563  Poly_gon poly;
564  for ( int i = 0; i < event1.intdata[4]; ++i )
565  poly.vertex.push_back ( MapCoordinate( event1.intdata[5+2*i], event1.intdata[6+2*i] ));
566 
567  mc->setPolygon ( poly );
568  ea = mc;
569  }
570  break;
571 
572  default: displaymessage("The event action %s has not been converted and will be missing!", 1, ceventactions[int(event1.a.action)] );
573  };
574 
575  if ( ea ) {
576  ev->action = ea;
577  ea->setMap ( gamemap );
578  }
579 
580  int ANDcounter = 0;
581  int ORcounter = 0;
582  bool missingConnection = false;
583 
584  for (int m = 0; m <= 3; m++) {
585 
586  EventTrigger* et = 0;
587 
589  if ( event1.trigger[m] ) {
590  if ((event1.trigger[m] == ceventt_buildingconquered) ||
591  (event1.trigger[m] == ceventt_buildinglost) ||
592  (event1.trigger[m] == ceventt_buildingdestroyed) ||
593  (event1.trigger[m] == ceventt_building_seen )) {
594 
595  Sint16 xpos, ypos;
596  stream->readdata2 ( xpos );
597  stream->readdata2 ( ypos );
598 
599  event1.trigger_data[m]->xpos = xpos;
600  event1.trigger_data[m]->ypos = ypos;
601 
602  switch ( event1.trigger[m] ) {
603  case ceventt_buildingconquered: et = new BuildingConquered ( MapCoordinate( xpos, ypos ));
604  break;
605  case ceventt_buildinglost: et = new BuildingLost ( MapCoordinate( xpos, ypos ));
606  break;
607  case ceventt_buildingdestroyed: et = new BuildingDestroyed ( MapCoordinate( xpos, ypos ));
608  break;
609  case ceventt_building_seen: et = new BuildingSeen ( MapCoordinate( xpos, ypos ));
610  break;
611  };
612 
613  }
614 
615  if ((event1.trigger[m] == ceventt_unitconquered) ||
616  (event1.trigger[m] == ceventt_unitlost) ||
617  (event1.trigger[m] == ceventt_unitdestroyed)) {
618 
619  if ( version == 0 ) {
620  Sint16 xpos, ypos;
621  stream->readdata2 ( xpos );
622  stream->readdata2 ( ypos );
623  event1.trigger_data[m]->xpos = xpos;
624  event1.trigger_data[m]->ypos = ypos;
625  event1.trigger_data[m]->networkid = -1;
626 
627  displaymessage("The event trigger %s has not been converted and will be missing!", 1, ceventtrigger[event1.trigger[m]] );
628 
629  } else {
630  stream->readdata2( event1.trigger_data[m]->xpos );
631  stream->readdata2( event1.trigger_data[m]->ypos );
632  stream->readdata2( event1.trigger_data[m]->networkid );
633 
634  switch ( event1.trigger[m] ) {
635  case ceventt_unitconquered: et = new UnitConquered ( event1.trigger_data[m]->networkid );
636  break;
637  case ceventt_unitlost: et = new UnitLost ( event1.trigger_data[m]->networkid );
638  break;
639  case ceventt_unitdestroyed: et = new UnitDestroyed ( event1.trigger_data[m]->networkid );
640  break;
641  };
642  }
643  }
644 
645  if ( event1.trigger[m] == ceventt_event ) {
646  stream->readdata2 ( event1.trigger_data[m]->id );
647  EventTriggered* ett = new EventTriggered();
648  et = ett;
649  localEventTriggerEvents[ett] = event1.trigger_data[m]->id;
650  }
651 
652  if ( event1.trigger[m] == ceventt_technologyresearched ) {
653  stream->readdata2 ( event1.trigger_data[m]->id );
654  }
655 
656  if ( version >=2 ) {
657  if ( event1.trigger[m] == ceventt_allenemybuildingsdestroyed ) {
658  stream->readdata2 ( event1.trigger_data[m]->id );
660  }
661 
662  if (event1.trigger[m] == ceventt_allenemyunitsdestroyed ) {
663  stream->readdata2 ( event1.trigger_data[m]->id );
664  et = new AllEnemyUnitsDestroyed;
665  }
666  }
667 
668  if (event1.trigger[m] == ceventt_turn) {
669  stream->readdata2 ( event1.trigger_data[m]->time.abstime );
670  et = new TurnPassed ( event1.trigger_data[m]->time.turn(), event1.trigger_data[m]->time.move() );
671  }
672  if (event1.trigger[m] == ceventt_any_unit_enters_polygon ||
674  stream->readInt(); // i
676  stream->readdata2( *event1.trigger_data[m]->unitpolygon );
677  event1.trigger_data[m]->unitpolygon->data = new int [ event1.trigger_data[m]->unitpolygon->dataSize ];
678  stream->readdata( event1.trigger_data[m]->unitpolygon->data, event1.trigger_data[m]->unitpolygon->dataSize * sizeof(int) );
679  if ( event1.trigger_data[m]->unitpolygon->vehiclenetworkid ) { // || event1.trigger_data[m]->unitpolygon->dummy
680  stream->readdata2( event1.trigger_data[m]->unitpolygon->tempxpos );
681  stream->readdata2( event1.trigger_data[m]->unitpolygon->tempypos );
682  stream->readdata2( event1.trigger_data[m]->unitpolygon->tempnwid );
684  }
685 
686  Poly_gon pg;
687  for( int i = 0; i < event1.trigger_data[m]->unitpolygon->data[1]; ++i )
688  pg.vertex.push_back ( MapCoordinate( event1.trigger_data[m]->unitpolygon->data[2+2*i], event1.trigger_data[m]->unitpolygon->data[3+2*i] ));
689 
690  if ( event1.trigger[m] == ceventt_any_unit_enters_polygon ) {
692  auep->setPolygon ( pg );
693  et = auep;
694  } else {
696  suep->setPolygon ( pg );
697  et = suep;
698  }
699  }
700 
701  if (event1.trigger[m] == ceventt_allbuildingslost )
702  et = new AllBuildingsLost();
703 
704  if (event1.trigger[m] == ceventt_allunitslost )
705  et = new AllUnitsLost();
706 
707  if ( event1.triggerconnect[m] & ceventtrigger_not )
708  if ( et )
709  et->invert = true;
710 
711  if ( event1.triggerconnect[m] & ceventtrigger_and )
712  ++ANDcounter;
713 
714  if ( event1.triggerconnect[m] & ceventtrigger_or )
715  ++ORcounter;
716 
718  missingConnection = true;
719 
720  if ( et ) {
721  ev->trigger.push_back ( et );
722  et->setMap ( gamemap );
723  et->setEvent ( ev );
724  } else
725  displaymessage("The trigger %d (%s) for event %s could not be converted !", 1,m,ceventtrigger[event1.trigger[m]],event1.description );
726 
727  }
728 
729  }
730 
731  if ( ANDcounter & ORcounter )
732  missingConnection = true;
733 
734  if ( missingConnection )
735  displaymessage("The connection of the triggers for event %s could not be completely converted !", 1,event1.description );
736 
737 
738 
739  if ( ev && ev->action ) {
740  if ( ANDcounter > ORcounter )
742  else
744 
745  ev->description = event1.description;
746 
747  eventTranslation[event1.id] = ev->id;
748  eventTriggerEvents.insert( localEventTriggerEvents.begin(), localEventTriggerEvents.end() );
749  return ev;
750  } else {
751  delete ev;
752  return NULL;
753  }
754 }
755 
756 
the time in ASC, measured in turns and moves
Definition: typen.h:178
#define ceventactionnum
vector< Point > vertex
Definition: mappolygons.h:39
const char * ceventtriggerconn[]
PrehistoricEventStructure::LargeTriggerData::PolygonEntered * unitpolygon
#define ceventtrigger_klammerauf
virtual ASCString getLocation()
returns the location of the stream.
Definition: basestrm.cpp:274
Event * readOldEvent(tnstream *stream, GameMap *gamemap, map< int, int > &eventTranslation, map< EventTriggered *, int > &eventTriggerEvents)
void setMap(GameMap *gamemap_)
int abstime
Definition: typen.h:183
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
int turn() const
Definition: typen.h:181
struct PrehistoricEventStructure::@28 delayedexecution
void setMap(GameMap *gamemap_)
ASCString description
Events events
Definition: gamemap.h:291
EventAction * action
Global platform dependant definitions. This file just branches to the platform specific files in thei...
The buildings which a placed on the map.
The interface for all kinds of IO stream.
#define ceventtrigger_2klammerauf
#define ceventtrigger_and
void setEvent(Event *ev)
#define ceventtrigger_or
int move() const
Definition: typen.h:180
char * malloc(int)
const int magic
Definition: stack.cpp:36
#define ceventtrigger_not
Interface to the event handling of ASC.
const int ceventtriggernum
Coordinate on the twodimensional map.
Definition: typen.h:202
The old event system that is still required to load old maps.
void readOldEventLists(tnstream *stream, bool passedEvents, GameMap *spfld)
Definition of THE central asc class: GameMap.
void displaymessage(const char *formatstring, int num,...)
displays a dialog box with a message
Definition: dlg_box.cpp:1849
const float pi
Definition: basegfx.cpp:551
virtual int readdata(void *buf, int size, bool excpt=true)=0
Reads data from the stream.
void setPolygon(const Poly_gon &poly_gon)
const char * ceventactions[ceventactionnum]
All actions that can be performed by events.
LargeTriggerData * trigger_data[4]
class tevent * pevent
Interface for all the dialog boxes used by the game and the mapeditor.
#define ceventtrigger_2klammerzu
enum Event::Status status
#define ceventtrigger_klammerzu
Interface to the event handling of ASC.
struct PrehistoricEventStructure::@24::@29 a
const char * cconnections[6]
The different connections of something, be it unit, building, or field, to an event.
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
void setField(const MapCoordinate &pos)
Trigger trigger
enum Event::TriggerConnection triggerConnection
const char * ceventtrigger[]
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
void set(int turn, int move)
Definition: typen.h:183