~ubuntu-branches/ubuntu/trusty/lordsawar/trusty

« back to all changes in this revision

Viewing changes to src/history.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2008-06-17 16:07:00 UTC
  • mto: (5.1.1 lenny) (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20080617160700-6d8ofoz0qkasxlnw
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Copyright (C) 2007, 2008 Ben Asselstine
 
2
//
1
3
//  This program is free software; you can redistribute it and/or modify
2
4
//  it under the terms of the GNU General Public License as published by
3
5
//  the Free Software Foundation; either version 2 of the License, or
10
12
//
11
13
//  You should have received a copy of the GNU General Public License
12
14
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
16
//  02110-1301, USA.
14
17
 
15
18
#ifndef HISTORY_H
16
19
#define HISTORY_H
17
20
 
18
21
#include <string>
 
22
#include "Ownable.h"
19
23
#include "vector.h"
20
24
#include <sigc++/trackable.h>
21
25
 
24
28
class Hero;
25
29
class City;
26
30
#include "army.h"
27
 
/** The purpose of the past event classes is to keep track about what a 
28
 
  *  player has accomplished.  This list is retained for the duration of 
29
 
  *  the game.
30
 
  * 
31
 
  * Each history item is derived from the abstract History class. It has to
32
 
  * contain three functions:
33
 
  *
34
 
  * - A loading constructor (which takes an XML_Helper parameter)
35
 
  * - a save function which saves the data
36
 
  * - a fillData function which takes some parameters and with these stores the
37
 
  *   data about what happened.
38
 
  */
39
 
 
40
 
 
41
 
class History
 
31
 
 
32
//! A permanent record of an accomplishment during gameplay.
 
33
/** 
 
34
 * The purpose of the history classes is to keep track about what a 
 
35
 *  player has accomplished.  This list is retained for the duration of 
 
36
 *  the game.
 
37
 * 
 
38
 * Each history item is derived from the abstract History class. It has to
 
39
 * contain three functions; A loading constructor (which takes an XML_Helper 
 
40
 * parameter), a save function which saves the data, a fillData function 
 
41
 * which takes some parameters and with these stores the data about what 
 
42
 * happened.
 
43
 *
 
44
 */
 
45
class History: public Ownable
42
46
{
43
47
    public:
 
48
        //! A History can be one of the following kinds.
44
49
        enum Type {
45
 
                START_TURN = 1,
46
 
                FOUND_SAGE = 2,
47
 
                GOLD_TOTAL = 3,
48
 
                HERO_EMERGES = 4,
49
 
                CITY_WON = 5,
50
 
                CITY_RAZED = 6,
51
 
                HERO_QUEST_STARTED = 7,
52
 
                HERO_QUEST_COMPLETED = 8,
53
 
                HERO_KILLED_IN_CITY = 9,
54
 
                HERO_KILLED_IN_BATTLE = 10,
55
 
                HERO_KILLED_SEARCHING = 11,
56
 
                HERO_CITY_WON = 12,
57
 
                SCORE = 13,
58
 
                PLAYER_VANQUISHED = 14,
59
 
                DIPLOMATIC_PEACE = 15,
60
 
                DIPLOMATIC_WAR = 16,
61
 
                DIPLOMATIC_TREACHERY = 17,
62
 
                HERO_FINDS_ALLIES = 18
 
50
          //! The player started a turn.
 
51
          START_TURN = 1,
 
52
          //! The player has searched a Ruin and found a sage.
 
53
          FOUND_SAGE = 2,
 
54
          //! The player has accrued a certain amount of gold in the treasury.
 
55
          GOLD_TOTAL = 3,
 
56
          //! A hero has emerged.
 
57
          HERO_EMERGES = 4,
 
58
          //! A City has been taken.
 
59
          CITY_WON = 5,
 
60
          //! A City has been razed.
 
61
          CITY_RAZED = 6,
 
62
          //! A Hero has inititiated a Quest.
 
63
          HERO_QUEST_STARTED = 7,
 
64
          //! A Hero has completed a Quest.
 
65
          HERO_QUEST_COMPLETED = 8,
 
66
          //! A Hero was killed in battle at a City.
 
67
          HERO_KILLED_IN_CITY = 9,
 
68
          //! A Hero was killed in battle in the field.
 
69
          HERO_KILLED_IN_BATTLE = 10,
 
70
          //! A Hero was killed searching a Ruin.
 
71
          HERO_KILLED_SEARCHING = 11,
 
72
          //! A Hero was involved in taking a City.
 
73
          HERO_CITY_WON = 12,
 
74
          //! The player has this score.
 
75
          SCORE = 13,
 
76
          //! The player has been utterly defeated.
 
77
          PLAYER_VANQUISHED = 14,
 
78
          //! The player has achieved peace with an opponent.
 
79
          DIPLOMATIC_PEACE = 15,
 
80
          //! The player has started a war with an opponent.
 
81
          DIPLOMATIC_WAR = 16,
 
82
          //! The player has been treacherous towards an opponent.
 
83
          DIPLOMATIC_TREACHERY = 17,
 
84
          //! A Hero finds some powerful allies.
 
85
          HERO_FINDS_ALLIES = 18
63
86
        };
64
87
                
65
 
        
 
88
        //! Default constructor.
66
89
        History(Type type);
 
90
 
 
91
        //! Destructor.
67
92
        virtual ~History();
68
93
 
69
94
        //! Returns debug information. Needs to be overwritten by derivatives
72
97
        //! Save function. See XML_Helper for information about saving.
73
98
        virtual bool save(XML_Helper* helper) const = 0;
74
99
        
75
 
        /** static load function (see XML_Helper)
76
 
          * 
77
 
          * Whenever an action item is loaded, this function is called. It
78
 
          * examines the stored id and calls the constructor of the appropriate
79
 
          * action class.
80
 
          *
81
 
          * @param helper       the XML_Helper instance for the savegame
82
 
          */
 
100
        /** 
 
101
         * static load function (see XML_Helper)
 
102
         * 
 
103
         * Whenever a History item is loaded, this function is called. It
 
104
         * examines the stored History::Type and calls the constructor of 
 
105
         * the appropriate History class.
 
106
         *
 
107
         * @param helper       The opened saved-game file to read from.
 
108
         */
 
109
        //! Load a History from an opened saved-game file.
83
110
        static History* handle_load(XML_Helper* helper);
84
111
 
85
 
        //! Copies an action to a new one
 
112
        //! Copies a history into a new one.
86
113
        static History* copy(const History* a);
87
114
 
88
 
        //! Returns the id which identifies the type of past event
 
115
        //! Returns the id which identifies the type of History event.
89
116
        Type getType() const {return d_type;}
90
117
        
91
 
        Player * getPlayer() const {return d_player;}
92
 
        void setPlayer(Player *player) {d_player = player;}
93
 
 
94
118
    protected:
95
119
        Type d_type;
96
 
        Player *d_player; //this doesn't get saved on purpose!
97
120
};
98
121
 
99
122
//-----------------------------------------------------------------------------
100
123
 
 
124
//! A permanent record of a player starting a turn.
101
125
class History_StartTurn : public History
102
126
{
103
127
    public:
 
128
        //! Default constructor.
104
129
        History_StartTurn();
 
130
        //! Copy constructor.
 
131
        History_StartTurn(const History_StartTurn &history);
 
132
        //! Load the historical event from an opened saved-game file.
105
133
        History_StartTurn(XML_Helper* helper);
 
134
        //! Destructor.
106
135
        ~History_StartTurn();
107
136
 
 
137
        //! Return some debug information about this historical event.
108
138
        std::string dump() const;
 
139
 
 
140
        //! Save the historical event to an opened saved-game file.
109
141
        bool save(XML_Helper* helper) const;
110
142
 
 
143
        //! This method doesn't need to be called for History_StartTurn.
111
144
        bool fillData();
112
145
    
113
146
    private:
115
148
 
116
149
//-----------------------------------------------------------------------------
117
150
 
 
151
//! A permanent record of a Hero searching a Ruin and finding a sage.
118
152
class History_FoundSage : public History
119
153
{
120
154
    public:
 
155
        //! Default constructor.
121
156
        History_FoundSage();
 
157
        //! Copy constructor.
 
158
        History_FoundSage(const History_FoundSage &history);
 
159
        //! Load the historical event from an opened saved-game file.
122
160
        History_FoundSage(XML_Helper* helper);
 
161
        //! Destructor.
123
162
        ~History_FoundSage();
124
163
 
 
164
        //! Return some debug information about this historical event.
125
165
        std::string dump() const;
 
166
 
 
167
        //! Save the historical event to an opened saved-game file.
126
168
        bool save(XML_Helper* helper) const;
127
169
 
 
170
        //! Populate the event with the Hero who found the sage.
128
171
        bool fillData(Hero *hero);
 
172
 
 
173
        //! Get the name of the Hero who found the sage.
129
174
        std::string getHeroName() const {return d_hero;}
130
175
    
131
176
    private:
 
177
        //! The name of the Hero.
132
178
        std::string d_hero;
133
179
};
134
180
 
135
181
//-----------------------------------------------------------------------------
136
182
 
 
183
//! A permanent record of the amount of gold pieces a player has.
137
184
class History_GoldTotal : public History
138
185
{
139
186
    public:
 
187
        //! Default constructor.
140
188
        History_GoldTotal();
 
189
        //! Copy constructor.
 
190
        History_GoldTotal(const History_GoldTotal &history);
 
191
        //! Load the historical event from an opened saved-game file.
141
192
        History_GoldTotal(XML_Helper* helper);
 
193
        //! Destructor.
142
194
        ~History_GoldTotal();
143
195
 
 
196
        //! Return some debug information about this historical event.
144
197
        std::string dump() const;
 
198
 
 
199
        //! Save the historical event to an opened saved-game file.
145
200
        bool save(XML_Helper* helper) const;
146
201
 
 
202
        //! Populate the event with the amount of gold pieces the Player has.
147
203
        bool fillData(int gold);
 
204
 
 
205
        //! Get the amount of gold associated with this event.
148
206
        int getGold() const {return d_gold;}
149
207
    
150
208
    private:
 
209
        //! The amount of gold pieces the player has at a point in time.
151
210
        int d_gold;
152
211
};
153
212
 
154
213
//-----------------------------------------------------------------------------
155
214
 
 
215
//! A permanent record of a new Hero emerging in a City.
156
216
class History_HeroEmerges : public History
157
217
{
158
218
    public:
 
219
        //! Default constructor.
159
220
        History_HeroEmerges();
 
221
        //! Copy constructor.
 
222
        History_HeroEmerges(const History_HeroEmerges &history);
 
223
        //! Load the historical event from an opened saved-game file.
160
224
        History_HeroEmerges(XML_Helper* helper);
 
225
        //! Destructor.
161
226
        ~History_HeroEmerges();
162
227
 
 
228
        //! Return some debug information about this historical event.
163
229
        std::string dump() const;
 
230
 
 
231
        //! Save the historical event to an opened saved-game file.
164
232
        bool save(XML_Helper* helper) const;
165
233
 
 
234
        //! Populate the event with pertinent data.
 
235
        /**
 
236
         * Populate the event with the new Hero who has showed up and 
 
237
         * the City where it has appeared.
 
238
         *
 
239
         * @param hero    The Hero that has emergerd.
 
240
         * @param city    The City where the Hero has emerged.
 
241
         */
166
242
        bool fillData(Hero *hero, City *city);
 
243
 
 
244
        //! Get the name of the Hero who appeared.
167
245
        std::string getHeroName() const {return d_hero;}
 
246
 
 
247
        //! Get the name of the City where the Hero has emerged.
168
248
        std::string getCityName() const {return d_city;}
169
249
    
170
250
    private:
 
251
        //! The name of the Hero who emerged.
171
252
        std::string d_hero;
 
253
 
 
254
        //! The name of the City where the Hero emerged.
172
255
        std::string d_city;
173
256
};
174
257
 
175
258
//-----------------------------------------------------------------------------
176
259
 
 
260
//! A permanent record of an enemy city being defeated.
177
261
class History_CityWon : public History
178
262
{
179
263
    public:
 
264
        //! Default constructor.
180
265
        History_CityWon();
 
266
        //! Copy constructor.
 
267
        History_CityWon(const History_CityWon &history);
 
268
        //! Load the historical event from an opened saved-game file.
181
269
        History_CityWon(XML_Helper* helper);
 
270
        //! Destructor.
182
271
        ~History_CityWon();
183
272
 
 
273
        //! Return some debug information about this historical event.
184
274
        std::string dump() const;
 
275
 
 
276
        //! Save the historical event to an opened saved-game file.
185
277
        bool save(XML_Helper* helper) const;
186
278
 
187
 
 
 
279
        //! Populate the record with the City that the Player defeated.
188
280
        bool fillData(City *city);
 
281
 
 
282
        //! Get the Id of the City object that was defeated.
189
283
        Uint32 getCityId() const {return d_city;}
190
284
    
191
285
    private:
 
286
        //! The Id of the City object that was defeated.
192
287
        Uint32 d_city;
193
288
};
194
289
 
195
290
//-----------------------------------------------------------------------------
196
291
 
 
292
//! A permanent record of an enemy city being defeated by a Hero.
197
293
class History_HeroCityWon: public History
198
294
{
199
295
    public:
 
296
        //! Default constructor.
200
297
        History_HeroCityWon();
 
298
        //! Copy constructor.
 
299
        History_HeroCityWon(const History_HeroCityWon &history);
 
300
        //! Load the historical event from an opened saved-game file.
201
301
        History_HeroCityWon(XML_Helper* helper);
 
302
        //! Destructor.
202
303
        ~History_HeroCityWon();
203
304
 
 
305
        //! Return some debug information about this historical event.
204
306
        std::string dump() const;
 
307
 
 
308
        //! Save the historical event to an opened saved-game file.
205
309
        bool save(XML_Helper* helper) const;
206
310
 
 
311
        //! Populate the event with pertinent data.
 
312
        /**
 
313
         * Populate the event with the City that was defeated and the
 
314
         * Hero that assisted in the conquering.
 
315
         *
 
316
         * @param city    The City that was conquered.
 
317
         * @param hero    The Hero who lead the conquering of the City.
 
318
         */
207
319
        bool fillData(Hero *hero, City *city);
 
320
 
 
321
        //! Get the name of the Hero who conquered the City.
208
322
        std::string getHeroName() const {return d_hero;}
 
323
 
 
324
        //! Get the name of the City that was conquered.
209
325
        std::string getCityName() const {return d_city;}
210
326
    
211
327
    private:
 
328
        //! The name of the Hero who helped in conquering the City.
212
329
        std::string d_hero;
 
330
 
 
331
        //! The name of the City that was conquered.
213
332
        std::string d_city;
214
333
};
215
334
 
216
335
//-----------------------------------------------------------------------------
217
336
 
 
337
//! A permanent record of an enemy city being razed.
218
338
class History_CityRazed : public History
219
339
{
220
340
    public:
 
341
        //! Default constructor.
221
342
        History_CityRazed();
 
343
        //! Copy constructor.
 
344
        History_CityRazed(const History_CityRazed &history);
 
345
        //! Load the historical event from an opened saved-game file.
222
346
        History_CityRazed(XML_Helper* helper);
 
347
        //! Destructor.
223
348
        ~History_CityRazed();
224
349
 
 
350
        //! Return some debug information about this historical event.
225
351
        std::string dump() const;
 
352
 
 
353
        //! Save the historical event to an opened saved-game file.
226
354
        bool save(XML_Helper* helper) const;
227
355
 
 
356
        //! Populate the event with the City that was razed.
228
357
        bool fillData(City *city);
 
358
 
 
359
        //! Get the Id of the City object that was razed.
229
360
        Uint32 getCityId() const {return d_city;}
230
361
    
231
362
    private:
 
363
        //! The Id of the City that was razed.
232
364
        Uint32 d_city;
233
365
};
234
366
 
235
367
//-----------------------------------------------------------------------------
236
368
 
 
369
//! A permanent record of a Hero initiating a Quest.
237
370
class History_HeroQuestStarted : public History
238
371
{
239
372
    public:
 
373
        //! Default constructor.
240
374
        History_HeroQuestStarted();
 
375
        //! Copy constructor.
 
376
        History_HeroQuestStarted(const History_HeroQuestStarted &history);
 
377
        //! Load the historical event from an opened saved-game file.
241
378
        History_HeroQuestStarted(XML_Helper* helper);
 
379
        //! Destructor.
242
380
        ~History_HeroQuestStarted();
243
381
 
 
382
        //! Return some debug information about this historical event.
244
383
        std::string dump() const;
 
384
 
 
385
        //! Save the historical event to an opened saved-game file.
245
386
        bool save(XML_Helper* helper) const;
246
387
 
 
388
        //! Populate the event with the Hero who initiated a new Quest.
247
389
        bool fillData(Hero *hero);
 
390
 
 
391
        //! Get the name of the Hero who started a Quest.
248
392
        std::string getHeroName() const {return d_hero;}
249
393
    
250
394
    private:
 
395
        //! The name of the Hero who started the Quest.
251
396
        std::string d_hero;
252
397
};
253
398
 
254
399
//-----------------------------------------------------------------------------
255
400
 
 
401
//! A permanent record of a Hero completing a Quest.
256
402
class History_HeroQuestCompleted: public History
257
403
{
258
404
    public:
 
405
        //! Default constructor.
259
406
        History_HeroQuestCompleted();
 
407
        //! Copy constructor.
 
408
        History_HeroQuestCompleted(const History_HeroQuestCompleted &history);
 
409
        //! Load the historical event from an opened saved-game file.
260
410
        History_HeroQuestCompleted(XML_Helper* helper);
 
411
        //! Destructor.
261
412
        ~History_HeroQuestCompleted();
262
413
 
 
414
        //! Return some debug information about this historical event.
263
415
        std::string dump() const;
 
416
 
 
417
        //! Save the historical event to an opened saved-game file.
264
418
        bool save(XML_Helper* helper) const;
265
419
 
 
420
        //! Populate the event with the Hero who finished a Quest.
266
421
        bool fillData(Hero *hero);
 
422
 
 
423
        //! Get the name of the Hero who finished a Quest.
267
424
        std::string getHeroName() const {return d_hero;}
268
425
    
269
426
    private:
 
427
        //! The name of the Hero who completed the Quest.
270
428
        std::string d_hero;
271
429
};
272
430
 
273
431
//-----------------------------------------------------------------------------
274
432
 
 
433
//! A permanent record of a Hero killed in the defense or attack of a City.
275
434
class History_HeroKilledInCity : public History
276
435
{
277
436
    public:
 
437
        //! Default constructor.
278
438
        History_HeroKilledInCity();
 
439
        //! Copy constructor.
 
440
        History_HeroKilledInCity(const History_HeroKilledInCity &history);
 
441
        //! Load the historical event from an opened saved-game file.
279
442
        History_HeroKilledInCity(XML_Helper* helper);
 
443
        //! Destructor.
280
444
        ~History_HeroKilledInCity();
281
445
 
 
446
        //! Return some debug information about this historical event.
282
447
        std::string dump() const;
 
448
 
 
449
        //! Save the historical event to an opened saved-game file.
283
450
        bool save(XML_Helper* helper) const;
284
451
 
 
452
        //! Populate the event with pertinent data.
 
453
        /**
 
454
         * Populate the event with the Hero who was killed and the City where
 
455
         * it happened.
 
456
         *
 
457
         * @param hero    The Hero who died.
 
458
         * @param city    The City that houses the Hero's broken corpse.
 
459
         */
285
460
        bool fillData(Hero *hero, City *city);
 
461
 
 
462
        //! Get the name of the Hero who died.
286
463
        std::string getHeroName() const {return d_hero;}
 
464
 
 
465
        //! Get the name of the City where the Hero died.
287
466
        std::string getCityName() const {return d_city;}
288
467
    
289
468
    private:
 
469
        //! Get the name of the Hero who was killed.
290
470
        std::string d_hero;
 
471
 
 
472
        //! Get the name of the City where the Hero was killed.
291
473
        std::string d_city;
292
474
};
293
475
 
294
476
//-----------------------------------------------------------------------------
295
477
 
 
478
//! A permanent record of a Hero killed in battle outside of a City.
296
479
class History_HeroKilledInBattle: public History
297
480
{
298
481
    public:
 
482
        //! Default constructor.
299
483
        History_HeroKilledInBattle();
 
484
        //! Copy constructor.
 
485
        History_HeroKilledInBattle(const History_HeroKilledInBattle &history);
 
486
        //! Load the historical event from an opened saved-game file.
300
487
        History_HeroKilledInBattle(XML_Helper* helper);
 
488
        //! Destructor.
301
489
        ~History_HeroKilledInBattle();
302
490
 
 
491
        //! Return some debug information about this historical event.
303
492
        std::string dump() const;
 
493
 
 
494
        //! Save the historical event to an opened saved-game file.
304
495
        bool save(XML_Helper* helper) const;
305
496
 
 
497
        //! Populate the event with the Hero who was killed in battle.
306
498
        bool fillData(Hero *hero);
 
499
 
 
500
        //! Get the name of the Hero who died in battle outside of a City.
307
501
        std::string getHeroName() const {return d_hero;}
308
502
    
309
503
    private:
 
504
        //! The name of the Hero who died in battle outside of a City.
310
505
        std::string d_hero;
311
506
};
312
507
 
313
508
//-----------------------------------------------------------------------------
314
509
 
 
510
//! A permanent record of a Hero killed while searching a Ruin.
315
511
class History_HeroKilledSearching: public History
316
512
{
317
513
    public:
 
514
        //! Default constructor.
318
515
        History_HeroKilledSearching();
 
516
        //! Copy constructor.
 
517
        History_HeroKilledSearching(const History_HeroKilledSearching &history);
 
518
        //! Load the historical event from an opened saved-game file.
319
519
        History_HeroKilledSearching(XML_Helper* helper);
 
520
        //! Destructor.
320
521
        ~History_HeroKilledSearching();
321
522
 
 
523
        //! Return some debug information about this historical event.
322
524
        std::string dump() const;
 
525
 
 
526
        //! Save the historical event to an opened saved-game file.
323
527
        bool save(XML_Helper* helper) const;
324
528
 
 
529
        //! Populate the event with the Hero who was killed while searching.
325
530
        bool fillData(Hero *hero);
 
531
 
 
532
        //! Get the name of the Hero who died while searching a Ruin.
326
533
        std::string getHeroName() const {return d_hero;}
327
534
    
328
535
    private:
 
536
        //! The name of the Hero who died while searching a Ruin.
329
537
        std::string d_hero;
330
538
};
331
539
 
332
540
//-----------------------------------------------------------------------------
333
541
 
 
542
//! A permanent record of the player's score.
334
543
class History_Score: public History
335
544
{
336
545
    public:
 
546
        //! Default constructor.
337
547
        History_Score();
 
548
        //! Copy constructor.
 
549
        History_Score(const History_Score &history);
 
550
        //! Load the historical event from an opened saved-game file.
338
551
        History_Score(XML_Helper* helper);
 
552
        //! Destructor.
339
553
        ~History_Score();
340
554
 
 
555
        //! Return some debug information about this historical event.
341
556
        std::string dump() const;
 
557
 
 
558
        //! Save the historical event to an opened saved-game file.
342
559
        bool save(XML_Helper* helper) const;
343
560
 
 
561
        //! Populate the event with the player's score for this turn.
344
562
        bool fillData(Uint32 score);
 
563
 
 
564
        //! Get the player's score for this turn.
345
565
        Uint32 getScore() const {return d_score;}
346
566
    
347
567
    private:
 
568
        //! The player's score.
348
569
        int d_score;
349
570
};
350
571
 
351
572
//-----------------------------------------------------------------------------
352
573
 
 
574
//! A permanent record of the player being utterly defeated.
353
575
class History_PlayerVanquished: public History
354
576
{
355
577
    public:
 
578
        //! Default constructor.
356
579
        History_PlayerVanquished();
 
580
        //! Copy constructor.
 
581
        History_PlayerVanquished(const History_PlayerVanquished &history);
 
582
        //! Load the historical event from an opened saved-game file.
357
583
        History_PlayerVanquished(XML_Helper* helper);
 
584
        //! Destructor.
358
585
        ~History_PlayerVanquished();
359
586
 
 
587
        //! Return some debug information about this historical event.
360
588
        std::string dump() const;
 
589
 
 
590
        //! Save the historical event to an opened saved-game file.
361
591
        bool save(XML_Helper* helper) const;
362
592
 
363
593
};
364
594
 
365
595
//-----------------------------------------------------------------------------
366
596
 
 
597
//! A permanent record of the player making peace with an opponent.
367
598
class History_DiplomacyPeace : public History
368
599
{
369
600
    public:
 
601
        //! Default constructor.
370
602
        History_DiplomacyPeace();
 
603
        //! Copy constructor.
 
604
        History_DiplomacyPeace(const History_DiplomacyPeace &history);
 
605
        //! Load the historical event from an opened saved-game file.
371
606
        History_DiplomacyPeace(XML_Helper* helper);
 
607
        //! Destructor.
372
608
        ~History_DiplomacyPeace();
373
609
 
 
610
        //! Return some debug information about this historical event.
374
611
        std::string dump() const;
 
612
 
 
613
        //! Save the historical event to an opened saved-game file.
375
614
        bool save(XML_Helper* helper) const;
376
615
 
 
616
        //! Populate the event with the Player who we are at peace with.
377
617
        bool fillData(Player *opponent);
 
618
 
 
619
        //! Get the Id of the Player object we are at peace with.
378
620
        Uint32 getOpponentId() const {return d_opponent_id;}
379
621
    
380
622
    private:
 
623
        //! The Id of the Player object we are at peace with.
381
624
        Uint32 d_opponent_id;
382
625
};
383
626
 
384
627
//-----------------------------------------------------------------------------
385
628
 
 
629
//! A permanent record of the player going to war with an opponent.
386
630
class History_DiplomacyWar: public History
387
631
{
388
632
    public:
 
633
        //! Default constructor.
389
634
        History_DiplomacyWar();
 
635
        //! Copy constructor.
 
636
        History_DiplomacyWar(const History_DiplomacyWar &history);
 
637
        //! Load the historical event from an opened saved-game file.
390
638
        History_DiplomacyWar(XML_Helper* helper);
 
639
        //! Destructor.
391
640
        ~History_DiplomacyWar();
392
641
 
 
642
        //! Return some debug information about this historical event.
393
643
        std::string dump() const;
 
644
 
 
645
        //! Save the historical event to an opened saved-game file.
394
646
        bool save(XML_Helper* helper) const;
395
647
 
 
648
        //! Populate the event with the Player who we are at war with.
396
649
        bool fillData(Player *opponent);
 
650
 
 
651
        //! Get the Id of the Player object we are at war with.
397
652
        Uint32 getOpponentId() const {return d_opponent_id;}
398
653
    
399
654
    private:
 
655
        // The Id of the Player object we are at war with.
400
656
        Uint32 d_opponent_id;
401
657
};
402
658
 
403
659
//-----------------------------------------------------------------------------
404
660
 
 
661
//! A permanent record of the player being treacherous to an opponent.
405
662
class History_DiplomacyTreachery: public History
406
663
{
407
664
    public:
 
665
        //! Default constructor.
408
666
        History_DiplomacyTreachery();
 
667
        //! Copy constructor.
 
668
        History_DiplomacyTreachery(const History_DiplomacyTreachery &history);
 
669
        //! Load the historical event from an opened saved-game file.
409
670
        History_DiplomacyTreachery(XML_Helper* helper);
 
671
        //! Destructor.
410
672
        ~History_DiplomacyTreachery();
411
673
 
 
674
        //! Return some debug information about this historical event.
412
675
        std::string dump() const;
 
676
 
 
677
        //! Save the historical event to an opened saved-game file.
413
678
        bool save(XML_Helper* helper) const;
414
679
 
 
680
        //! Populate the event with the Player we performed treachery on.
415
681
        bool fillData(Player *opponent);
 
682
 
 
683
        //! Get the Id of the Player object that we peformed treachery on.
416
684
        Uint32 getOpponentId() const {return d_opponent_id;}
417
685
    
418
686
    private:
 
687
        //! The Id of the Player object that we peformed treachery on.
419
688
        Uint32 d_opponent_id;
420
689
};
421
690
 
422
691
//-----------------------------------------------------------------------------
423
692
 
 
693
//! A permanent record of a Hero finding powerful allies.
424
694
class History_HeroFindsAllies : public History
425
695
{
426
696
    public:
 
697
        //! Default constructor.
427
698
        History_HeroFindsAllies();
 
699
        //! Copy constructor.
 
700
        History_HeroFindsAllies(const History_HeroFindsAllies &history);
 
701
        //! Load the historical event from an opened saved-game file.
428
702
        History_HeroFindsAllies(XML_Helper* helper);
 
703
        //! Destructor.
429
704
        ~History_HeroFindsAllies();
430
705
 
 
706
        //! Return some debug information about this historical event.
431
707
        std::string dump() const;
 
708
 
 
709
        //! Save the historical event to an opened saved-game file.
432
710
        bool save(XML_Helper* helper) const;
433
711
 
 
712
        //! Populate the event with the name of the Hero who found allies.
434
713
        bool fillData(Hero *hero);
 
714
 
 
715
        //! Get the name of the Hero who found powerful allies.
435
716
        std::string getHeroName() const {return d_hero;}
436
717
    
437
718
    private:
 
719
        //! The name of the Hero who found powerful allies at a Ruin.
438
720
        std::string d_hero;
439
721
};
440
722