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-2010  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 #include "actions/context.h"
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( tnstream* 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(const Context& context);
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(const Context& context );
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       
00483       void  viewtextmessage ( GameMap* actmap, int id, int player );
00484       
00485     public:
00486       DisplayMessage(): EventAction( EventAction_DisplayMessage ),
00487                         messageNum(-1) {};
00488       DisplayMessage( int messageNumber ) : EventAction( EventAction_DisplayMessage ),
00489                         messageNum( messageNumber ) {};
00490       void readData ( tnstream& stream );
00491       void writeData ( tnstream& stream );
00492 
00493       void execute( MapDisplayInterface* md );
00494 
00495       void setup();
00496 
00497       ASCString getName() const { return "Display Message (from text file)"; };
00498 };
00499 
00500 
00501 class MapModificationEvent : public EventAction, public FieldAddressing {
00502    protected:
00503       MapModificationEvent ( EventActionID id ) : EventAction ( id ), FieldAddressing(gamemap) {};
00504    public:
00505       void execute( MapDisplayInterface* md );
00506 };
00507 
00508 class WeatherChange : public MapModificationEvent {
00509       int weather;
00510    protected:
00511       void fieldOperator( const MapCoordinate& mc );
00512    public:
00513       WeatherChange( int weather_ = -1 ): MapModificationEvent( EventAction_WeatherChange ),
00514                         weather( weather_ ) {};
00515       void readData ( tnstream& stream );
00516       void writeData ( tnstream& stream );
00517 
00518       void setup();
00519 
00520       ASCString getName() const { return "Weather change"; };
00521 
00522 };
00523 
00524 class MapChange : public MapModificationEvent {
00525       int terrainID;
00526    protected:
00527       void fieldOperator( const MapCoordinate& mc );
00528    public:
00529       MapChange( int terrainID_ = -1 ): MapModificationEvent( EventAction_MapChange ),
00530                         terrainID( terrainID_ ) {};
00531       void readData ( tnstream& stream );
00532       void writeData ( tnstream& stream );
00533       void setup();
00534 
00535       ASCString getName() const { return "Map Change"; };
00536 };
00537 
00538 class AddObject : public MapModificationEvent {
00539       int objectID;
00540    protected:
00541       void fieldOperator( const MapCoordinate& mc );
00542    public:
00543       AddObject(): MapModificationEvent( EventAction_AddObject ),
00544                         objectID(-1) {};
00545       AddObject( int objectID_ ): MapModificationEvent( EventAction_AddObject ),
00546                         objectID(objectID_) {};
00547       void readData ( tnstream& stream );
00548       void writeData ( tnstream& stream );
00549       void setup();
00550 
00551       ASCString getName() const { return "Add object"; };
00552 };
00553 
00554 
00555 class MapChangeCompleted : public EventAction {
00556     public:
00557       MapChangeCompleted(): EventAction( EventAction_MapChangeCompleted ) {};
00558 
00559       void readData ( tnstream& stream ) {};
00560       void writeData ( tnstream& stream ) {};
00561 
00562       void execute( MapDisplayInterface* md );
00563       void setup() {};
00564 
00565       ASCString getName() const { return "map change completed"; };
00566 
00567 };
00568 
00569 
00570 class ChangeBuildingDamage: public EventAction {
00571       int damage;
00572       MapCoordinate position;
00573    public:
00574       ChangeBuildingDamage() : EventAction( EventAction_ChangeBuildingDamage ),
00575                      damage(0) {};
00576       ChangeBuildingDamage( const MapCoordinate& pos, int dam ): EventAction( EventAction_ChangeBuildingDamage ),
00577                      damage(dam), position(pos) {};
00578 
00579       void readData ( tnstream& stream );
00580       void writeData ( tnstream& stream );
00581 
00582       void execute( MapDisplayInterface* md );
00583       void setup();
00584 
00585       ASCString getName() const { return "Change building damage"; };
00586 };
00587 
00588 class NextMap : public EventAction {
00589       int mapID;
00590    public:
00591       NextMap() : EventAction ( EventAction_NextMap ), mapID(0) {};
00592       NextMap( int mapID_ ) : EventAction ( EventAction_NextMap ), mapID(mapID_) {};
00593 
00594       void readData ( tnstream& stream );
00595       void writeData ( tnstream& stream );
00596 
00597       void execute( MapDisplayInterface* md );
00598       void setup();
00599 
00600       ASCString getName() const { return "Next Map in Campaign"; };
00601 
00602 };
00603 
00604 class LoseMap : public EventAction {
00605     public:
00606       LoseMap(): EventAction( EventAction_LoseMap ) {};
00607 
00608       void readData ( tnstream& stream ) {};
00609       void writeData ( tnstream& stream ) {};
00610 
00611       void execute( MapDisplayInterface* md );
00612       void setup() {};
00613 
00614       ASCString getName() const { return "Lose Map"; };
00615 
00616 };
00617 
00618 class DisplayEllipse : public EventAction {
00619       int x1,y1,x2,y2;
00620       bool alignRight;
00621       bool alignBottom;
00622     public:
00623       DisplayEllipse(): EventAction( EventAction_DisplayEllipse ),
00624                         x1(-1),y1(-1),x2(-1),y2(-1),
00625                         alignRight(false),alignBottom(false) {};
00626       DisplayEllipse(int x1_, int y1_, int x2_, int y2_, bool alignRight_, bool alignBottom_): EventAction( EventAction_DisplayEllipse ),
00627                         x1(x1_),y1(y1_),x2(x2_),y2(y2_),
00628                         alignRight(alignRight_),alignBottom(alignBottom_) {};
00629 
00630       void readData ( tnstream& stream );
00631       void writeData ( tnstream& stream );
00632 
00633       void execute( MapDisplayInterface* md );
00634       void setup();
00635 
00636       ASCString getName() const { return "Display Ellipse (legacy event)"; };
00637 
00638 };
00639 
00640 class RemoveEllipse : public EventAction {
00641     public:
00642       RemoveEllipse(): EventAction( EventAction_RemoveEllipse ) {};
00643 
00644       void readData ( tnstream& stream ) {};
00645       void writeData ( tnstream& stream ) {};
00646 
00647       void execute( MapDisplayInterface* md );
00648       void setup() {};
00649 
00650       ASCString getName() const { return "Remove ellipse (legacy event)"; };
00651 
00652 };
00653 
00654 class RemoveAllObjects : public MapModificationEvent {
00655    protected:
00656       void fieldOperator( const MapCoordinate& mc );
00657    public:
00658       RemoveAllObjects(): MapModificationEvent( EventAction_RemoveAllObjects ) {};
00659       void readData ( tnstream& stream );
00660       void writeData ( tnstream& stream );
00661       void setup();
00662 
00663       ASCString getName() const { return "Remove all objects"; };
00664 
00665 };
00666 
00667 class ChangeBuildingOwner : public EventAction {
00668       MapCoordinate pos;
00669       int newOwner;
00670     public:
00671       ChangeBuildingOwner(): EventAction( EventAction_ChangeBuildingOwner ), newOwner(0) {};
00672 
00673       void readData ( tnstream& stream );
00674       void writeData ( tnstream& stream );
00675 
00676       void execute( MapDisplayInterface* md );
00677       void setup();
00678 
00679       ASCString getName() const { return "Change Building Owner"; };
00680 };
00681 
00682 class DisplayImmediateMessage: public EventAction {
00683       ASCString message;
00684       int recipients;
00685     public:
00686       DisplayImmediateMessage(): EventAction( EventAction_DisplayImmediateMessage ), recipients(0) {};
00687       void readData ( tnstream& stream );
00688       void writeData ( tnstream& stream );
00689 
00690       void execute( MapDisplayInterface* md );
00691 
00692       ASCString getLocalizationString() const;;
00693       void setLocalizationString( const ASCString& s );
00694       
00695       
00696       void setup();
00697 
00698       ASCString getName() const { return "Display Message (immediate text)"; };
00699 
00700 };
00701 
00702 class AddProductionCapability : public EventAction {
00703       MapCoordinate pos;
00704       int vehicleTypeID;
00705     public:
00706       AddProductionCapability(): EventAction( EventAction_AddProductionCapabiligy ), vehicleTypeID(-1) {};
00707 
00708       void readData ( tnstream& stream );
00709       void writeData ( tnstream& stream );
00710 
00711       void execute( MapDisplayInterface* md );
00712       void setup();
00713 
00714       ASCString getName() const { return "Add Production Capability"; };
00715 
00716 };
00717 
00718 
00719 class ChangeDiplomaticStatus : public EventAction {
00720       int proposingPlayer;
00721       int targetPlayer;
00722       enum Proposal { Peace, War, SneakAttack } proposal;
00723     public:
00724       ChangeDiplomaticStatus(): EventAction( EventAction_ChangeDiplomaticStatus ), proposingPlayer(0), targetPlayer(0), proposal(Peace){};
00725 
00726       void readData ( tnstream& stream );
00727       void writeData ( tnstream& stream );
00728 
00729       void execute( MapDisplayInterface* md );
00730       void setup();
00731 
00732       ASCString getName() const { return "Change Diplomatic Status"; };
00733 
00734 };
00735 
00736 class SetViewSharing : public EventAction {
00737       int viewingPlayer;
00738       int providingPlayer;
00739       bool enable;
00740     public:
00741       SetViewSharing(): EventAction( EventAction_SetViewSharing ), viewingPlayer(0), providingPlayer(0), enable(true){};
00742 
00743       void readData ( tnstream& stream );
00744       void writeData ( tnstream& stream );
00745 
00746       void execute( MapDisplayInterface* md );
00747       void setup();
00748 
00749       ASCString getName() const { return "Set view sharing"; };
00750 
00751 };
00752 
00753 
00754 class AddResources : public EventAction {
00755       MapCoordinate pos;
00756       Resources res;
00757     public:
00758       AddResources(): EventAction( EventAction_AddResources ) {};
00759 
00760       void readData ( tnstream& stream );
00761       void writeData ( tnstream& stream );
00762 
00763       void execute( MapDisplayInterface* md );
00764       void setup();
00765 
00766       ASCString getName() const { return "Add Resources to Building"; };
00767 };
00768 
00769 class Reinforcements : public EventAction {
00770       MemoryStreamStorage buf;
00771       int objectNum;
00772       friend class ReinforcementSelector;
00773       enum Type { ReinfVehicle, ReinfBuilding };
00774    public:
00775       Reinforcements(): EventAction( EventAction_Reinforcements ), objectNum(0) {};
00776 
00777       void readData ( tnstream& stream );
00778       void writeData ( tnstream& stream );
00779 
00780       void execute( MapDisplayInterface* md );
00781       void setup();
00782 
00783       ASCString getName() const { return "Reinforcements"; };
00784 
00785 };
00786 
00787 
00788 
00789 // }; // namespace GameEvents
00790 
00791 #endif

Generated on Mon May 21 01:26:33 2012 for Advanced Strategic Command by  doxygen 1.5.1