Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gameevents.h

Go to the documentation of this file.
00001 
00005 /*
00006     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00007     Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; see the file COPYING. If not, write to the
00021     Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00022     Boston, MA  02111-1307  USA
00023 */
00024 
00025 
00026 #ifndef gameeventsH
00027 #define gameeventsH
00028 
00029 #include "typen.h"
00030 #include "gameeventsystem.h"
00031 #include "mappolygons.h"
00032 
00033 
00034 
00035 // The new event system here is not yet functional
00036 
00037 // namespace GameEvents {
00038 
00039 
00040 enum EventTrigger_ID {Trigger_NothingTrue,
00041                      Trigger_NothingFalse,
00042                      Trigger_TurnPassed,
00043                      Trigger_UnitLost,
00044                      Trigger_UnitConquered,
00045                      Trigger_UnitDestroyed,
00046                      Trigger_AllBuildingsLost,
00047                      Trigger_AllUnitsLost,
00048                      Trigger_BuildingConquered,
00049                      Trigger_BuildingLost,
00050                      Trigger_BuildingDestroyed,
00051                      Trigger_BuildingSeen,
00052                      Trigger_EventTriggered,
00053                      Trigger_AllEnemyUnitsDestroyed,
00054                      Trigger_AllEnemyBuildingsDestroyed,
00055                      Trigger_AnyUnitEntersPolygon,
00056                      Trigger_SpecificUnitEntersPolygon,
00057                      Trigger_ResourceTribute };
00058 
00059 
00060 enum EventAction_ID { EventAction_Nothing,
00061                      EventAction_WindChange,
00062                      EventAction_ChangeGameParameter,
00063                      EventAction_DisplayMessage,
00064                      EventAction_WeatherChange,
00065                      EventAction_MapChange,
00066                      EventAction_AddObject,
00067                      EventAction_MapChangeCompleted,
00068                      EventAction_ChangeBuildingDamage,
00069                      EventAction_NextMap,
00070                      EventAction_LoseMap,
00071                      EventAction_DisplayEllipse,
00072                      EventAction_RemoveEllipse,
00073                      EventAction_ChangeBuildingOwner,
00074                      EventAction_RemoveAllObjects,
00075                      EventAction_DisplayImmediateMessage,
00076                      EventAction_AddProductionCapabiligy,
00077                      EventAction_ChangeDiplomaticStatus,
00078                      EventAction_AddResources,
00079                      EventAction_Reinforcements,
00080                      EventAction_SetViewSharing,
00081                      EventAction_ChangePlayerState };
00082 
00083 
00084 class EventTriggered;
00085 
00086 class FieldAddressing: protected PolygonPainterSquareCoordinate  {
00087       GameMap*& gameMap;
00088    public:
00089       typedef vector<MapCoordinate> Fields;
00090       typedef vector< Poly_gon > Polygons;
00091 
00092       void setField ( const MapCoordinate& pos );
00093       void setPolygon ( const Poly_gon& poly_gon );
00094       void setGlobal();
00095       virtual ~FieldAddressing() {};
00096 
00097    protected:
00098       FieldAddressing( GameMap*& gamemap ) : gameMap(gamemap), addressingMode( none ) {};
00099       enum AddressingMode { none, singleField, poly, global };
00100 
00101       AddressingMode addressingMode;
00102       Fields fields;
00103       Polygons polygons;
00104 
00105       void readMapModificationData ( tnstream& stream );
00106       void writeMapModificationData ( tnstream& stream );
00107       virtual void fieldOperator( const MapCoordinate& mc ) = 0;
00108       void operate();
00109       void setpointabs ( int x,  int y  );
00110 
00111       void setup();
00112       friend Event* readOldEvent( pnstream stream, GameMap* gamemap, map<int,int>& eventTranslation, map<EventTriggered*,int>& eventTriggerEvents );
00113 };
00114 
00115 
00116 
00117 class TriggerNothing : public EventTrigger {
00118     public:
00119       TriggerNothing( EventTriggerID id ) : EventTrigger ( id ) {};
00120       virtual void readData ( tnstream& stream ) ;
00121       virtual void writeData ( tnstream& stream ) ;
00122       void setup() {};
00123 };
00124 
00125 class TriggerNothingTrue: public TriggerNothing {
00126     protected:
00127       State getState( int player ) { return finally_fulfilled; };
00128    public:
00129       TriggerNothingTrue() : TriggerNothing( Trigger_NothingTrue ) {};
00130       ASCString getTypeName() const { return "Nothing (always true)"; };
00131       ASCString getDetailledName() const { return getTypeName(); };
00132 };
00133 
00134 class TriggerNothingFalse: public TriggerNothing {
00135     protected:
00136       State getState( int player ) { return finally_failed; };
00137    public:
00138       TriggerNothingFalse() : TriggerNothing( Trigger_NothingFalse ) {};
00139       ASCString getTypeName() const { return "Nothing (always false)"; };
00140       ASCString getDetailledName() const { return getTypeName(); };
00141 };
00142 
00143 
00144 
00145 class TurnPassed : public EventTrigger {
00146       int turn;
00147       int move;
00148     protected:
00149       virtual State getState( int player );
00150     public:
00151       TurnPassed() : EventTrigger ( Trigger_TurnPassed ), turn( -1 ), move( -1 ) {};
00152       TurnPassed( int turn_, int move_ ) : EventTrigger ( Trigger_TurnPassed ), turn( turn_ ), move( move_ ) {};
00153 
00154       virtual void readData ( tnstream& stream ) ;
00155       virtual void writeData ( tnstream& stream ) ;
00156       ASCString getTypeName() const;
00157       ASCString getDetailledName() const;
00158       void setup();
00159       void arm();
00160 };
00161 
00162 
00163 class UnitTrigger : public EventTrigger, public SigC::Object {
00164     protected:
00165       int unitID;
00166     public:
00167       UnitTrigger( EventTriggerID id ) : EventTrigger ( id ), unitID ( -1 ) {};
00168 
00169       virtual void readData ( tnstream& stream ) ;
00170       virtual void writeData ( tnstream& stream ) ;
00171       ASCString getName() const;
00172       void setup();
00173       void triggered();
00174 };
00175 
00176 
00177 class UnitLost : public UnitTrigger {
00178     protected:
00179       virtual State getState( int player );
00180     public:
00181       UnitLost() : UnitTrigger ( Trigger_UnitLost ) {};
00182       UnitLost( int unitID_) : UnitTrigger ( Trigger_UnitLost ) { unitID = unitID_;};
00183       ASCString getTypeName() const;
00184       ASCString getDetailledName() const;
00185       void arm();
00186 };
00187 
00188 class UnitConquered : public UnitTrigger {
00189     protected:
00190       virtual State getState( int player );
00191     public:
00192       UnitConquered() : UnitTrigger ( Trigger_UnitConquered ) {};
00193       UnitConquered( int unitID_) : UnitTrigger ( Trigger_UnitConquered ) { unitID = unitID_;};
00194       ASCString getTypeName() const;
00195       ASCString getDetailledName() const;
00196       void arm();
00197 };
00198 
00199 class UnitDestroyed : public UnitTrigger {
00200     protected:
00201       virtual State getState( int player );
00202     public:
00203       UnitDestroyed() : UnitTrigger ( Trigger_UnitDestroyed ) {};
00204       UnitDestroyed( int unitID_) : UnitTrigger ( Trigger_UnitDestroyed ) { unitID = unitID_;};
00205       ASCString getTypeName() const;
00206       ASCString getDetailledName() const;
00207       void arm();
00208 };
00209 
00210 
00211 
00212 class AllBuildingsLost : public EventTrigger {
00213     protected:
00214       virtual State getState( int player );
00215     public:
00216       AllBuildingsLost() : EventTrigger ( Trigger_AllBuildingsLost ) {};
00217 
00218       virtual void readData ( tnstream& stream ) { stream.readInt(); };
00219       virtual void writeData ( tnstream& stream ) { stream.writeInt(1); };
00220       ASCString getTypeName() const;
00221       ASCString getDetailledName() const;
00222       void setup() {};
00223 };
00224 
00225 class AllUnitsLost : public EventTrigger {
00226     protected:
00227       virtual State getState( int player );
00228     public:
00229       AllUnitsLost() : EventTrigger ( Trigger_AllUnitsLost ) {};
00230 
00231       virtual void readData ( tnstream& stream ) { stream.readInt(); };
00232       virtual void writeData ( tnstream& stream ) { stream.writeInt(1); };
00233       ASCString getTypeName() const;
00234       ASCString getDetailledName() const;
00235       void setup() {};
00236 };
00237 
00238 
00239 class PositionTrigger : public EventTrigger {
00240    protected:
00241       MapCoordinate pos;
00242       PositionTrigger( EventTriggerID id ) : EventTrigger( id ) {};
00243    public:
00244       virtual void readData ( tnstream& stream ) ;
00245       virtual void writeData ( tnstream& stream ) ;
00246 };
00247 
00248 class BuildingPositionTrigger : public PositionTrigger {
00249    protected:
00250       BuildingPositionTrigger( EventTriggerID id ) : PositionTrigger( id ) {};
00251    public:
00252       ASCString getName() const;
00253       void setup();
00254 };
00255 
00256 
00257 class BuildingConquered : public BuildingPositionTrigger, public SigC::Object {
00258     protected:
00259       BuildingConquered( EventTriggerID id ) : BuildingPositionTrigger( id ) {};
00260       virtual State getState( int player );
00261     public:
00262       BuildingConquered() : BuildingPositionTrigger( Trigger_BuildingConquered ) {};
00263       BuildingConquered( const MapCoordinate& position) : BuildingPositionTrigger( Trigger_BuildingConquered ) { pos = position;};
00264       ASCString getTypeName() const { return "Building conquered"; };
00265       ASCString getDetailledName() const { return BuildingPositionTrigger::getName() + " conquered"; };
00266       void arm();
00267       void triggered();
00268 };
00269 
00270 class BuildingLost: public BuildingConquered  {
00271     protected:
00272       virtual State getState( int player );
00273    public:
00274       BuildingLost ( ) : BuildingConquered( Trigger_BuildingLost ) {};
00275       BuildingLost( const MapCoordinate& position) : BuildingConquered( position ) {};
00276       ASCString getTypeName() const { return "Building lost"; };
00277       ASCString getDetailledName() const { return BuildingPositionTrigger::getName() + " conquered"; };
00278       void arm();
00279 };
00280 
00281 class BuildingDestroyed : public BuildingPositionTrigger {
00282     protected:
00283       virtual State getState( int player );
00284     public:
00285       BuildingDestroyed() : BuildingPositionTrigger ( Trigger_BuildingDestroyed ) {};
00286       BuildingDestroyed( const MapCoordinate& position) : BuildingPositionTrigger( Trigger_BuildingDestroyed ) { pos = position;};
00287       ASCString getTypeName() const { return "Building destroyed"; };
00288       ASCString getDetailledName() const { return BuildingPositionTrigger::getName() + " destroyed"; };
00289 };
00290 
00291 class BuildingSeen : public BuildingPositionTrigger, public SigC::Object {
00292     protected:
00293       virtual State getState( int player );
00294     public:
00295       BuildingSeen() : BuildingPositionTrigger ( Trigger_BuildingSeen ) {};
00296       BuildingSeen( const MapCoordinate& position) : BuildingPositionTrigger( Trigger_BuildingSeen ) { pos = position;};
00297       ASCString getTypeName() const { return "Building seen"; };
00298       ASCString getDetailledName() const { return BuildingPositionTrigger::getName() + " seen"; };
00299       void arm();
00300       void triggered();
00301 };
00302 
00303 class EventTriggered : public EventTrigger, public SigC::Object {
00304       int eventID;
00305       Event* getTargetEventName() const;
00306     protected:
00307       virtual State getState( int player );
00308     public:
00309       EventTriggered( int eventID_ = -1 ) : EventTrigger ( Trigger_EventTriggered ), eventID( eventID_ ) {};
00310       void setEventID( int eventID_ ) { eventID = eventID_; };
00311 
00312       virtual void readData ( tnstream& stream );
00313       virtual void writeData ( tnstream& stream );
00314       ASCString getTypeName() const;
00315       ASCString getDetailledName() const;
00316       void setup();
00317       void arm();
00318       void triggered();
00319 };
00320 
00321 class AllEnemyUnitsDestroyed : public EventTrigger, public SigC::Object {
00322    private:
00323       void triggered();
00324    protected:
00325       virtual State getState( int player );
00326     public:
00327       AllEnemyUnitsDestroyed() : EventTrigger ( Trigger_AllEnemyUnitsDestroyed ) {};
00328 
00329       virtual void readData ( tnstream& stream ) { stream.readInt(); };
00330       virtual void writeData ( tnstream& stream ) { stream.writeInt(1); };
00331 
00332       ASCString getTypeName() const;
00333       ASCString getDetailledName() const;
00334       void setup() {};
00335       void arm();
00336 };
00337 
00338 class AllEnemyBuildingsDestroyed : public EventTrigger, public SigC::Object {
00339    private:
00340       void triggered();
00341    protected:
00342       virtual State getState( int player );
00343     public:
00344       AllEnemyBuildingsDestroyed() : EventTrigger ( Trigger_AllEnemyBuildingsDestroyed ) {};
00345 
00346       virtual void readData ( tnstream& stream ) { stream.readInt(); };
00347       virtual void writeData ( tnstream& stream ) { stream.writeInt(1); };
00348       ASCString getTypeName() const;
00349       ASCString getDetailledName() const;
00350       void setup() {};
00351       void arm();
00352 };
00353 
00354 class SpecificUnitEntersPolygon : public EventTrigger, public FieldAddressing, public SigC::Object {
00355       int unitID;
00356       bool found;
00357       bool arming;
00358     protected:
00359       virtual State getState( int player );
00360     public:
00361       SpecificUnitEntersPolygon( int unitID_ = -1 ) : EventTrigger ( Trigger_SpecificUnitEntersPolygon ), FieldAddressing(gamemap),unitID( unitID_ ), found(false), arming(false) {};
00362 
00363       virtual void readData ( tnstream& stream );
00364       virtual void writeData ( tnstream& stream );
00365       void setup();
00366       void arm();
00367       void triggered();
00368       ASCString getTypeName() const;
00369       ASCString getDetailledName() const;
00370 
00371     protected:
00372       void fieldOperator( const MapCoordinate& mc );
00373 };
00374 
00375 class AnyUnitEntersPolygon : public EventTrigger, public FieldAddressing, public SigC::Object {
00376       int player;
00377       bool found;
00378       bool arming;
00379     protected:
00380       virtual State getState( int player );
00381     public:
00382       AnyUnitEntersPolygon( int player_ = 0 ) : EventTrigger ( Trigger_AnyUnitEntersPolygon ), FieldAddressing(gamemap), player( player_ ), found(false), arming(false) {};
00383 
00384       virtual void readData ( tnstream& stream );
00385       virtual void writeData ( tnstream& stream );
00386       void setup();
00387       void arm();
00388       void triggered();
00389       ASCString getTypeName() const;
00390       ASCString getDetailledName() const;
00391 
00392     protected:
00393       void fieldOperator( const MapCoordinate& mc );
00394 };
00395 
00396 
00397 class ResourceTribute : public EventTrigger, public SigC::Object {
00398       Resources demand;
00399       int payingPlayer;
00400     protected:
00401       virtual State getState( int player );
00402     public:
00403 
00404       ResourceTribute() : EventTrigger ( Trigger_ResourceTribute ), payingPlayer( -1 ) {};
00405 
00406       virtual void readData ( tnstream& stream );
00407       virtual void writeData ( tnstream& stream );
00408       ASCString getTypeName() const;
00409       ASCString getDetailledName() const;
00410       void setup();
00411       void arm();
00412       void triggered();
00413 };
00414 
00415 
00416 
00417 
00418 
00419 class Action_Nothing: public EventAction {
00420    public:
00421       Action_Nothing( ) : EventAction( EventAction_Nothing ) {};
00422 
00423       void readData ( tnstream& stream );
00424       void writeData ( tnstream& stream );
00425 
00426       void execute( MapDisplayInterface* md ) {};
00427       void setup() {};
00428 
00429       ASCString getName() const { return "-nothing-"; };
00430 
00431 };
00432 
00433 
00434 class WindChange: public EventAction {
00435       int speed;
00436       int direction;
00437    public:
00438       WindChange() : EventAction( EventAction_WindChange ),
00439                      speed(0),
00440                      direction(0){};
00441 
00442       WindChange( int Speed, int Direction) : EventAction( EventAction_WindChange ),
00443                                               speed ( Speed ),
00444                                               direction ( Direction ) {};
00445 
00446       void readData ( tnstream& stream );
00447       void writeData ( tnstream& stream );
00448 
00449       void execute( MapDisplayInterface* md );
00450       void setup();
00451 
00452       ASCString getName() const { return "Wind change"; };
00453 
00454 };
00455 
00456 class ChangeGameParameter: public EventAction {
00457       int parameterNum;
00458       int parameterValue;
00459       int selectgameparameter( int para );
00460 
00461     public:
00462      ChangeGameParameter(): EventAction( EventAction_ChangeGameParameter ),
00463                             parameterNum(-1),
00464                             parameterValue(0){};
00465 
00466      ChangeGameParameter( int ParameterNum, int ParameterValue): EventAction( EventAction_ChangeGameParameter ),
00467                             parameterNum(ParameterNum),
00468                             parameterValue(ParameterValue){};
00469 
00470       void readData ( tnstream& stream );
00471       void writeData ( tnstream& stream );
00472 
00473       void execute( MapDisplayInterface* md );
00474       void setup();
00475 
00476       ASCString getName() const { return "Change game parameter"; };
00477 
00478 };
00479 
00480 class DisplayMessage: public EventAction {
00481       int messageNum;
00482     public:
00483       DisplayMessage(): EventAction( EventAction_DisplayMessage ),
00484                         messageNum(-1) {};
00485       DisplayMessage( int messageNumber ) : EventAction( EventAction_DisplayMessage ),
00486                         messageNum( messageNumber ) {};
00487       void readData ( tnstream& stream );
00488       void writeData ( tnstream& stream );
00489 
00490       void execute( MapDisplayInterface* md );
00491 
00492       void setup();
00493 
00494       ASCString getName() const { return "Display Message (from text file)"; };
00495 };
00496 
00497 
00498 class MapModificationEvent : public EventAction, public FieldAddressing {
00499    protected:
00500       MapModificationEvent ( EventActionID id ) : EventAction ( id ), FieldAddressing(gamemap) {};
00501    public:
00502       void execute( MapDisplayInterface* md );
00503 };
00504 
00505 class WeatherChange : public MapModificationEvent {
00506       int weather;
00507    protected:
00508       void fieldOperator( const MapCoordinate& mc );
00509    public:
00510       WeatherChange( int weather_ = -1 ): MapModificationEvent( EventAction_WeatherChange ),
00511                         weather( weather_ ) {};
00512       void readData ( tnstream& stream );
00513       void writeData ( tnstream& stream );
00514 
00515       void setup();
00516 
00517       ASCString getName() const { return "Weather change"; };
00518 
00519 };
00520 
00521 class MapChange : public MapModificationEvent {
00522       int terrainID;
00523    protected:
00524       void fieldOperator( const MapCoordinate& mc );
00525    public:
00526       MapChange( int terrainID_ = -1 ): MapModificationEvent( EventAction_MapChange ),
00527                         terrainID( terrainID_ ) {};
00528       void readData ( tnstream& stream );
00529       void writeData ( tnstream& stream );
00530       void setup();
00531 
00532       ASCString getName() const { return "Map Change"; };
00533 };
00534 
00535 class AddObject : public MapModificationEvent {
00536       int objectID;
00537    protected:
00538       void fieldOperator( const MapCoordinate& mc );
00539    public:
00540       AddObject(): MapModificationEvent( EventAction_AddObject ),
00541                         objectID(-1) {};
00542       AddObject( int objectID_ ): MapModificationEvent( EventAction_AddObject ),
00543                         objectID(objectID_) {};
00544       void readData ( tnstream& stream );
00545       void writeData ( tnstream& stream );
00546       void setup();
00547 
00548       ASCString getName() const { return "Add object"; };
00549 };
00550 
00551 
00552 class MapChangeCompleted : public EventAction {
00553     public:
00554       MapChangeCompleted(): EventAction( EventAction_MapChangeCompleted ) {};
00555 
00556       void readData ( tnstream& stream ) {};
00557       void writeData ( tnstream& stream ) {};
00558 
00559       void execute( MapDisplayInterface* md );
00560       void setup() {};
00561 
00562       ASCString getName() const { return "map change completed"; };
00563 
00564 };
00565 
00566 
00567 class ChangeBuildingDamage: public EventAction {
00568       int damage;
00569       MapCoordinate position;
00570    public:
00571       ChangeBuildingDamage() : EventAction( EventAction_ChangeBuildingDamage ),
00572                      damage(0) {};
00573       ChangeBuildingDamage( const MapCoordinate& pos, int dam ): EventAction( EventAction_ChangeBuildingDamage ),
00574                      damage(dam), position(pos) {};
00575 
00576       void readData ( tnstream& stream );
00577       void writeData ( tnstream& stream );
00578 
00579       void execute( MapDisplayInterface* md );
00580       void setup();
00581 
00582       ASCString getName() const { return "Change building damage"; };
00583 };
00584 
00585 class NextMap : public EventAction {
00586       int mapID;
00587    public:
00588       NextMap() : EventAction ( EventAction_NextMap ), mapID(0) {};
00589       NextMap( int mapID_ ) : EventAction ( EventAction_NextMap ), mapID(mapID_) {};
00590 
00591       void readData ( tnstream& stream );
00592       void writeData ( tnstream& stream );
00593 
00594       void execute( MapDisplayInterface* md );
00595       void setup();
00596 
00597       ASCString getName() const { return "Next Map in Campaign"; };
00598 
00599 };
00600 
00601 class LoseMap : public EventAction {
00602     public:
00603       LoseMap(): EventAction( EventAction_LoseMap ) {};
00604 
00605       void readData ( tnstream& stream ) {};
00606       void writeData ( tnstream& stream ) {};
00607 
00608       void execute( MapDisplayInterface* md );
00609       void setup() {};
00610 
00611       ASCString getName() const { return "Lose Map"; };
00612 
00613 };
00614 
00615 class DisplayEllipse : public EventAction {
00616       int x1,y1,x2,y2;
00617       bool alignRight;
00618       bool alignBottom;
00619     public:
00620       DisplayEllipse(): EventAction( EventAction_DisplayEllipse ),
00621                         x1(-1),y1(-1),x2(-1),y2(-1),
00622                         alignRight(false),alignBottom(false) {};
00623       DisplayEllipse(int x1_, int y1_, int x2_, int y2_, bool alignRight_, bool alignBottom_): EventAction( EventAction_DisplayEllipse ),
00624                         x1(x1_),y1(y1_),x2(x2_),y2(y2_),
00625                         alignRight(alignRight_),alignBottom(alignBottom_) {};
00626 
00627       void readData ( tnstream& stream );
00628       void writeData ( tnstream& stream );
00629 
00630       void execute( MapDisplayInterface* md );
00631       void setup();
00632 
00633       ASCString getName() const { return "Display Ellipse (legacy event)"; };
00634 
00635 };
00636 
00637 class RemoveEllipse : public EventAction {
00638     public:
00639       RemoveEllipse(): EventAction( EventAction_RemoveEllipse ) {};
00640 
00641       void readData ( tnstream& stream ) {};
00642       void writeData ( tnstream& stream ) {};
00643 
00644       void execute( MapDisplayInterface* md );
00645       void setup() {};
00646 
00647       ASCString getName() const { return "Remove ellipse (legacy event)"; };
00648 
00649 };
00650 
00651 class RemoveAllObjects : public MapModificationEvent {
00652    protected:
00653       void fieldOperator( const MapCoordinate& mc );
00654    public:
00655       RemoveAllObjects(): MapModificationEvent( EventAction_RemoveAllObjects ) {};
00656       void readData ( tnstream& stream );
00657       void writeData ( tnstream& stream );
00658       void setup();
00659 
00660       ASCString getName() const { return "Remove all objects"; };
00661 
00662 };
00663 
00664 class ChangeBuildingOwner : public EventAction {
00665       MapCoordinate pos;
00666       int newOwner;
00667     public:
00668       ChangeBuildingOwner(): EventAction( EventAction_ChangeBuildingOwner ), newOwner(0) {};
00669 
00670       void readData ( tnstream& stream );
00671       void writeData ( tnstream& stream );
00672 
00673       void execute( MapDisplayInterface* md );
00674       void setup();
00675 
00676       ASCString getName() const { return "Change Building Owner"; };
00677 };
00678 
00679 class DisplayImmediateMessage: public EventAction {
00680       ASCString message;
00681       int recipients;
00682     public:
00683       DisplayImmediateMessage(): EventAction( EventAction_DisplayImmediateMessage ), recipients(0) {};
00684       void readData ( tnstream& stream );
00685       void writeData ( tnstream& stream );
00686 
00687       void execute( MapDisplayInterface* md );
00688 
00689       void setup();
00690 
00691       ASCString getName() const { return "Display Message (immediate text)"; };
00692 
00693 };
00694 
00695 class AddProductionCapability : public EventAction {
00696       MapCoordinate pos;
00697       int vehicleTypeID;
00698     public:
00699       AddProductionCapability(): EventAction( EventAction_AddProductionCapabiligy ), vehicleTypeID(-1) {};
00700 
00701       void readData ( tnstream& stream );
00702       void writeData ( tnstream& stream );
00703 
00704       void execute( MapDisplayInterface* md );
00705       void setup();
00706 
00707       ASCString getName() const { return "Add Production Capability"; };
00708 
00709 };
00710 
00711 
00712 class ChangeDiplomaticStatus : public EventAction {
00713       int proposingPlayer;
00714       int targetPlayer;
00715       enum Proposal { Peace, War, SneakAttack } proposal;
00716     public:
00717       ChangeDiplomaticStatus(): EventAction( EventAction_ChangeDiplomaticStatus ), proposingPlayer(0), targetPlayer(0), proposal(Peace){};
00718 
00719       void readData ( tnstream& stream );
00720       void writeData ( tnstream& stream );
00721 
00722       void execute( MapDisplayInterface* md );
00723       void setup();
00724 
00725       ASCString getName() const { return "Change Diplomatic Status"; };
00726 
00727 };
00728 
00729 class SetViewSharing : public EventAction {
00730       int viewingPlayer;
00731       int providingPlayer;
00732       bool enable;
00733     public:
00734       SetViewSharing(): EventAction( EventAction_SetViewSharing ), viewingPlayer(0), providingPlayer(0), enable(true){};
00735 
00736       void readData ( tnstream& stream );
00737       void writeData ( tnstream& stream );
00738 
00739       void execute( MapDisplayInterface* md );
00740       void setup();
00741 
00742       ASCString getName() const { return "Set view sharing"; };
00743 
00744 };
00745 
00746 
00747 class AddResources : public EventAction {
00748       MapCoordinate pos;
00749       Resources res;
00750     public:
00751       AddResources(): EventAction( EventAction_AddResources ) {};
00752 
00753       void readData ( tnstream& stream );
00754       void writeData ( tnstream& stream );
00755 
00756       void execute( MapDisplayInterface* md );
00757       void setup();
00758 
00759       ASCString getName() const { return "Add Resources to Building"; };
00760 };
00761 
00762 class Reinforcements : public EventAction {
00763       tmemorystreambuf buf;
00764       int objectNum;
00765       friend class ReinforcementSelector;
00766       enum Type { ReinfVehicle, ReinfBuilding };
00767    public:
00768       Reinforcements(): EventAction( EventAction_Reinforcements ), objectNum(0) {};
00769 
00770       void readData ( tnstream& stream );
00771       void writeData ( tnstream& stream );
00772 
00773       void execute( MapDisplayInterface* md );
00774       void setup();
00775 
00776       ASCString getName() const { return "Reinforcements"; };
00777 
00778 };
00779 
00780 
00781 
00782 // }; // namespace GameEvents
00783 
00784 #endif

Generated on Tue Jun 24 01:27:42 2008 for Advanced Strategic Command by  doxygen 1.4.2