initial commit, lordsawar source, slightly modified
[lordsawar] / src / action.h
1 // Copyright (C) 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
2 // Copyright (C) 2003 Michael Bartl
3 // Copyright (C) 2007, 2008 Ben Asselstine
4 // Copyright (C) 2008 Ole Laursen
5 //
6 //  This program is free software; you can redistribute it and/or modify
7 //  it under the terms of the GNU General Public License as published by
8 //  the Free Software Foundation; either version 3 of the License, or
9 //  (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU Library General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
19 //  02110-1301, USA.
20
21 #ifndef ACTION_H
22 #define ACTION_H
23
24 #include <gtkmm.h>
25 #include <string>
26 #include "vector.h"
27 #include <sigc++/trackable.h>
28
29 #include "fight.h"
30 #include "army.h"
31 #include "reward.h"
32 #include "player.h"
33 #include "Ownable.h"
34 #include "defs.h"
35
36 class Quest;
37 class Stack;
38 class City;
39 class Signpost;
40 class Ruin;
41 class Temple;
42 class XML_Helper;
43
44 //! A temporary record of an event during gameplay.
45 /** 
46  * The purpose of the action classes is to keep track of what a player has
47  * done. This information can be sent over the network, so that a networked 
48  * player then just has to decode and repeat the remote player's actions so
49  * that the game state is synchronised.
50  * 
51  * Each action item is derived from the abstract Action class. It must
52  * contain three functions; A loading constructor (which takes an 
53  * XML_Helper parameter), a save function which saves the data to the
54  * XML file, and a fillData function which takes some parameters and 
55  * stores the pertinent data about what happened.
56  *
57  * Each Player has an Actionlist to which these actions belong.
58  */
59
60 class Action
61 {
62     public:
63         //! The xml tag of this object in a saved-game file.
64         static std::string d_tag; 
65
66         //! An Action can be one of the following kinds.
67         enum Type {
68                 /** A stack has moved. */
69                 STACK_MOVE = 1,
70                 /** A stack has separated into two parts. */
71                 STACK_SPLIT = 2,
72                 /** A stack is fighting a city or another stack. */
73                 STACK_FIGHT = 3,
74                 /** A stack has merged with another stack. */
75                 STACK_JOIN = 4,
76                 /** A stack containing a hero has examined a ruin. */
77                 RUIN_SEARCH = 5,
78                 /** A stack has examined a temple. */
79                 TEMPLE_SEARCH = 6,
80                 /** A stack has defeated a city and occupied it. */
81                 CITY_OCCUPY = 7,
82                 /** A stack has defeated a city and pillaged it. */
83                 CITY_PILLAGE = 8,
84                 /** A stack has defeated a city and razed it. */
85                 CITY_RAZE = 9,
86                 /** A player has improved the defenses of a city. (Not used) */
87                 CITY_UPGRADE = 10,
88                 /** A player has purchased a new Army unit to be produced 
89                  * in a city. */
90                 CITY_BUY = 11,
91                 /** A player has changed production in a city to another 
92                  * Army unit.*/
93                 CITY_PROD = 12,
94                 /** A stack has received a reward. */
95                 REWARD = 13,
96                 /** A hero has received a new quest. */
97                 QUEST = 14,
98                 /** A hero has picked up or dropped an item. */
99                 HERO_EQUIP = 15,
100                 /** An Army unit has advanced to a new level (Only used for 
101                  * heroes). */
102                 UNIT_ADVANCE = 16,
103                 /** A stack has defeated a city and sacked it. */
104                 CITY_SACK = 17,
105                 /** A player has removed a stack. */
106                 STACK_DISBAND = 18,
107                 /** A player has changed what a signpost says. */
108                 MODIFY_SIGNPOST = 19,
109                 /** A player has changed the name of a city. */
110                 CITY_RENAME = 20,
111                 /** A player has vectored Army units from one city to
112                  * another. */
113                 CITY_VECTOR = 21,
114                 /** A player has changed the order in which Army units do
115                  * battle. */
116                 FIGHT_ORDER = 22,
117                 /** A player has surrendered. */
118                 RESIGN = 23,
119                 /** A hero has planted an item in the ground. */
120                 ITEM_PLANT = 24,
121                 /** A newly produced Army unit arrives on the map. */
122                 PRODUCE_UNIT = 25,
123                 /** A new vectored Army unit has shown up at a location. */
124                 PRODUCE_VECTORED_UNIT = 26,
125                 /** The player's diplomatic relations with respect to another
126                  * player has changed. */
127                 DIPLOMATIC_STATE = 27,
128                 /** The player's diplomatic proposal with respect to another
129                  * player has changed. */
130                 DIPLOMATIC_PROPOSAL = 28,
131                 /** The player's diplomatic score with respect to another
132                  * player has changed. */
133                 DIPLOMATIC_SCORE = 29,
134                 END_TURN = 30,
135                 CITY_CONQUER = 31,
136                 RECRUIT_HERO = 32,
137                 PLAYER_RENAME = 33,
138                 CITY_DESTITUTE = 34,
139                 INIT_TURN = 35,
140                 CITY_LOOT = 36,
141         };
142         static std::string actionTypeToString(Action::Type type);
143         static Action::Type actionTypeFromString(std::string str);
144
145         //! Default constructor.
146         Action(Type type);
147
148         //! Copy constructor (shallow).
149         Action(const Action &action);
150
151         //! Loading constructor.
152         Action(XML_Helper *helper);
153
154         //! Destructor.
155         virtual ~Action();
156
157         //! Returns debug information. Needs to be overwritten by derivatives.
158         virtual std::string dump() const = 0;
159
160         //! Save function. See XML_Helper for information about saving.
161         bool save(XML_Helper* helper) const;
162         bool saveContents(XML_Helper* helper) const;
163         
164         /** 
165          * static load function (see XML_Helper)
166          * 
167          * Whenever an action item is loaded, this function is called. It
168          * examines the stored id and calls the constructor of the appropriate
169          * action class.
170          *
171          * @param helper       the XML_Helper instance for the savegame
172          */
173         //! Load the action from an opened saved-game file.
174         static Action* handle_load(XML_Helper* helper);
175
176         //! Make a new action from an existing one.
177         static Action* copy(const Action* a);
178
179         //! Returns the Action::Type for this action.
180         Type getType() const {return d_type;}
181
182     protected:
183         virtual bool doSave(XML_Helper* helper) const = 0;
184         
185         Type d_type;
186 };
187
188 //-----------------------------------------------------------------------------
189
190 //! A temporary record of a Stack moving.
191 /**
192  * The purpose of the Action_Move class is to record when a stack has
193  * moved to a new position on the map.
194  */
195 class Action_Move : public Action
196 {
197     public:
198         //! Make a new move action.
199         Action_Move();
200         //! Copy constructor
201         Action_Move(const Action_Move &action);
202         //! Load a new move action from an opened saved-game file.
203         Action_Move(XML_Helper* helper);
204         //! Destroy a move action.
205         ~Action_Move();
206
207         //! Return some debug information about this action.
208         std::string dump() const;
209
210         //! Save this move action to an opened saved-game file.
211         virtual bool doSave(XML_Helper* helper) const;
212
213         //! Populate the move action with the stack and it's new position.
214         bool fillData(Stack* s, Vector<int> dest);
215     
216         guint32 getStackId() const {return d_stack;};
217         Vector<int> getEndingPosition() const {return d_dest;};
218         Vector<int> getPositionDelta() const {return d_delta;};
219
220         private:
221         guint32 d_stack;
222         Vector<int> d_dest;
223         Vector<int> d_delta;
224 };
225
226 //! A temporary record of a Stack being disbanded.
227 /**
228  * The purpose of the Action_Disband class is to record when a stack has
229  * removed from the game.  Disbanding is done to primarily to save the 
230  * gold pieces paid out every turn as upkeep for the Army units in the Stack.
231  */
232 class Action_Disband: public Action
233 {
234     public:
235         //! Make a new disband action.
236         Action_Disband();
237         //! Copy constructor
238         Action_Disband(const Action_Disband &action);
239         //! Load a new disband action from an opened saved-game file.
240         Action_Disband(XML_Helper* helper);
241         //! Destroy a disband action.
242         ~Action_Disband();
243
244         //! Return some debug information about this action.
245         std::string dump() const;
246
247         //! Save this disband action to an opened saved-game file.
248         virtual bool doSave(XML_Helper* helper) const;
249
250         //! Populate the action with the Stack being removed.
251         bool fillData(Stack* s);
252     
253         guint32 getStackId() const {return d_stack;};
254
255         private:
256         guint32 d_stack;
257 };
258
259 //-----------------------------------------------------------------------------
260
261 //! A temporary record of a Stack being split into two.
262 /**
263  * The purpose of the Action_Split class is to record when a Stack has been
264  * separated into two parts.  This happens when the Player groups only some
265  * of the Army units in the stack (not all), and then moves them to a new 
266  * position on the map.  When a split is completed there is the original
267  * stack (the remaining Army units in the stack that didn't change position), 
268  * and a new stack added to the game (the stack containing the grouped army 
269  * units).
270  */
271 class Action_Split : public Action
272 {
273     public:
274         //! Make a new stack split action.
275         Action_Split();
276         //! Copy constructor
277         Action_Split(const Action_Split &action);
278         //! Load a new stack split action from an opened saved-game file.
279         Action_Split(XML_Helper* helper);
280         //! Destroy a stack split action.
281         ~Action_Split();
282
283         //! Return some debug information about this action.
284         std::string dump() const;
285
286         //! Save this split action to an opened saved-game file.
287         bool doSave (XML_Helper* helper) const;
288
289         /** 
290          * Populate the Action_Split class with the original Stack, and the 
291          * new stack that has been added to the game.  Please note that the 
292          * stacks have to be already split before this call.
293          */
294         //! Populate the action with pertinent data.
295         bool fillData(Stack* orig, Stack* added);
296     
297         guint32 getStackId() const {return d_orig;};
298         guint32 getNewStackId() const {return d_added;};
299         guint32 getGroupedArmyId(int idx) const {return d_armies_moved[idx];};
300         private:
301         guint32 d_orig, d_added;
302         guint32 d_armies_moved[MAX_STACK_SIZE];
303 };
304
305 //-----------------------------------------------------------------------------
306
307 //! A temporary record of a fight between opposing Stack objects.
308 /**
309  * The purpose of the Action_Fight class is to record the results of a
310  * fight between two Players.
311  */
312 class Action_Fight : public Action, public sigc::trackable
313 {
314     public:
315         //! Make a new fight action.
316         Action_Fight();
317         //! Copy constructor
318         Action_Fight(const Action_Fight &action);
319         //! Load a new fight action from an opened saved-game file.
320         Action_Fight(XML_Helper* helper);
321         //! Destroy a fight action.
322         ~Action_Fight();
323
324         //! Return some debug information about this action.
325         std::string dump() const;
326
327         //! Save this fight action to an opened saved-game file.
328         virtual bool doSave(XML_Helper* helper) const;
329
330         /**
331          * Populate the action with the Fight.  Please note that the
332          * Fight must have already been faught.
333          */
334         //! Fill the action with pertinent data.
335         bool fillData(const Fight* f);
336
337
338         std::list<FightItem> getBattleHistory() const {return d_history;};
339         std::list<guint32> getAttackerArmyIds() const {return d_attackers;};
340         std::list<guint32> getDefenderArmyIds() const {return d_defenders;};
341
342         private:
343         
344         std::list<FightItem> d_history;
345         std::list<guint32> d_attackers;
346         std::list<guint32> d_defenders;
347
348         bool loadItem(std::string tag, XML_Helper* helper);
349 };
350
351 //-----------------------------------------------------------------------------
352
353 //! A temporary record of two Stack objects merging into one.
354 /**
355  * The purpose of the Action_Join class is to record a Stack has had 
356  * another Stack merged into it.
357  */
358 class Action_Join : public Action
359 {
360     public:
361         //! Make a new stack join action.
362         Action_Join();
363         //! Copy constructor
364         Action_Join(const Action_Join &action);
365         //! Load a new stack join action from an opened saved-game file.
366         Action_Join(XML_Helper* helper);
367         //! Destroy a stack join action.
368         ~Action_Join();
369
370         //! Return some debug information about this action.
371         std::string dump() const;
372
373         //! Save this stack join action to an opened saved-game file.
374         virtual bool doSave(XML_Helper* helper) const;
375
376         /** 
377          * Populate the Action_Join class with the original Stack, and the 
378          * stack that is merging into the original one.  Please note that
379          * this method must be called before the merge takes place.
380          */
381         //! Populate the action with pertinent data.
382         bool fillData(Stack* orig, Stack* joining);
383     
384         guint32 getReceivingStackId() const {return d_orig_id;};
385         guint32 getJoiningStackId() const {return d_joining_id;};
386         private:
387         guint32 d_orig_id, d_joining_id;
388 };
389
390 //-----------------------------------------------------------------------------
391
392 //! A temporary record of what happened when a Stack searched a Ruin.
393 /**
394  * The purpose of the Action_Ruin class is to record what happens when a
395  * Stack containing a Hero attempts to search a Ruin.
396  */
397 class Action_Ruin : public Action
398 {
399     public:
400         //! Make a new ruin search attempted action.
401         Action_Ruin();
402         //! Copy constructor
403         Action_Ruin(const Action_Ruin&action);
404         //! Load a new ruin search attempted action from a saved-game file.
405         Action_Ruin(XML_Helper* helper);
406         //! Destroy a ruin search attempted action.
407         ~Action_Ruin();
408
409         //! Return some debug information about this action.
410         std::string dump() const;
411
412         //! Save this ruin search attempted action to a saved-game file.
413         virtual bool doSave(XML_Helper* helper) const;
414
415         /**
416          * Populate the Action_Ruin class with the Stack containing the
417          * Hero Army unit, and the Ruin being searched.
418          */
419         //! Populate the action with pertinent data.
420         bool fillData(Ruin* r, Stack* explorers);
421
422         //! Set whether or not the Stack was successful in searching the ruin.
423         void setSearched(bool searched) {d_searched = searched;}
424     
425         guint32 getRuinId() const {return d_ruin;};
426         guint32 getStackId() const {return d_stack;};
427         bool getSearchSuccessful() const {return d_searched;};
428
429         private:
430         guint32 d_ruin;
431         guint32 d_stack;
432         bool d_searched;
433 };
434
435 //-----------------------------------------------------------------------------
436
437 //! A temporary record of what happened when a Stack visited a Temple.
438 /**
439  * The purpose of the Action_Temple class is to record what happens when
440  * a Stack visits a Temple.  The Stack may be getting blessed, or instead it
441  * might be a Stack containing a Hero who is obtaining a new Quest.
442  */
443 class Action_Temple : public Action
444 {
445     public:
446         //! Make a new temple search action.
447         Action_Temple();
448         //! Copy constructor
449         Action_Temple(const Action_Temple &action);
450         //! Load a new temple search action from a saved-game file.
451         Action_Temple(XML_Helper* helper);
452         //! Destroy a temple search action.
453         ~Action_Temple();
454
455         //! Return some debug information about this action.
456         std::string dump() const;
457
458         //! Save this temple search attempted action to a saved-game file.
459         virtual bool doSave(XML_Helper* helper) const;
460
461         /**
462          * Populate the Action_Temple class with the Stack and the Temple
463          * being searched.
464          */
465         //! Populate the action with pertinent data.
466         bool fillData(Temple* t, Stack* s);
467     
468         guint32 getTempleId() const {return d_temple;};
469         guint32 getStackId() const {return d_stack;};
470
471         private:
472         guint32 d_temple;
473         guint32 d_stack;
474 };
475
476
477 //-----------------------------------------------------------------------------
478
479 //! A temporary record of what happened when a Player occupied a City.
480 /**
481  * The purpose of the Action_Occupy class is to record when a Player has
482  * defeated a City and has occupied it.  Ocuppying differs from sacking
483  * and pillaging in that none of the existing Army units in the City are
484  * exchanged for gold pieces.
485  */
486 class Action_Occupy : public Action
487 {
488     public:
489         //! Make a new city occupy action.
490         Action_Occupy();
491         //! Copy constructor.
492         Action_Occupy(const Action_Occupy &action);
493         //! Load a new city occupied action from an opened saved-game file.
494         Action_Occupy(XML_Helper* helper);
495         //! Destroy a city occupy action.
496         ~Action_Occupy();
497
498         //! Return some debug information about this action.
499         std::string dump() const;
500
501         //! Save this city occupied action to an opened saved-game file.
502         virtual bool doSave(XML_Helper* helper) const;
503
504         //! Populate the action with the City being occupied.
505         bool fillData (City* c);
506     
507         guint32 getCityId() const {return d_city;};
508
509         private:
510         guint32 d_city;
511 };
512
513 //-----------------------------------------------------------------------------
514
515 //! A temporary record of what happened when a Player pillaged a City.
516 /**
517  * The purpose of the Action_Pillage class is to record when a Player has
518  * defeated a City and has pillaged it.  Pillaging a city results in the
519  * strongest Army unit being produced in that city being exchanged for an 
520  * amount of gold pieces.
521  */
522 class Action_Pillage : public Action
523 {
524     public:
525         //! Make a new city pillaged action.
526         Action_Pillage();
527         //! Copy constructor
528         Action_Pillage(const Action_Pillage &action);
529         //! Load a new city pillaged action from an opened saved-game file.
530         Action_Pillage(XML_Helper* helper);
531         //! Destroy a city pillaged action.
532         ~Action_Pillage();
533
534         //! Return some debug information about this action.
535         std::string dump() const;
536
537         //! Save this city pillaged action to an opened saved-game file.
538         virtual bool doSave(XML_Helper* helper) const;
539
540         //! Populate the action with the City that has been pillaged.
541         bool fillData(City* c);
542
543         guint32 getCityId() const {return d_city;};
544
545         private:
546         guint32 d_city;
547 };
548
549 //-----------------------------------------------------------------------------
550
551 //! A temporary record of what happened when a Player sacked a City.
552 /**
553  * The purpose of the Action_Sack class is to record when a Player has
554  * defeated a City and has sacked it.  Sacking a city results in all 
555  * Army units, except the weakest being exchanged for an amount of gold 
556  * pieces.
557  */
558 class Action_Sack : public Action
559 {
560     public:
561         //! Make a new city sacked action.
562         Action_Sack();
563         //! Copy constructor
564         Action_Sack(const Action_Sack &action);
565         //! Load a new city sacked action from an opened saved-game file.
566         Action_Sack(XML_Helper* helper);
567         //! Destroy a city sacked action.
568         ~Action_Sack();
569
570         //! Return some debug information about this action.
571         std::string dump() const;
572
573         //! Save this city sacked action to an opened saved-game file.
574         virtual bool doSave(XML_Helper* helper) const;
575
576         //! Populate the action with the City that has been sacked.
577         bool fillData(City* c);
578
579         guint32 getCityId() const {return d_city;};
580
581         private:
582         guint32 d_city;
583 };
584
585 //-----------------------------------------------------------------------------
586
587 //! A temporary record of what happened when a Player razed a City.
588 /**
589  * The purpose of the Action_Raze class is to record when a Player has
590  * defeated a City and has razed it.  Razing a city results in that
591  * city becoming uninhabitable, and it ceases to produce new Army units.
592  */
593 class Action_Raze : public Action
594 {
595     public:
596         //! Make a new city razed action.
597         Action_Raze();
598         //! Copy constructor
599         Action_Raze(const Action_Raze &action);
600         //! Load a new city razed action from an opened saved-game file.
601         Action_Raze(XML_Helper* helper);
602         //! Destroy a city razed action.
603         ~Action_Raze();
604
605         //! Return some debug information about this action.
606         std::string dump() const;
607
608         //! Save this city razed action to an opened saved-game file.
609         virtual bool doSave(XML_Helper* helper) const;
610
611         //! Populate the action with the City that has been razed.
612         bool fillData (City* c);
613     
614         guint32 getCityId() const {return d_city;};
615
616         private:
617         guint32 d_city;
618 };
619
620 //-----------------------------------------------------------------------------
621
622 //! A temporary record of what happened when a City's defenses were increased.
623 /**
624  * The purpose of the Action_Upgrade class is to record when a Player has
625  * improved the City's defenses.  This action is not currently used by 
626  * LordsAWar.
627  */
628 class Action_Upgrade : public Action
629 {
630     public:
631         //! Make a new city upgraded action.
632         Action_Upgrade();
633         //! Copy constructor
634         Action_Upgrade(const Action_Upgrade &action);
635         //! Load a new city upgraded action from an opened saved-game file.
636         Action_Upgrade(XML_Helper* helper);
637         //! Destroy a city upgraded action.
638         ~Action_Upgrade();
639
640         //! Return some debug information about this action.
641         std::string dump() const;
642
643         //! Save this city upgraded action to an opened saved-game file.
644         virtual bool doSave(XML_Helper* helper) const;
645
646         //! Populate the action with the City that has been upgraded.
647         bool fillData(City* c);
648
649         guint32 getCityId() const {return d_city;};
650
651         private:
652         guint32 d_city;
653 };
654
655 //-----------------------------------------------------------------------------
656
657 //! A temporary record of more production being added to a City.
658 /**
659  * The purpose of the Action_Buy class is to record when a Player purchases
660  * a new Army unit for production in a City.  When this happens the player
661  * specifies a production slot to hold the new Army unit type.  Any existing
662  * Army unit type in that slot before the buy is removed.
663  * The idea here is that the city may produce one Army unit type from a set 
664  * of available Army units, and this action records what happens when we make 
665  * a new kind of Army unit available for production in the City.
666  * The army unit is taken from the Player's Armyset.
667  */
668 class Action_Buy : public Action
669 {
670     public:
671         //! Make a new city buy production action.
672         Action_Buy();
673         //! Copy constructor
674         Action_Buy(const Action_Buy &action);
675         //! Load a new city buy production action from a saved-game file.
676         Action_Buy(XML_Helper* helper);
677         //! Destroy a city buy production action.
678         ~Action_Buy();
679
680         //! Return some debug information about this action.
681         std::string dump() const;
682
683         //! Save this city buy production action to an opened saved-game file.
684         virtual bool doSave(XML_Helper* helper) const;
685
686         /**
687          * Populate the Action_Buy with City where the buy has happened.
688          * Also populate it with the City's production slot that is now
689          * producing the new Army unit type.  Lastly, populate the Action_Buy 
690          * with the new Army unit type being produced.
691          */
692         //! Populate the action with pertinent data.
693         bool fillData(City* c, int slot, const ArmyProto *prod);
694
695         guint32 getCityId() const {return d_city;};
696         int getProductionSlot() const {return d_slot;};
697         int getBoughtArmyTypeId() const {return d_prod;};
698         private:
699         guint32 d_city;
700         int d_slot, d_prod;
701 };
702
703 //-----------------------------------------------------------------------------
704
705 //! A temporary record of a change in production strategy in a City.
706 /**
707  * The purpose of the Action_Production class is to record when the Player
708  * changes the production of new Army units within a City.  The idea here
709  * is that the City has a set of available Army units that it may produce,
710  * and the Player has selected a different Army unit to produce, or has
711  * stopped production of new Army units altogether.
712  */
713 class Action_Production : public Action
714 {
715     public:
716         //! Make a new city change production action.
717         Action_Production();
718         //! Copy constructor
719         Action_Production (const Action_Production &action);
720         //! Load a new city change production action from a saved-game file.
721         Action_Production(XML_Helper* helper);
722         //! Destroy a city change production action.
723         ~Action_Production();
724
725         //! Return some debug information about this action.
726         std::string dump() const;
727
728         //! Save this city change production action to a saved-game file.
729         virtual bool doSave(XML_Helper* helper) const;
730
731         /**
732          * Populate the Action_Production with City where the change
733          * in production has taken place.  Also populate it with the newly
734          * active production slot (-1 means stopped).
735          */
736         //! Populate the action with pertinent data.
737         bool fillData(City* c, int slot);
738
739         guint32 getCityId() const {return d_city;};
740         int getSlot() const {return d_prod;};
741
742         private:
743         guint32 d_city;
744         int d_prod;
745 };
746
747 //-----------------------------------------------------------------------------
748
749 //! A temporary record of a Player or Stack getting a Reward.
750 /**
751  * The purpose of the Action_Reward class is to record when the Player
752  * has been given a Reward.
753  * It could be that the player has been given: Some gold pieces, a map that 
754  * makes more of the map visible or information about the location of a new
755  * ruin.  It could also be that the player's active stack has been given
756  * a number of allies.  It could also be that the Player's active Stack
757  * contains a Hero, and the Reward is an Item for the Hero to carry.
758  */
759 class Action_Reward : public Action
760 {
761     public:
762         //! Make a new player rewarded action.
763         Action_Reward();
764         //! Copy constructor
765         Action_Reward (const Action_Reward &action);
766         //! Load a new player rewarded action from a saved-game file.
767         Action_Reward(XML_Helper* helper);
768         //! Destroy a player rewarded action.
769         ~Action_Reward();
770         
771         //! Return some debug information about this action.
772         std::string dump() const;
773
774         //! Save this player rewarded action to a saved-game file.
775         virtual bool doSave(XML_Helper* helper) const;
776
777         //! Populate the Action_Reward with a Reward.
778         bool fillData (Stack *stack, Reward *r);
779     
780
781         Reward *getReward() const {return d_reward;};
782         guint32 getStackId() const {return d_stack;};
783
784         private:
785         Reward *d_reward;
786         guint32 d_stack;
787
788         bool load(std::string tag, XML_Helper *helper);
789         
790 };
791
792 //-----------------------------------------------------------------------------
793
794 //! A temporary record of a Hero initiating a new Quest.
795 /**
796  * The purpose of the Action_Quest class is to record when a Player's
797  * Hero has gone to a Temple and initiated a new Quest.
798  */
799 class Action_Quest : public Action
800 {
801     public:
802         //! Make a new hero quest assigned action.
803         Action_Quest();
804         //! Copy constructor
805         Action_Quest (const Action_Quest &action);
806         //! Load a new hero quest assigned action from a saved-game file.
807         Action_Quest(XML_Helper* helper);
808         //! Destroy a hero quest assigned action.
809         ~Action_Quest();
810
811         //! Return some debug information about this action.
812         std::string dump() const;
813
814         //! Save this hero quest assigned action to a saved-game file.
815         virtual bool doSave(XML_Helper* helper) const;
816
817         //! Populate the Action_Quest with a Quest.
818         bool fillData(Quest* q);
819
820         guint32 getHeroId() const {return d_hero;};
821         guint32 getQuestType() const {return d_questtype;};
822         guint32 getData() const {return d_data;};
823         guint32 getVictimPlayerId() const {return d_victim_player;};
824
825         private:
826         guint32 d_hero;
827         guint32 d_questtype;
828         guint32 d_data;
829         guint32 d_victim_player; //victim player, only KILLARMIES uses this
830 };
831
832 //-----------------------------------------------------------------------------
833
834 //! A temporary record of a Hero picking up or dropping an Item.
835 /**
836  * The purpose of the Action_Equip class is to record when a Player's Hero
837  * has picked up an Item or dropped it onto the ground.  Heroes pick up
838  * and drop Items one at a time.
839  */
840 class Action_Equip : public Action
841 {
842     public:
843         enum Slot {
844             // The Item is going neither to the ground or the backpack.
845             NONE = 0,
846             //! The Item has gone into the Hero's Backpack.
847             BACKPACK = 1,
848             //! The Item has been dropped onto the ground.
849             GROUND = 2};
850         
851         //! Make a new item equipped action.
852         Action_Equip();
853         //! Copy constructor
854         Action_Equip (const Action_Equip &action);
855         //! Load a new item equipped action from an opened saved-game file.
856         Action_Equip(XML_Helper* helper);
857         //! Destroy an item equipped action.
858         ~Action_Equip();
859
860         //! Return some debug information about this action.
861         std::string dump() const;
862
863         //! Save this item equipped action to an opened saved-game file.
864         virtual bool doSave(XML_Helper* helper) const;
865
866         /**
867          * Populate the Action_Equip class with the Id of the Hero,
868          * the Id of the Item and the destination of the Item in terms of
869          * it's Action_Equip::Slot.
870          */
871         //! Populate the action with pertinent data.
872         bool fillData(Hero *hero, Item *item, Slot slot, Vector<int> pos);
873
874         guint32 getHeroId() const {return d_hero;};
875         guint32 getItemId() const {return d_item;};
876         guint32 getToBackpackOrToGround() const {return d_slot;};
877         Vector<int> getItemPos() const {return d_pos;};
878
879         private:
880         guint32 d_hero;
881         guint32 d_item;
882         guint32 d_slot;
883         Vector<int> d_pos;
884 };
885
886 //-----------------------------------------------------------------------------
887
888 //! A temporary record of a Hero gaining a new level.
889 /**
890  * The purpose of the Action_Level class is to record when a Player's Hero
891  * advances a level and subsequently gains a stat.
892  * Stats that may get increased are: Strength, Moves, and Sight (for use on 
893  * a hidden map).
894  */
895 class Action_Level : public Action
896 {
897     public:
898         //! Make a new level advancement action.
899         Action_Level();
900         //! Copy constructor
901         Action_Level (const Action_Level &action);
902         //! Load a new level advancement action from an opened saved-game file.
903         Action_Level(XML_Helper* helper);
904         //! Destroy a level advancement action.
905         ~Action_Level();
906
907         //! Return some debug information about this action.
908         std::string dump() const;
909
910         //! Save this level advancement action to an opened saved-game file.
911         virtual bool doSave(XML_Helper* helper) const;
912
913         /**
914          * Populate the Action_Level class with the the Id of the Hero
915          * Army unit, and also the Hero's stat that has been raised as a
916          * result of the level advancement.
917          */
918         //! Populate the action with pertinent data.
919         bool fillData(Army *unit, Army::Stat raised);
920
921         guint32 getArmyId() const {return d_army;};
922         guint32 getStatToIncrease() const {return d_stat;};
923
924         private:
925         guint32 d_army;
926         guint32 d_stat;
927 };
928
929 //-----------------------------------------------------------------------------
930
931 //! A temporary record of a Player changing the contents of a Signpost.
932 /**
933  * The purpose of the Action_ModifySignpost is to record when a Signpost
934  * has been altered by a player to have a different message on it.  The
935  * idea here is that we're playing on a hidden map and a Player wants to
936  * thwart an opponent by changing what signs say before he can read them.
937  */
938 class Action_ModifySignpost: public Action
939 {
940     public:
941         //! Make a new change signpost action.
942         Action_ModifySignpost();
943         //! Copy constructor
944         Action_ModifySignpost(const Action_ModifySignpost &action);
945         //! Load a new change signpost action from an opened saved-game file.
946         Action_ModifySignpost(XML_Helper* helper);
947         //! Destroy a change signpost action.
948         ~Action_ModifySignpost();
949
950         //! Return some debug information about this action.
951         std::string dump() const;
952
953         //! Save this change signpost action to an opened saved-game file.
954         virtual bool doSave(XML_Helper* helper) const;
955
956         //! Populate the action with the signpost and the new message.
957         bool fillData(Signpost * s, std::string message);
958     
959         guint32 getSignpostId() const {return d_signpost;};
960         std::string getSignContents() const {return d_message;};
961
962         private:
963         guint32 d_signpost;
964         std::string d_message;
965 };
966
967 //-----------------------------------------------------------------------------
968
969 //! A temporary record of a Player changing the name of a City.
970 /**
971  * The purpose of the Action_RenameCity class is to record when a Player has
972  * changed the name of a City.  The idea here is that a Player wants
973  * to gloat by renaming a newly conquered City.
974  */
975 class Action_RenameCity: public Action
976 {
977     public:
978         //! Make a new city rename action.
979         Action_RenameCity();
980         //! Copy constructor
981         Action_RenameCity(const Action_RenameCity &action);
982         //! Load a new city rename action from an opened saved-game file.
983         Action_RenameCity(XML_Helper* helper);
984         //! Destroy a city rename action.
985         ~Action_RenameCity();
986
987         //! Return some debug information about this action.
988         std::string dump() const;
989
990         //! Save this city rename action to an opened saved-game file.
991         virtual bool doSave(XML_Helper* helper) const;
992
993         //! Populate the action with the city being renamed and the new name.
994         bool fillData(City *c, std::string name);
995     
996         guint32 getCityId() const {return d_city;};
997         std::string getNewCityName() const {return d_name;};
998         private:
999         guint32 d_city;
1000         std::string d_name;
1001 };
1002
1003 //-----------------------------------------------------------------------------
1004
1005 //! A temporary record of a Player changing vectoring strategies for a City.
1006 /**
1007  * The purpose of the Action_Vector class is to record when a Player has
1008  * changed the vectoring policy of a City.  The City's Army units can
1009  * be vectored to another City or to a Hero's planted standard (Item).
1010  * When units are vectored they take 2 turns to appear at their destination.
1011  * While the vectored units are en route, they are invisible.
1012  */
1013 class Action_Vector: public Action
1014 {
1015     public:
1016         //! Make a new city vector action.
1017         Action_Vector();
1018         //! Copy constructor
1019         Action_Vector(const Action_Vector &action);
1020         //! Load a new city vector action from an opened saved-game file.
1021         Action_Vector(XML_Helper* helper);
1022         //! Destroy a city vector action.
1023         ~Action_Vector();
1024
1025         //! Return some debug information about this action.
1026         std::string dump() const;
1027
1028         //! Save this city vector action to an opened saved-game file.
1029         virtual bool doSave(XML_Helper* helper) const;
1030
1031         /**
1032          * Populate the Action_Vector class with the City being vectored
1033          * from, and the destination position for the vectored units.
1034          */
1035         //! Populate the action with pertinent data.
1036         bool fillData(City* src, Vector <int> dest);
1037     
1038         guint32 getCityId() const {return d_city;};
1039         Vector<int> getVectoringDestination() const {return d_dest;};
1040
1041         private:
1042         guint32 d_city;
1043         Vector<int> d_dest;
1044 };
1045
1046 //-----------------------------------------------------------------------------
1047
1048 //! A temporary record of a Player changing the fight order of an Armyset.
1049 /**
1050  * The purpose of the Action_FightOrder action is to record when a Player
1051  * changes the order in which Army units fight in battle.
1052  */
1053 class Action_FightOrder: public Action
1054 {
1055     public:
1056         //! Make a new fight order action.
1057         Action_FightOrder();
1058         //! Copy constructor
1059         Action_FightOrder(const Action_FightOrder &action);
1060         //! Load a new fight order action from an opened saved-game file.
1061         Action_FightOrder(XML_Helper* helper);
1062         //! Destroy a fight order action.
1063         ~Action_FightOrder();
1064
1065         //! Return some debug information about this action.
1066         std::string dump() const;
1067
1068         //! Save this fight order action to an opened saved-game file.
1069         virtual bool doSave(XML_Helper* helper) const;
1070
1071         //! Populate the action with a list of ranks, one per Army unit type.
1072         bool fillData(std::list<guint32> order);
1073     
1074         std::list<guint32> getFightOrder() const {return d_order;};
1075
1076         private:
1077         std::list<guint32> d_order;
1078 };
1079
1080 //-----------------------------------------------------------------------------
1081
1082 //! A temporary record of a Player surrendering.
1083 /**
1084  * The purpose of the Action_Resign class is to record when a Player has
1085  * resigned from the game.  Because these actions are held in a Player's
1086  * Actionlist, we do not have to store the player's Id.
1087  */
1088 class Action_Resign: public Action
1089 {
1090     public:
1091         //! Make a new player resignation action.
1092         Action_Resign();
1093         //! Copy constructor
1094         Action_Resign(const Action_Resign &action);
1095         //! Load a new player resignation action from an opened saved-game file.
1096         Action_Resign(XML_Helper* helper);
1097         //! Destroy a player resignation action.
1098         ~Action_Resign();
1099
1100         //! Return some debug information about this action.
1101         std::string dump() const;
1102
1103         //! Save this player resignation action to an opened saved-game file.
1104         virtual bool doSave(XML_Helper* helper) const;
1105
1106         //! This method doesn't need to be called for Action_Resign actions.
1107         bool fillData();
1108 };
1109
1110 //-----------------------------------------------------------------------------
1111
1112 //! A temporary record of a Hero planting a standard into the ground.
1113 /**
1114  * The purpose of the Action_Plant class is to record when a Hero has 
1115  * planted a standard (e.g. a flag Item) into the ground, so that Army units
1116  * can be vectored there.
1117  */
1118 class Action_Plant: public Action
1119 {
1120     public:
1121         //! Make a new item planted action.
1122         Action_Plant();
1123         //! Copy constructor
1124         Action_Plant(const Action_Plant &action);
1125         //! Load a new item planted action from an opened saved-game file.
1126         Action_Plant(XML_Helper* helper);
1127         //! Destroy a item planted action.
1128         ~Action_Plant();
1129
1130         //! Return some debug information about this action.
1131         std::string dump() const;
1132
1133         //! Save this item planted action to an opened saved-game file.
1134         virtual bool doSave(XML_Helper* helper) const;
1135
1136         //! Populate the action with the Id of the Hero and the Id of the Item.
1137         bool fillData(Hero *hero, Item *item);
1138
1139         guint32 getHeroId() const {return d_hero;};
1140         guint32 getItemId() const {return d_item;};
1141
1142         private:
1143         guint32 d_hero;
1144         guint32 d_item;
1145 };
1146
1147 //-----------------------------------------------------------------------------
1148
1149 //! A temporary record of a new Army unit showing up at a city.
1150 /**
1151  * The purpose of the Action_Produce class is to record when a new Army unit
1152  * is created.  The idea here is that a City has produced a new Army unit.
1153  * The City might be vectoring elsewhere, so the unit doesn't show up in the
1154  * City that produced it.  If vectoring is not enabled the Army unit shows
1155  * up right away in the host City.
1156  * This action is used primarily for reporting purposes.  The player's 
1157  * production report shows which army units were created in what cities.
1158  * The army unit is taken from the Player's Armyset.
1159  */
1160 class Action_Produce: public Action
1161 {
1162     public:
1163         //! Make a new unit produced action.
1164         Action_Produce();
1165         //! Copy constructor
1166         Action_Produce(const Action_Produce &action);
1167         //! Load a new unit produced action from an opened saved-game file.
1168         Action_Produce(XML_Helper* helper);
1169         //! Destroy a unit produced action.
1170         ~Action_Produce();
1171
1172         //! Return some debug information about this action.
1173         std::string dump() const;
1174
1175         //! Save this unit produced action to an opened saved-game file.
1176         virtual bool doSave(XML_Helper* helper) const;
1177
1178         /**
1179          * Populate the Action_Produce action with the army type being
1180          * produced, the City in which it has arrived, and also whether
1181          * or not this unit was prevented from showing up here because
1182          * it is being vectored elsewhere.
1183          *
1184          * pos is the vectored location if we're vectoring
1185          * or it's the position on the map where the newly produced army ended 
1186          * up.
1187          */
1188         //! Populate the action with pertinent data.
1189         bool fillData(const ArmyProdBase *a, City *city, bool vectored, Vector<int> pos, guint32 army_id);
1190
1191         //! Get the production details of the army that was produced.
1192         ArmyProdBase * getArmy() const {return d_army;}
1193
1194         //! Get the Id of the City that produced the Army unit.
1195         guint32 getCityId() const {return d_city;}
1196
1197         //! Get whether or not the Army unit is being vectored elsewhere.
1198         bool getVectored() const {return d_vectored;}
1199
1200         //! Get where this army ends up on the map.
1201         Vector<int> getDestination() const {return d_dest;}
1202
1203         //! Get the id of the army instance that was created.
1204         guint32 getArmyId() const {return d_army_id;}
1205     private:
1206         ArmyProdBase *d_army;
1207         guint32 d_city;
1208         bool d_vectored;
1209         Vector<int> d_dest;
1210         guint32 d_army_id;
1211
1212         bool load(std::string tag, XML_Helper *helper);
1213 };
1214
1215         
1216 //-----------------------------------------------------------------------------
1217
1218 //! A temporary record of a vectored Army unit showing up at a city.
1219 /**
1220  * The purpose of the Action_ProduceVectored class is to record when a new
1221  * vectored Army unit arrives at it's destination.  The idea here is that
1222  * two turns have passed since a unit was vectored, and now the unit has
1223  * shown up.
1224  * This action is used primarily for reporting purposes.  The player's 
1225  * production report shows which vectored army units arrived in what cities.
1226  * The army unit is taken from the Player's Armyset.
1227  */
1228 class Action_ProduceVectored: public Action
1229 {
1230     public:
1231         //! Make a new vector arrival action.
1232         Action_ProduceVectored();
1233         //! Copy constructor
1234         Action_ProduceVectored(const Action_ProduceVectored &action);
1235         //! Load a new vector arrival action from an opened saved-game file.
1236         Action_ProduceVectored(XML_Helper* helper);
1237         //! Destroy a vector arrival action.
1238         ~Action_ProduceVectored();
1239
1240         //! Return some debug information about this action.
1241         std::string dump() const;
1242
1243         //! Save this vector arrival action to an opened saved-game file.
1244         virtual bool doSave(XML_Helper* helper) const;
1245
1246         /**
1247          * Populate the Action_ProduceVectored with the Id of the army
1248          * unit type being produced, and the position on the map where
1249          * it has showing up.
1250          */
1251         //! Populate the action with pertinent data.
1252         bool fillData(ArmyProdBase *army, Vector <int> dest, Vector<int> src);
1253
1254         //! Get the army type Id that has shown up.
1255         ArmyProdBase *getArmy() const {return d_army;};
1256
1257         //! Get the position on the map where the army showed up.
1258         Vector<int> getDestination() const {return d_dest;}
1259
1260         //! Get the position on the map where the army is coming from.
1261         Vector<int> getOrigination() const {return d_src;}
1262     private:
1263         ArmyProdBase *d_army;
1264         Vector<int> d_dest;
1265         Vector<int> d_src;
1266         bool load(std::string tag, XML_Helper *helper);
1267 };
1268
1269 //-----------------------------------------------------------------------------
1270
1271 //! A temporary record of the diplomatic state changing.
1272 /**
1273  * The purpose of the Action_DiplomacyState action is to record our
1274  * diplomatic state with other players has it changes.  The idea here is 
1275  * that every player has a diplomatic status with every other player.
1276  * Although we might propose war on a given turn, we would achieve the
1277  * state of being at war on a later turn.
1278  */
1279 class Action_DiplomacyState: public Action
1280 {
1281     public:
1282         //! Make a new diplomatic state action.
1283         Action_DiplomacyState();
1284         //! Copy constructor
1285         Action_DiplomacyState(const Action_DiplomacyState &action);
1286         //! Load a new diplomatic state action from an opened saved-game file.
1287         Action_DiplomacyState(XML_Helper* helper);
1288         //! Destroy a diplomatic state action.
1289         ~Action_DiplomacyState();
1290
1291         //! Return some debug information about this action.
1292         std::string dump() const;
1293
1294         //! Save this diplomatic state action to an opened saved-game file.
1295         virtual bool doSave(XML_Helper* helper) const;
1296
1297         /**
1298          * Populate the Action_DiplomacyState class with the Player for
1299          * which we are in a state with.  Also populate the action with
1300          * the new diplomatic state.
1301          */
1302         //! Populate action with pertinent data.
1303         bool fillData(Player *player, Player::DiplomaticState state);
1304
1305         //! Get the Id of the Player that we have entered a new state for.
1306         guint32 getOpponentId() const {return d_opponent_id;}
1307
1308         //! Get the state that we're in with the other Player.
1309         Player::DiplomaticState getDiplomaticState() const
1310           {return d_diplomatic_state;};
1311     private:
1312         guint32 d_opponent_id;
1313         Player::DiplomaticState d_diplomatic_state;
1314 };
1315
1316 //-----------------------------------------------------------------------------
1317
1318 //! A temporary record of a diplomatic proposal.
1319 /**
1320  * The purpose of the Action_DiplomacyProposal action is to record our
1321  * diplomatic proposals to other players.  The idea here is that the player
1322  * wishes to go to war with another Player and so offers/proposes war to a 
1323  * prospective enemy.
1324  */
1325 class Action_DiplomacyProposal: public Action
1326 {
1327     public:
1328         //! Make a new diplomatic proposal action.
1329         Action_DiplomacyProposal();
1330         //! Copy constructor
1331         Action_DiplomacyProposal(const Action_DiplomacyProposal &action);
1332         //! Load a new diplomatic proposal action from a saved-game file.
1333         Action_DiplomacyProposal(XML_Helper* helper);
1334         //! Destroy a diplomatic proposal action.
1335         ~Action_DiplomacyProposal();
1336
1337         //! Return some debug information about this action.
1338         std::string dump() const;
1339
1340         //! Save this diplomatic proposal action to an opened saved-game file.
1341         virtual bool doSave(XML_Helper* helper) const;
1342
1343         /**
1344          * Populate the Action_DiplomacyProposal class with the Player for
1345          * which we have a new proposal for.  Also populate the action with
1346          * the new diplomatic proposal.
1347          */
1348         //! Populate action with pertinent data.
1349         bool fillData(Player *player, Player::DiplomaticProposal proposal);
1350
1351         //! Get the Id of the Player that our proposal is for.
1352         guint32 getOpponentId() const {return d_opponent_id;}
1353
1354         //! Get the proposal that we're offering.
1355         Player::DiplomaticProposal getDiplomaticProposal() const
1356           {return d_diplomatic_proposal;};
1357     private:
1358         guint32 d_opponent_id;
1359         Player::DiplomaticProposal d_diplomatic_proposal;
1360 };
1361
1362 //-----------------------------------------------------------------------------
1363
1364 //! A temporary record of the diplomatic score.
1365 /**
1366  * The purpose of the Action_DiplomacyScore is to record when a Player's
1367  * diplomatic opinion of another Player has changed.  The idea here is that
1368  * an enemy player has razed a city and now our opinion of that player
1369  * deteriorates.
1370  */
1371 class Action_DiplomacyScore: public Action
1372 {
1373     public:
1374         //! Make a new diplomatic score action.
1375         Action_DiplomacyScore();
1376         //! Copy constructor.
1377         Action_DiplomacyScore(const Action_DiplomacyScore &action);
1378         //! Load a new diplomatic score action from an opened saved-game file.
1379         Action_DiplomacyScore(XML_Helper* helper);
1380         //! Destroy a diplomatic score action.
1381         ~Action_DiplomacyScore();
1382
1383         //! Return some debug information about this action.
1384         std::string dump() const;
1385
1386         //! Save this diplomatic score action to an opened saved-game file.
1387         virtual bool doSave(XML_Helper* helper) const;
1388
1389         /**
1390          * Populate the Action_DiplomacyScore class with the Player for
1391          * which we have changed our opinion of.  Also populate the action
1392          * with the amount of change for that Player.  The change can be 
1393          * negative, and is added to the existing score to get the new 
1394          * score.
1395          */
1396         //! Populate action with pertinent data.
1397         bool fillData(Player *player, int amount);
1398
1399         //! Get the Id of the Player that our opinion has changed of.
1400         guint32 getOpponentId() const {return d_opponent_id;}
1401
1402         //! Get the amount of the opinion change.
1403         int getAmountChange() const {return d_amount;};
1404     private:
1405         guint32 d_opponent_id;
1406         int d_amount;
1407 };
1408
1409 //-----------------------------------------------------------------------------
1410
1411 class Action_EndTurn: public Action
1412 {
1413     public:
1414         //! Make a new end turn action.
1415         Action_EndTurn();
1416         //! Copy constructor
1417         Action_EndTurn(const Action_EndTurn &action);
1418         //! Load a new end turn action from an opened saved-game file.
1419         Action_EndTurn(XML_Helper* helper);
1420         //! Destroy a end turn action.
1421         ~Action_EndTurn();
1422
1423         //! Return some debug information about this action.
1424         std::string dump() const;
1425
1426         //! Save this action to an opened saved-game file.
1427         virtual bool doSave(XML_Helper* helper) const;
1428 };
1429
1430 //-----------------------------------------------------------------------------
1431
1432 class Action_ConquerCity : public Action
1433 {
1434     public:
1435         //! Make a new city conquer action.
1436         Action_ConquerCity();
1437         //! Copy constructor
1438         Action_ConquerCity(const Action_ConquerCity &action);
1439         //! Load a new city conquer action from an opened saved-game file.
1440         Action_ConquerCity(XML_Helper* helper);
1441         //! Destroy a city conquer action.
1442         ~Action_ConquerCity();
1443
1444         //! Return some debug information about this action.
1445         std::string dump() const;
1446
1447         //! Save this city occupied action to an opened saved-game file.
1448         virtual bool doSave(XML_Helper* helper) const;
1449
1450         //! Populate the action with the City being conquered.
1451         bool fillData (City* c, Stack *s);
1452     
1453         guint32 getCityId() const {return d_city;};
1454         guint32 getStackId() const {return d_stack;};
1455         private:
1456         guint32 d_city, d_stack;
1457 };
1458
1459 //-----------------------------------------------------------------------------
1460
1461 class Action_RecruitHero : public Action
1462 {
1463     public:
1464         //! Make a new recruit hero action.
1465         Action_RecruitHero();
1466         //! Copy a new recruit hero action
1467         Action_RecruitHero(const Action_RecruitHero &action);
1468         //! Load a new recruit hero action from an opened saved-game file.
1469         Action_RecruitHero(XML_Helper* helper);
1470         //! Destroy a recruit hero action.
1471         ~Action_RecruitHero();
1472
1473         //! Return some debug information about this action.
1474         std::string dump() const;
1475
1476         //! Save this city occupied action to an opened saved-game file.
1477         virtual bool doSave(XML_Helper* helper) const;
1478
1479         //! Populate the action.
1480         bool fillData(HeroProto* hero, City *city, int cost, int alliesCount, const ArmyProto *ally);
1481     
1482         HeroProto* getHero() const {return d_hero;};
1483         guint32 getCityId() const {return d_city;};
1484         guint32 getCost() const {return d_cost;};
1485         guint32 getNumAllies() const {return d_allies;};
1486         guint32 getAllyArmyType() const {return d_ally_army_type;};
1487
1488         private:
1489         HeroProto *d_hero;
1490         guint32 d_city, d_cost, d_allies, d_ally_army_type;
1491
1492         bool load(std::string tag, XML_Helper *helper);
1493 };
1494
1495 //-----------------------------------------------------------------------------
1496
1497 class Action_RenamePlayer: public Action
1498 {
1499     public:
1500         //! Make a new rename player action
1501         Action_RenamePlayer();
1502         //! Copy constructor
1503         Action_RenamePlayer(const Action_RenamePlayer &action);
1504         //! Load a new rename player action from an opened saved-game file.
1505         Action_RenamePlayer(XML_Helper* helper);
1506         //! Destroy a rename player action.
1507         ~Action_RenamePlayer();
1508
1509         //! Return some debug information about this action.
1510         std::string dump() const;
1511
1512         //! Save this city occupied action to an opened saved-game file.
1513         virtual bool doSave(XML_Helper* helper) const;
1514
1515         //! Populate the action.
1516         bool fillData(std::string name);
1517     
1518         std::string getName() const {return d_name;};
1519
1520         private:
1521         std::string d_name;
1522 };
1523
1524 //-----------------------------------------------------------------------------
1525
1526 class Action_CityTooPoorToProduce: public Action
1527 {
1528     public:
1529         //! Make a new city-too-poor action
1530         Action_CityTooPoorToProduce();
1531         //! Copy constructor
1532         Action_CityTooPoorToProduce(const Action_CityTooPoorToProduce &action);
1533         //! Load a new too-poor action from an opened saved-game file.
1534         Action_CityTooPoorToProduce(XML_Helper* helper);
1535         //! Destroy a too-poor action.
1536         ~Action_CityTooPoorToProduce();
1537
1538         //! Return some debug information about this action.
1539         std::string dump() const;
1540
1541         //! Save this city occupied action to an opened saved-game file.
1542         virtual bool doSave(XML_Helper* helper) const;
1543
1544         //! Populate the action.
1545         bool fillData(City *city, const ArmyProdBase *army);
1546     
1547         guint32 getCityId() const {return d_city;}
1548         guint32 getArmyType() const {return d_army_type;}
1549
1550         private:
1551         guint32 d_city;
1552         guint32 d_army_type;
1553 };
1554
1555 //-----------------------------------------------------------------------------
1556
1557 class Action_InitTurn: public Action
1558 {
1559     public:
1560         //! Make a new initialize turn action.
1561         Action_InitTurn();
1562         //! Copy constructor
1563         Action_InitTurn(const Action_InitTurn &action);
1564         //! Load a new initialize turn action from an opened saved-game file.
1565         Action_InitTurn(XML_Helper* helper);
1566         //! Destroy a initialize turn action.
1567         ~Action_InitTurn();
1568
1569         //! Return some debug information about this action.
1570         std::string dump() const;
1571
1572         //! Save this action to an opened saved-game file.
1573         virtual bool doSave(XML_Helper* helper) const;
1574 };
1575
1576 //-----------------------------------------------------------------------------
1577
1578 //! A temporary record of what happened when a Player loots a City.
1579 /**
1580  * The purpose of the Action_Loot class is to record when a Player has
1581  * defeated a City and has looted it.  Looting a city results in the
1582  * looting player's coffers gaining some gold pieces while the looted
1583  * player's coffers decrease.
1584  */
1585 class Action_Loot : public Action
1586 {
1587     public:
1588         //! Make a new city looting action.
1589         Action_Loot();
1590         //! Copy constructor
1591         Action_Loot(const Action_Loot &action);
1592         //! Load a new city looting action from an opened saved-game file.
1593         Action_Loot(XML_Helper* helper);
1594         //! Destroy a city looting action.
1595         ~Action_Loot();
1596
1597         //! Return some debug information about this action.
1598         std::string dump() const;
1599
1600         //! Save this city looting action to an opened saved-game file.
1601         virtual bool doSave(XML_Helper* helper) const;
1602
1603         //! Populate the action with the players involved and the amounts.
1604         bool fillData(Player *looter, Player *looted, guint32 amount_to_add,
1605                       guint32 amount_to_subtract);
1606
1607         guint32 getAmountToAdd() const { return d_gold_added;};
1608         guint32 getAmountToSubtract() const { return d_gold_removed;};
1609         guint32 getLootingPlayerId() const {return d_looting_player_id;};
1610         guint32 getLootedPlayerId() const {return d_looted_player_id;};
1611
1612         private:
1613         guint32 d_looting_player_id;
1614         guint32 d_looted_player_id;
1615         guint32 d_gold_added;
1616         guint32 d_gold_removed;
1617 };
1618
1619 #endif //ACTION_H