~ubuntu-branches/ubuntu/raring/lordsawar/raring

« back to all changes in this revision

Viewing changes to src/action.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese, Gonéri Le Bouder
  • Date: 2008-06-17 11:15:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617111526-yjyvu9df50zmpdo0
Tags: 0.0.9-1
[ Barry deFreese ]
* New upstream release.
  + Fixes gcc-4.3 builds so drop ftbfs_gcc-4.3_fix.diff.
  + Add new build-dependency for libgnet-dev.
* Add simple man page for new lordsawar-tile-editor.
* Add desktop file for lordsawar-tile-editor.
* Remove French translation on install.

[ Gonéri Le Bouder ]
* bump Debian Policy to 3.8.0. No change needed.
* fix wording in the 0.0.8-3 entry of the Debian changelog

Show diffs side-by-side

added added

removed removed

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