~ubuntu-branches/ubuntu/saucy/lordsawar/saucy

« back to all changes in this revision

Viewing changes to src/history.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese
  • Date: 2008-12-20 13:52:12 UTC
  • mfrom: (1.1.6 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081220135212-noeb2w3y98ebo7o9
Tags: 0.1.4-1
[ Barry deFreese ]
* New upstream release.
* Move 0.0.8-2.1 changelog entry to correct point in changelog.
* Make lordsawar-data suggest lordsawar.
* Update my e-mail address.
* Add build-depends on intltool, uuid-dev, and libboost-dev.
* Don't install locales since there are no translations currently.
* Add simple man page for new lordsawar-pbm binary.
* Drop gcc4.3 patches as they have been fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include "history.h"
23
23
#include "hero.h"
 
24
#include "heroproto.h"
24
25
#include "city.h"
 
26
#include "xmlhelper.h"
25
27
 
 
28
std::string History::d_tag = "history";
26
29
using namespace std;
27
30
 
28
31
#define debug(x) {cerr<<__FILE__<<": "<<__LINE__<<": "<< x << endl<<flush;}
29
32
//#define debug(x)
30
33
 
31
34
History::History(Type type)
32
 
:Ownable((Player *) 0), d_type(type)
 
35
:d_type(type)
33
36
{
34
37
}
35
38
 
39
42
 
40
43
History* History::handle_load(XML_Helper* helper)
41
44
{
42
 
  Uint32 t;
43
 
  helper->getData(t, "type");
 
45
  std::string type_str;
 
46
  helper->getData(type_str, "type");
 
47
  History::Type t = historyTypeFromString(type_str);
44
48
 
45
49
  switch (t)
46
50
    {
80
84
      return (new History_DiplomacyTreachery(helper));
81
85
    case HERO_FINDS_ALLIES:
82
86
      return (new History_HeroFindsAllies(helper));
 
87
    case END_TURN:
 
88
      return (new History_EndTurn(helper));
83
89
    }
84
90
 
85
91
  return 0;
153
159
      return 
154
160
        (new History_HeroFindsAllies
155
161
          (*dynamic_cast<const History_HeroFindsAllies*>(a)));
 
162
    case END_TURN:
 
163
      return 
 
164
        (new History_EndTurn(*dynamic_cast<const History_EndTurn*>(a)));
156
165
    }
157
166
 
158
167
  return 0;
159
168
}
160
169
 
 
170
History::History (XML_Helper *helper)
 
171
{
 
172
  std::string type_str;
 
173
  helper->getData(type_str, "type");
 
174
  d_type = historyTypeFromString(type_str);
 
175
}
 
176
 
 
177
bool History::save(XML_Helper* helper) const
 
178
{
 
179
    bool retval = true;
 
180
 
 
181
    retval &= helper->openTag(History::d_tag);
 
182
    retval &= saveContents(helper);
 
183
    retval &= helper->closeTag();
 
184
 
 
185
    return retval;
 
186
}
 
187
 
 
188
bool History::saveContents(XML_Helper* helper) const
 
189
{
 
190
    bool retval = true;
 
191
 
 
192
    std::string type_str = historyTypeToString(History::Type(d_type));
 
193
    retval &= helper->saveData("type", type_str);
 
194
    retval &= doSave(helper);
 
195
 
 
196
    return retval;
 
197
}
 
198
 
161
199
//-----------------------------------------------------------------------------
162
200
//History_StartTurn
163
201
 
172
210
}
173
211
 
174
212
History_StartTurn::History_StartTurn(XML_Helper* helper)
175
 
:History(History::START_TURN)
 
213
:History(helper)
176
214
{
177
215
}
178
216
 
189
227
  return s.str();
190
228
}
191
229
 
192
 
bool History_StartTurn::save(XML_Helper* helper) const
 
230
bool History_StartTurn::doSave(XML_Helper* helper) const
193
231
{
194
232
  bool retval = true;
195
233
 
196
 
  retval &= helper->openTag("history");
197
 
  retval &= helper->saveData("type", d_type);
198
 
  retval &= helper->closeTag();
199
 
 
200
234
  return retval;
201
235
}
202
236
 
219
253
}
220
254
 
221
255
History_FoundSage::History_FoundSage(XML_Helper* helper)
222
 
:History(History::FOUND_SAGE)
 
256
:History(helper)
223
257
{
224
258
  helper->getData(d_hero, "hero");
225
259
}
237
271
  return s.str();
238
272
}
239
273
 
240
 
bool History_FoundSage::save(XML_Helper* helper) const
 
274
bool History_FoundSage::doSave(XML_Helper* helper) const
241
275
{
242
276
  bool retval = true;
243
277
 
244
 
  retval &= helper->openTag("history");
245
 
  retval &= helper->saveData("type", d_type);
246
278
  retval &= helper->saveData("hero", d_hero);
247
 
  retval &= helper->closeTag();
248
279
 
249
280
  return retval;
250
281
}
269
300
}
270
301
 
271
302
History_GoldTotal::History_GoldTotal(XML_Helper* helper)
272
 
:History(History::GOLD_TOTAL)
 
303
:History(helper)
273
304
{
274
305
  helper->getData(d_gold, "gold");
275
306
}
287
318
  return s.str();
288
319
}
289
320
 
290
 
bool History_GoldTotal::save(XML_Helper* helper) const
 
321
bool History_GoldTotal::doSave(XML_Helper* helper) const
291
322
{
292
323
  bool retval = true;
293
324
 
294
 
  retval &= helper->openTag("history");
295
 
  retval &= helper->saveData("type", d_type);
296
325
  retval &= helper->saveData("gold", d_gold);
297
 
  retval &= helper->closeTag();
298
326
 
299
327
  return retval;
300
328
}
309
337
//History_HeroEmerges
310
338
 
311
339
History_HeroEmerges::History_HeroEmerges()
312
 
:History(History::HERO_EMERGES), d_hero(""), d_city("")
 
340
:History(History::HERO_EMERGES), d_hero(""), d_hero_id(0), d_city("")
313
341
{
314
342
}
315
343
 
316
344
History_HeroEmerges::History_HeroEmerges(const History_HeroEmerges &history)
317
 
:History(history), d_hero(history.d_hero), d_city(history.d_city)
 
345
:History(history), d_hero(history.d_hero), d_hero_id(history.d_hero_id), 
 
346
    d_city(history.d_city)
318
347
{
319
348
}
320
349
 
321
350
History_HeroEmerges::History_HeroEmerges(XML_Helper* helper)
322
 
:History(History::HERO_EMERGES)
 
351
:History(helper)
323
352
{
324
353
  helper->getData(d_hero, "hero");
325
354
  helper->getData(d_city, "city");
 
355
  helper->getData(d_hero_id, "hero_id");
326
356
}
327
357
 
328
358
History_HeroEmerges::~History_HeroEmerges()
333
363
{
334
364
  std::stringstream s;
335
365
 
336
 
  s <<"hero " << d_hero << " emerges in " << d_city << "\n";
 
366
  s <<"hero " << d_hero_id <<" (" << d_hero << ") emerges in " << d_city << "\n";
337
367
 
338
368
  return s.str();
339
369
}
340
370
 
341
 
bool History_HeroEmerges::save(XML_Helper* helper) const
 
371
bool History_HeroEmerges::doSave(XML_Helper* helper) const
342
372
{
343
373
  bool retval = true;
344
374
 
345
 
  retval &= helper->openTag("history");
346
 
  retval &= helper->saveData("type", d_type);
347
375
  retval &= helper->saveData("hero", d_hero);
348
376
  retval &= helper->saveData("city", d_city);
349
 
  retval &= helper->closeTag();
 
377
  retval &= helper->saveData("hero_id", d_hero_id);
350
378
 
351
379
  return retval;
352
380
}
355
383
{
356
384
  d_hero = hero->getName();
357
385
  d_city = city->getName();
 
386
  d_hero_id = hero->getId();
358
387
  return true;
359
388
}
360
389
 
372
401
}
373
402
 
374
403
History_CityWon::History_CityWon(XML_Helper* helper)
375
 
:History(History::CITY_WON)
 
404
:History(helper)
376
405
{
377
406
  helper->getData(d_city, "city");
378
407
}
391
420
  return s.str();
392
421
}
393
422
 
394
 
bool History_CityWon::save(XML_Helper* helper) const
 
423
bool History_CityWon::doSave(XML_Helper* helper) const
395
424
{
396
425
  bool retval = true;
397
426
 
398
 
  retval &= helper->openTag("history");
399
 
  retval &= helper->saveData("type", d_type);
400
427
  retval &= helper->saveData("city", d_city);
401
 
  retval &= helper->closeTag();
402
428
 
403
429
  return retval;
404
430
}
423
449
}
424
450
 
425
451
History_HeroCityWon::History_HeroCityWon(XML_Helper* helper)
426
 
:History(History::HERO_CITY_WON)
 
452
:History(helper)
427
453
{
428
454
  helper->getData(d_city, "city");
429
455
  helper->getData(d_hero, "hero");
444
470
  return s.str();
445
471
}
446
472
 
447
 
bool History_HeroCityWon::save(XML_Helper* helper) const
 
473
bool History_HeroCityWon::doSave(XML_Helper* helper) const
448
474
{
449
475
  bool retval = true;
450
476
 
451
 
  retval &= helper->openTag("history");
452
 
  retval &= helper->saveData("type", d_type);
453
477
  retval &= helper->saveData("city", d_city);
454
478
  retval &= helper->saveData("hero", d_hero);
455
 
  retval &= helper->closeTag();
456
479
 
457
480
  return retval;
458
481
}
478
501
}
479
502
 
480
503
History_CityRazed::History_CityRazed(XML_Helper* helper)
481
 
:History(History::CITY_RAZED)
 
504
:History(helper)
482
505
{
483
506
  helper->getData(d_city, "city");
484
507
}
496
519
  return s.str();
497
520
}
498
521
 
499
 
bool History_CityRazed::save(XML_Helper* helper) const
 
522
bool History_CityRazed::doSave(XML_Helper* helper) const
500
523
{
501
524
  bool retval = true;
502
525
 
503
 
  retval &= helper->openTag("history");
504
 
  retval &= helper->saveData("type", d_type);
505
526
  retval &= helper->saveData("city", d_city);
506
 
  retval &= helper->closeTag();
507
527
 
508
528
  return retval;
509
529
}
528
548
}
529
549
 
530
550
History_HeroQuestStarted::History_HeroQuestStarted(XML_Helper* helper)
531
 
:History(History::HERO_QUEST_STARTED)
 
551
:History(helper)
532
552
{
533
553
  helper->getData(d_hero, "hero");
534
554
}
546
566
  return s.str();
547
567
}
548
568
 
549
 
bool History_HeroQuestStarted::save(XML_Helper* helper) const
 
569
bool History_HeroQuestStarted::doSave(XML_Helper* helper) const
550
570
{
551
571
  bool retval = true;
552
572
 
553
 
  retval &= helper->openTag("history");
554
 
  retval &= helper->saveData("type", d_type);
555
573
  retval &= helper->saveData("hero", d_hero);
556
 
  retval &= helper->closeTag();
557
574
 
558
575
  return retval;
559
576
}
578
595
}
579
596
 
580
597
History_HeroQuestCompleted::History_HeroQuestCompleted(XML_Helper* helper)
581
 
:History(History::HERO_QUEST_COMPLETED)
 
598
:History(helper)
582
599
{
583
600
  helper->getData(d_hero, "hero");
584
601
}
596
613
  return s.str();
597
614
}
598
615
 
599
 
bool History_HeroQuestCompleted::save(XML_Helper* helper) const
 
616
bool History_HeroQuestCompleted::doSave(XML_Helper* helper) const
600
617
{
601
618
  bool retval = true;
602
619
 
603
 
  retval &= helper->openTag("history");
604
 
  retval &= helper->saveData("type", d_type);
605
620
  retval &= helper->saveData("hero", d_hero);
606
 
  retval &= helper->closeTag();
607
621
 
608
622
  return retval;
609
623
}
628
642
}
629
643
 
630
644
History_HeroKilledInCity::History_HeroKilledInCity(XML_Helper* helper)
631
 
:History(History::HERO_KILLED_IN_CITY)
 
645
:History(helper)
632
646
{
633
647
  helper->getData(d_hero, "hero");
634
648
  helper->getData(d_city, "city");
647
661
  return s.str();
648
662
}
649
663
 
650
 
bool History_HeroKilledInCity::save(XML_Helper* helper) const
 
664
bool History_HeroKilledInCity::doSave(XML_Helper* helper) const
651
665
{
652
666
  bool retval = true;
653
667
 
654
 
  retval &= helper->openTag("history");
655
 
  retval &= helper->saveData("type", d_type);
656
668
  retval &= helper->saveData("hero", d_hero);
657
669
  retval &= helper->saveData("city", d_city);
658
 
  retval &= helper->closeTag();
659
670
 
660
671
  return retval;
661
672
}
681
692
}
682
693
 
683
694
History_HeroKilledInBattle::History_HeroKilledInBattle(XML_Helper* helper)
684
 
:History(History::HERO_KILLED_IN_BATTLE)
 
695
:History(helper)
685
696
{
686
697
  helper->getData(d_hero, "hero");
687
698
}
699
710
  return s.str();
700
711
}
701
712
 
702
 
bool History_HeroKilledInBattle::save(XML_Helper* helper) const
 
713
bool History_HeroKilledInBattle::doSave(XML_Helper* helper) const
703
714
{
704
715
  bool retval = true;
705
716
 
706
 
  retval &= helper->openTag("history");
707
 
  retval &= helper->saveData("type", d_type);
708
717
  retval &= helper->saveData("hero", d_hero);
709
 
  retval &= helper->closeTag();
710
718
 
711
719
  return retval;
712
720
}
731
739
}
732
740
 
733
741
History_HeroKilledSearching::History_HeroKilledSearching(XML_Helper* helper)
734
 
:History(History::HERO_KILLED_SEARCHING)
 
742
:History(helper)
735
743
{
736
744
  helper->getData(d_hero, "hero");
737
745
}
749
757
  return s.str();
750
758
}
751
759
 
752
 
bool History_HeroKilledSearching::save(XML_Helper* helper) const
 
760
bool History_HeroKilledSearching::doSave(XML_Helper* helper) const
753
761
{
754
762
  bool retval = true;
755
763
 
756
 
  retval &= helper->openTag("history");
757
 
  retval &= helper->saveData("type", d_type);
758
764
  retval &= helper->saveData("hero", d_hero);
759
 
  retval &= helper->closeTag();
760
765
 
761
766
  return retval;
762
767
}
781
786
}
782
787
 
783
788
History_Score::History_Score(XML_Helper* helper)
784
 
:History(History::SCORE)
 
789
:History(helper)
785
790
{
786
791
  helper->getData(d_score, "score");
787
792
}
799
804
  return s.str();
800
805
}
801
806
 
802
 
bool History_Score::save(XML_Helper* helper) const
 
807
bool History_Score::doSave(XML_Helper* helper) const
803
808
{
804
809
  bool retval = true;
805
810
 
806
 
  retval &= helper->openTag("history");
807
 
  retval &= helper->saveData("type", d_type);
808
811
  retval &= helper->saveData("score", d_score);
809
 
  retval &= helper->closeTag();
810
812
 
811
813
  return retval;
812
814
}
831
833
}
832
834
 
833
835
History_PlayerVanquished::History_PlayerVanquished(XML_Helper* helper)
834
 
:History(History::PLAYER_VANQUISHED)
 
836
:History(helper)
835
837
{
836
838
}
837
839
 
848
850
  return s.str();
849
851
}
850
852
 
851
 
bool History_PlayerVanquished::save(XML_Helper* helper) const
 
853
bool History_PlayerVanquished::doSave(XML_Helper* helper) const
852
854
{
853
855
  bool retval = true;
854
856
 
855
 
  retval &= helper->openTag("history");
856
 
  retval &= helper->saveData("type", d_type);
857
 
  retval &= helper->closeTag();
858
 
 
859
857
  return retval;
860
858
}
861
859
 
873
871
}
874
872
 
875
873
History_DiplomacyPeace::History_DiplomacyPeace(XML_Helper* helper)
876
 
:History(History::DIPLOMATIC_PEACE)
 
874
:History(helper)
877
875
{
878
876
  helper->getData(d_opponent_id, "opponent_id");
879
877
}
892
890
  return s.str();
893
891
}
894
892
 
895
 
bool History_DiplomacyPeace::save(XML_Helper* helper) const
 
893
bool History_DiplomacyPeace::doSave(XML_Helper* helper) const
896
894
{
897
895
  bool retval = true;
898
896
 
899
 
  retval &= helper->openTag("history");
900
 
  retval &= helper->saveData("type", d_type);
901
897
  retval &= helper->saveData("opponent_id", d_opponent_id);
902
 
  retval &= helper->closeTag();
903
898
 
904
899
  return retval;
905
900
}
924
919
}
925
920
 
926
921
History_DiplomacyWar::History_DiplomacyWar(XML_Helper* helper)
927
 
:History(History::DIPLOMATIC_WAR)
 
922
:History(helper)
928
923
{
929
924
  helper->getData(d_opponent_id, "opponent_id");
930
925
}
943
938
  return s.str();
944
939
}
945
940
 
946
 
bool History_DiplomacyWar::save(XML_Helper* helper) const
 
941
bool History_DiplomacyWar::doSave(XML_Helper* helper) const
947
942
{
948
943
  bool retval = true;
949
944
 
950
 
  retval &= helper->openTag("history");
951
 
  retval &= helper->saveData("type", d_type);
952
945
  retval &= helper->saveData("opponent_id", d_opponent_id);
953
 
  retval &= helper->closeTag();
954
946
 
955
947
  return retval;
956
948
}
975
967
}
976
968
 
977
969
History_DiplomacyTreachery::History_DiplomacyTreachery(XML_Helper* helper)
978
 
:History(History::DIPLOMATIC_TREACHERY)
 
970
:History(helper)
979
971
{
980
972
  helper->getData(d_opponent_id, "opponent_id");
981
973
}
994
986
  return s.str();
995
987
}
996
988
 
997
 
bool History_DiplomacyTreachery::save(XML_Helper* helper) const
 
989
bool History_DiplomacyTreachery::doSave(XML_Helper* helper) const
998
990
{
999
991
  bool retval = true;
1000
992
 
1001
 
  retval &= helper->openTag("history");
1002
 
  retval &= helper->saveData("type", d_type);
1003
993
  retval &= helper->saveData("opponent_id", d_opponent_id);
1004
 
  retval &= helper->closeTag();
1005
994
 
1006
995
  return retval;
1007
996
}
1026
1015
}
1027
1016
 
1028
1017
History_HeroFindsAllies::History_HeroFindsAllies(XML_Helper* helper)
1029
 
:History(History::HERO_FINDS_ALLIES)
 
1018
:History(helper)
1030
1019
{
1031
1020
  helper->getData(d_hero, "hero");
1032
1021
}
1044
1033
  return s.str();
1045
1034
}
1046
1035
 
1047
 
bool History_HeroFindsAllies::save(XML_Helper* helper) const
 
1036
bool History_HeroFindsAllies::doSave(XML_Helper* helper) const
1048
1037
{
1049
1038
  bool retval = true;
1050
1039
 
1051
 
  retval &= helper->openTag("history");
1052
 
  retval &= helper->saveData("type", d_type);
1053
1040
  retval &= helper->saveData("hero", d_hero);
1054
 
  retval &= helper->closeTag();
1055
1041
 
1056
1042
  return retval;
1057
1043
}
1062
1048
  return true;
1063
1049
}
1064
1050
 
 
1051
//-----------------------------------------------------------------------------
 
1052
//History_EndTurn
 
1053
 
 
1054
History_EndTurn::History_EndTurn()
 
1055
:History(History::END_TURN)
 
1056
{
 
1057
}
 
1058
 
 
1059
History_EndTurn::History_EndTurn(const History_EndTurn &history)
 
1060
:History(history)
 
1061
{
 
1062
}
 
1063
 
 
1064
History_EndTurn::History_EndTurn(XML_Helper* helper)
 
1065
:History(helper)
 
1066
{
 
1067
}
 
1068
 
 
1069
History_EndTurn::~History_EndTurn()
 
1070
{
 
1071
}
 
1072
 
 
1073
std::string History_EndTurn::dump() const
 
1074
{
 
1075
  std::stringstream s;
 
1076
 
 
1077
  s <<"player ends a turn" << "\n";
 
1078
 
 
1079
  return s.str();
 
1080
}
 
1081
 
 
1082
bool History_EndTurn::doSave(XML_Helper* helper) const
 
1083
{
 
1084
  bool retval = true;
 
1085
 
 
1086
  return retval;
 
1087
}
 
1088
 
 
1089
bool History_EndTurn::fillData()
 
1090
{
 
1091
  return true;
 
1092
}
 
1093
 
 
1094
std::string History::historyTypeToString(const History::Type type)
 
1095
{
 
1096
  switch (type)
 
1097
    {
 
1098
    case History::START_TURN:
 
1099
      return "History::START_TURN";
 
1100
    case History::FOUND_SAGE:
 
1101
      return "History::FOUND_SAGE";
 
1102
    case History::GOLD_TOTAL:
 
1103
      return "History::GOLD_TOTAL";
 
1104
    case History::HERO_EMERGES:
 
1105
      return "History::HERO_EMERGES";
 
1106
    case History::CITY_WON:
 
1107
      return "History::CITY_WON";
 
1108
    case History::HERO_CITY_WON:
 
1109
      return "History::HERO_CITY_WON";
 
1110
    case History::CITY_RAZED:
 
1111
      return "History::CITY_RAZED";
 
1112
    case History::HERO_QUEST_STARTED:
 
1113
      return "History::HERO_QUEST_STARTED";
 
1114
    case History::HERO_QUEST_COMPLETED:
 
1115
      return "History::HERO_QUEST_COMPLETED";
 
1116
    case History::HERO_KILLED_IN_CITY:
 
1117
      return "History::HERO_KILLED_IN_CITY";
 
1118
    case History::HERO_KILLED_IN_BATTLE:
 
1119
      return "History::HERO_KILLED_IN_BATTLE";
 
1120
    case History::HERO_KILLED_SEARCHING:
 
1121
      return "History::HERO_KILLED_SEARCHING";
 
1122
    case History::SCORE:
 
1123
      return "History::SCORE";
 
1124
    case History::PLAYER_VANQUISHED:
 
1125
      return "History::PLAYER_VANQUISHED";
 
1126
    case History::DIPLOMATIC_PEACE:
 
1127
      return "History::DIPLOMATIC_PEACE";
 
1128
    case History::DIPLOMATIC_WAR:
 
1129
      return "History::DIPLOMATIC_WAR";
 
1130
    case History::DIPLOMATIC_TREACHERY:
 
1131
      return "History::DIPLOMATIC_TREACHERY";
 
1132
    case History::HERO_FINDS_ALLIES:
 
1133
      return "History::HERO_FINDS_ALLIES";
 
1134
    case History::END_TURN:
 
1135
      return "History::END_TURN";
 
1136
    }
 
1137
  return "History::START_TURN";
 
1138
}
 
1139
 
 
1140
History::Type History::historyTypeFromString(const std::string str)
 
1141
{
 
1142
  if (str.size() > 0 && isdigit(str.c_str()[0]))
 
1143
    return History::Type(atoi(str.c_str()));
 
1144
  if (str == "History::START_TURN")
 
1145
    return History::START_TURN;
 
1146
  else if (str == "History::FOUND_SAGE")
 
1147
    return History::FOUND_SAGE;
 
1148
  else if (str == "History::GOLD_TOTAL")
 
1149
    return History::GOLD_TOTAL;
 
1150
  else if (str == "History::HERO_EMERGES")
 
1151
    return History::HERO_EMERGES;
 
1152
  else if (str == "History::CITY_WON")
 
1153
    return History::CITY_WON;
 
1154
  else if (str== "History::HERO_CITY_WON")
 
1155
    return History::HERO_CITY_WON;
 
1156
  else if (str == "History::CITY_RAZED")
 
1157
    return History::CITY_RAZED;
 
1158
  else if (str == "History::HERO_QUEST_STARTED")
 
1159
    return History::HERO_QUEST_STARTED;
 
1160
  else if (str == "History::HERO_QUEST_COMPLETED")
 
1161
    return History::HERO_QUEST_COMPLETED;
 
1162
  else if (str == "History::HERO_KILLED_IN_CITY")
 
1163
    return History::HERO_KILLED_IN_CITY;
 
1164
  else if (str == "History::HERO_KILLED_IN_BATTLE")
 
1165
    return History::HERO_KILLED_IN_BATTLE;
 
1166
  else if (str == "History::HERO_KILLED_SEARCHING")
 
1167
    return History::HERO_KILLED_SEARCHING;
 
1168
  else if (str == "History::SCORE")
 
1169
    return History::SCORE;
 
1170
  else if (str == "History::PLAYER_VANQUISHED")
 
1171
    return History::PLAYER_VANQUISHED;
 
1172
  else if (str == "History::DIPLOMATIC_PEACE")
 
1173
    return History::DIPLOMATIC_PEACE;
 
1174
  else if (str == "History::DIPLOMATIC_WAR")
 
1175
    return History::DIPLOMATIC_WAR;
 
1176
  else if (str == "History::DIPLOMATIC_TREACHERY")
 
1177
    return History::DIPLOMATIC_TREACHERY;
 
1178
  else if (str == "History::HERO_FINDS_ALLIES")
 
1179
    return History::HERO_FINDS_ALLIES;
 
1180
  else if (str == "History::END_TURN")
 
1181
    return History::END_TURN;
 
1182
  return History::START_TURN;
 
1183
}