1 // Copyright (C) 2007, 2008, 2011, 2014, 2015 Ben Asselstine 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Library General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 // 02110-1301, USA. 17 18 #pragma once 19 #ifndef HISTORY_H 20 #define HISTORY_H 21 22 #include <sigc++/trackable.h> 23 24 #include <glibmm.h> 25 class XML_Helper; 26 27 class Hero; 28 class City; 29 class Ruin; 30 class Item; 31 class Player; 32 33 //! A permanent record of an accomplishment during gameplay. 34 /** 35 * The purpose of the history classes is to keep track about what a 36 * player has accomplished. This list is retained for the duration of 37 * the game. 38 * 39 */ 40 class History 41 { 42 public: 43 //! The xml tag of this object in a saved-game file. 44 static Glib::ustring d_tag; 45 46 //! A History can be one of the following kinds. 47 enum Type { 48 //! The player started a turn. 49 START_TURN = 1, 50 //! The player has searched a Ruin and found a sage. 51 FOUND_SAGE = 2, 52 //! The player has accrued a certain amount of gold in the treasury. 53 GOLD_TOTAL = 3, 54 //! A hero has emerged. 55 HERO_EMERGES = 4, 56 //! A City has been taken. 57 CITY_WON = 5, 58 //! A City has been razed. 59 CITY_RAZED = 6, 60 //! A Hero has inititiated a Quest. 61 HERO_QUEST_STARTED = 7, 62 //! A Hero has completed a Quest. 63 HERO_QUEST_COMPLETED = 8, 64 //! A Hero was killed in battle at a City. 65 HERO_KILLED_IN_CITY = 9, 66 //! A Hero was killed in battle in the field. 67 HERO_KILLED_IN_BATTLE = 10, 68 //! A Hero was killed searching a Ruin. 69 HERO_KILLED_SEARCHING = 11, 70 //! A Hero was involved in taking a City. 71 HERO_CITY_WON = 12, 72 //! The player has this score. 73 SCORE = 13, 74 //! The player has been utterly defeated. 75 PLAYER_VANQUISHED = 14, 76 //! The player has achieved peace with an opponent. 77 DIPLOMATIC_PEACE = 15, 78 //! The player has started a war with an opponent. 79 DIPLOMATIC_WAR = 16, 80 //! The player has been treacherous towards an opponent. 81 DIPLOMATIC_TREACHERY = 17, 82 //! A Hero finds some powerful allies. 83 HERO_FINDS_ALLIES = 18, 84 //! The player has finished a turn. 85 END_TURN = 19, 86 //! The player has explored a ruin. 87 HERO_RUIN_EXPLORED = 20, 88 //! The player has been told of the location of a hidden ruin. 89 HERO_REWARD_RUIN = 21, 90 //! The player has used an item 91 USE_ITEM = 22 92 }; 93 static Glib::ustring historyTypeToString(const History::Type type); 94 static History::Type historyTypeFromString(const Glib::ustring str); 95 96 //! Default constructor. 97 History(Type type); 98 99 //! Loading from XML constructor. 100 History (XML_Helper *helper); 101 102 //! Destructor. ~History()103 virtual ~History() {}; 104 105 //! Returns debug information. Needs to be overwritten by derivatives 106 virtual Glib::ustring dump() const = 0; 107 108 /** 109 * static load function (see XML_Helper) 110 * 111 * Whenever a History item is loaded, this function is called. It 112 * examines the stored History::Type and calls the constructor of 113 * the appropriate History class. 114 * 115 * @param helper The opened saved-game file to read from. 116 */ 117 //! Load a History from an opened saved-game file. 118 static History* handle_load(XML_Helper* helper); 119 120 //! Copies a history into a new one. 121 static History* copy(const History* a); 122 123 //! Returns the id which identifies the type of History event. getType()124 Type getType() const {return d_type;} 125 126 bool save(XML_Helper* helper) const; 127 bool saveContents(XML_Helper* helper) const; 128 129 protected: 130 virtual bool doSave(XML_Helper* helper) const = 0; 131 Type d_type; 132 }; 133 134 //----------------------------------------------------------------------------- 135 136 //! A permanent record of a player starting a turn. 137 class History_StartTurn : public History 138 { 139 public: 140 //! Default constructor. 141 History_StartTurn(); 142 //! Copy constructor. 143 History_StartTurn(const History_StartTurn &history); 144 //! Load the historical event from an opened saved-game file. 145 History_StartTurn(XML_Helper* helper); 146 //! Destructor. ~History_StartTurn()147 ~History_StartTurn() {}; 148 149 //! Return some debug information about this historical event. 150 Glib::ustring dump() const; 151 152 //! Save the historical event to an opened saved-game file. 153 virtual bool doSave(XML_Helper* helper) const; 154 155 private: 156 }; 157 158 //----------------------------------------------------------------------------- 159 160 //! A permanent record of a Hero searching a Ruin and finding a sage. 161 class History_FoundSage : public History 162 { 163 public: 164 //! Default constructor. 165 History_FoundSage(Hero *hero); 166 //! Copy constructor. 167 History_FoundSage(const History_FoundSage &history); 168 //! Load the historical event from an opened saved-game file. 169 History_FoundSage(XML_Helper* helper); 170 //! Destructor. ~History_FoundSage()171 ~History_FoundSage() {}; 172 173 //! Return some debug information about this historical event. 174 Glib::ustring dump() const; 175 176 //! Save the historical event to an opened saved-game file. 177 virtual bool doSave(XML_Helper* helper) const; 178 179 //! Get the name of the Hero who found the sage. getHeroName()180 Glib::ustring getHeroName() const {return d_hero;} 181 182 private: 183 //! The name of the Hero. 184 Glib::ustring d_hero; 185 }; 186 187 //----------------------------------------------------------------------------- 188 189 //! A permanent record of the amount of gold pieces a player has. 190 class History_GoldTotal : public History 191 { 192 public: 193 //! Default constructor. 194 History_GoldTotal(int gold); 195 //! Copy constructor. 196 History_GoldTotal(const History_GoldTotal &history); 197 //! Load the historical event from an opened saved-game file. 198 History_GoldTotal(XML_Helper* helper); 199 //! Destructor. ~History_GoldTotal()200 ~History_GoldTotal() {}; 201 202 //! Return some debug information about this historical event. 203 Glib::ustring dump() const; 204 205 //! Save the historical event to an opened saved-game file. 206 virtual bool doSave(XML_Helper* helper) const; 207 208 //! Get the amount of gold associated with this event. getGold()209 int getGold() const {return d_gold;} 210 211 private: 212 //! The amount of gold pieces the player has at a point in time. 213 int d_gold; 214 }; 215 216 //----------------------------------------------------------------------------- 217 218 //! A permanent record of a new Hero emerging in a City. 219 class History_HeroEmerges : public History 220 { 221 public: 222 //! Default constructor. 223 History_HeroEmerges(Hero *hero, City *city); 224 //! Copy constructor. 225 History_HeroEmerges(const History_HeroEmerges &history); 226 //! Load the historical event from an opened saved-game file. 227 History_HeroEmerges(XML_Helper* helper); 228 //! Destructor. ~History_HeroEmerges()229 ~History_HeroEmerges() {}; 230 231 //! Return some debug information about this historical event. 232 Glib::ustring dump() const; 233 234 //! Save the historical event to an opened saved-game file. 235 virtual bool doSave(XML_Helper* helper) const; 236 237 //! Get the name of the Hero who appeared. getHeroName()238 Glib::ustring getHeroName() const {return d_hero;} 239 getHeroId()240 guint32 getHeroId() const {return d_hero_id;}; 241 242 //! Get the name of the City where the Hero has emerged. getCityName()243 Glib::ustring getCityName() const {return d_city;} 244 245 private: 246 //! The name of the Hero who emerged. 247 Glib::ustring d_hero; 248 249 //! The id of the hero 250 guint32 d_hero_id; 251 252 //! The name of the City where the Hero emerged. 253 Glib::ustring d_city; 254 }; 255 256 //----------------------------------------------------------------------------- 257 258 //! A permanent record of an enemy city being defeated. 259 class History_CityWon : public History 260 { 261 public: 262 //! Default constructor. 263 History_CityWon(City *city); 264 //! Copy constructor. 265 History_CityWon(const History_CityWon &history); 266 //! Load the historical event from an opened saved-game file. 267 History_CityWon(XML_Helper* helper); 268 //! Destructor. ~History_CityWon()269 ~History_CityWon() {}; 270 271 //! Return some debug information about this historical event. 272 Glib::ustring dump() const; 273 274 //! Save the historical event to an opened saved-game file. 275 virtual bool doSave(XML_Helper* helper) const; 276 277 //! Get the Id of the City object that was defeated. getCityId()278 guint32 getCityId() const {return d_city;} 279 280 private: 281 //! The Id of the City object that was defeated. 282 guint32 d_city; 283 }; 284 285 //----------------------------------------------------------------------------- 286 287 //! A permanent record of an enemy city being defeated by a Hero. 288 class History_HeroCityWon: public History 289 { 290 public: 291 //! Default constructor. 292 History_HeroCityWon(City *c, Hero *h); 293 //! Copy constructor. 294 History_HeroCityWon(const History_HeroCityWon &history); 295 //! Load the historical event from an opened saved-game file. 296 History_HeroCityWon(XML_Helper* helper); 297 //! Destructor. ~History_HeroCityWon()298 ~History_HeroCityWon() {}; 299 300 //! Return some debug information about this historical event. 301 Glib::ustring dump() const; 302 303 //! Save the historical event to an opened saved-game file. 304 virtual bool doSave(XML_Helper* helper) const; 305 306 //! Get the name of the Hero who conquered the City. getHeroName()307 Glib::ustring getHeroName() const {return d_hero;} 308 309 //! Get the name of the City that was conquered. getCityName()310 Glib::ustring getCityName() const {return d_city;} 311 312 private: 313 //! The name of the Hero who helped in conquering the City. 314 Glib::ustring d_hero; 315 316 //! The name of the City that was conquered. 317 Glib::ustring d_city; 318 }; 319 320 //----------------------------------------------------------------------------- 321 322 //! A permanent record of an enemy city being razed. 323 class History_CityRazed : public History 324 { 325 public: 326 //! Default constructor. 327 History_CityRazed(City *c); 328 //! Copy constructor. 329 History_CityRazed(const History_CityRazed &history); 330 //! Load the historical event from an opened saved-game file. 331 History_CityRazed(XML_Helper* helper); 332 //! Destructor. ~History_CityRazed()333 ~History_CityRazed() {}; 334 335 //! Return some debug information about this historical event. 336 Glib::ustring dump() const; 337 338 //! Save the historical event to an opened saved-game file. 339 virtual bool doSave(XML_Helper* helper) const; 340 341 //! Get the Id of the City object that was razed. getCityId()342 guint32 getCityId() const {return d_city;} 343 344 private: 345 //! The Id of the City that was razed. 346 guint32 d_city; 347 }; 348 349 //----------------------------------------------------------------------------- 350 351 //! A permanent record of a Hero initiating a Quest. 352 class History_HeroQuestStarted : public History 353 { 354 public: 355 //! Default constructor. 356 History_HeroQuestStarted(Hero *h); 357 //! Copy constructor. 358 History_HeroQuestStarted(const History_HeroQuestStarted &history); 359 //! Load the historical event from an opened saved-game file. 360 History_HeroQuestStarted(XML_Helper* helper); 361 //! Destructor. ~History_HeroQuestStarted()362 ~History_HeroQuestStarted() {}; 363 364 //! Return some debug information about this historical event. 365 Glib::ustring dump() const; 366 367 //! Save the historical event to an opened saved-game file. 368 virtual bool doSave(XML_Helper* helper) const; 369 370 //! Get the name of the Hero who started a Quest. getHeroName()371 Glib::ustring getHeroName() const {return d_hero;} 372 373 private: 374 //! The name of the Hero who started the Quest. 375 Glib::ustring d_hero; 376 }; 377 378 //----------------------------------------------------------------------------- 379 380 //! A permanent record of a Hero completing a Quest. 381 class History_HeroQuestCompleted: public History 382 { 383 public: 384 //! Default constructor. 385 History_HeroQuestCompleted(Hero *h); 386 //! Copy constructor. 387 History_HeroQuestCompleted(const History_HeroQuestCompleted &history); 388 //! Load the historical event from an opened saved-game file. 389 History_HeroQuestCompleted(XML_Helper* helper); 390 //! Destructor. ~History_HeroQuestCompleted()391 ~History_HeroQuestCompleted() {}; 392 393 //! Return some debug information about this historical event. 394 Glib::ustring dump() const; 395 396 //! Save the historical event to an opened saved-game file. 397 virtual bool doSave(XML_Helper* helper) const; 398 399 //! Get the name of the Hero who finished a Quest. getHeroName()400 Glib::ustring getHeroName() const {return d_hero;} 401 402 private: 403 //! The name of the Hero who completed the Quest. 404 Glib::ustring d_hero; 405 }; 406 407 //----------------------------------------------------------------------------- 408 409 //! A permanent record of a Hero killed in the defense or attack of a City. 410 class History_HeroKilledInCity : public History 411 { 412 public: 413 //! Default constructor. 414 History_HeroKilledInCity(Hero *h, City *c); 415 //! Copy constructor. 416 History_HeroKilledInCity(const History_HeroKilledInCity &history); 417 //! Load the historical event from an opened saved-game file. 418 History_HeroKilledInCity(XML_Helper* helper); 419 //! Destructor. ~History_HeroKilledInCity()420 ~History_HeroKilledInCity() {}; 421 422 //! Return some debug information about this historical event. 423 Glib::ustring dump() const; 424 425 //! Save the historical event to an opened saved-game file. 426 virtual bool doSave(XML_Helper* helper) const; 427 428 //! Get the name of the Hero who died. getHeroName()429 Glib::ustring getHeroName() const {return d_hero;} 430 431 //! Get the name of the City where the Hero died. getCityName()432 Glib::ustring getCityName() const {return d_city;} 433 434 private: 435 //! Get the name of the Hero who was killed. 436 Glib::ustring d_hero; 437 438 //! Get the name of the City where the Hero was killed. 439 Glib::ustring d_city; 440 }; 441 442 //----------------------------------------------------------------------------- 443 444 //! A permanent record of a Hero killed in battle outside of a City. 445 class History_HeroKilledInBattle: public History 446 { 447 public: 448 //! Default constructor. 449 History_HeroKilledInBattle(Hero *h); 450 //! Copy constructor. 451 History_HeroKilledInBattle(const History_HeroKilledInBattle &history); 452 //! Load the historical event from an opened saved-game file. 453 History_HeroKilledInBattle(XML_Helper* helper); 454 //! Destructor. ~History_HeroKilledInBattle()455 ~History_HeroKilledInBattle() {}; 456 457 //! Return some debug information about this historical event. 458 Glib::ustring dump() const; 459 460 //! Save the historical event to an opened saved-game file. 461 virtual bool doSave(XML_Helper* helper) const; 462 463 //! Get the name of the Hero who died in battle outside of a City. getHeroName()464 Glib::ustring getHeroName() const {return d_hero;} 465 466 private: 467 //! The name of the Hero who died in battle outside of a City. 468 Glib::ustring d_hero; 469 }; 470 471 //----------------------------------------------------------------------------- 472 473 //! A permanent record of a Hero killed while searching a Ruin. 474 class History_HeroKilledSearching: public History 475 { 476 public: 477 //! Default constructor. 478 History_HeroKilledSearching(Hero *h); 479 //! Copy constructor. 480 History_HeroKilledSearching(const History_HeroKilledSearching &history); 481 //! Load the historical event from an opened saved-game file. 482 History_HeroKilledSearching(XML_Helper* helper); 483 //! Destructor. ~History_HeroKilledSearching()484 ~History_HeroKilledSearching() {}; 485 486 //! Return some debug information about this historical event. 487 Glib::ustring dump() const; 488 489 //! Save the historical event to an opened saved-game file. 490 virtual bool doSave(XML_Helper* helper) const; 491 492 //! Get the name of the Hero who died while searching a Ruin. getHeroName()493 Glib::ustring getHeroName() const {return d_hero;} 494 495 private: 496 //! The name of the Hero who died while searching a Ruin. 497 Glib::ustring d_hero; 498 }; 499 500 //----------------------------------------------------------------------------- 501 502 //! A permanent record of the player's score. 503 class History_Score: public History 504 { 505 public: 506 //! Default constructor. 507 History_Score(guint32 score); 508 //! Copy constructor. 509 History_Score(const History_Score &history); 510 //! Load the historical event from an opened saved-game file. 511 History_Score(XML_Helper* helper); 512 //! Destructor. ~History_Score()513 ~History_Score() {}; 514 515 //! Return some debug information about this historical event. 516 Glib::ustring dump() const; 517 518 //! Save the historical event to an opened saved-game file. 519 virtual bool doSave(XML_Helper* helper) const; 520 521 //! Get the player's score for this turn. getScore()522 guint32 getScore() const {return d_score;} 523 524 private: 525 //! The player's score. 526 int d_score; 527 }; 528 529 //----------------------------------------------------------------------------- 530 531 //! A permanent record of the player being utterly defeated. 532 class History_PlayerVanquished: public History 533 { 534 public: 535 //! Default constructor. 536 History_PlayerVanquished(); 537 //! Copy constructor. 538 History_PlayerVanquished(const History_PlayerVanquished &history); 539 //! Load the historical event from an opened saved-game file. 540 History_PlayerVanquished(XML_Helper* helper); 541 //! Destructor. ~History_PlayerVanquished()542 ~History_PlayerVanquished() {}; 543 544 //! Return some debug information about this historical event. 545 Glib::ustring dump() const; 546 547 //! Save the historical event to an opened saved-game file. 548 virtual bool doSave(XML_Helper* helper) const; 549 550 }; 551 552 //----------------------------------------------------------------------------- 553 554 //! A permanent record of the player making peace with an opponent. 555 class History_DiplomacyPeace : public History 556 { 557 public: 558 //! Default constructor. 559 History_DiplomacyPeace(Player *p); 560 //! Copy constructor. 561 History_DiplomacyPeace(const History_DiplomacyPeace &history); 562 //! Load the historical event from an opened saved-game file. 563 History_DiplomacyPeace(XML_Helper* helper); 564 //! Destructor. ~History_DiplomacyPeace()565 ~History_DiplomacyPeace() {}; 566 567 //! Return some debug information about this historical event. 568 Glib::ustring dump() const; 569 570 //! Save the historical event to an opened saved-game file. 571 virtual bool doSave(XML_Helper* helper) const; 572 573 //! Get the Id of the Player object we are at peace with. getOpponentId()574 guint32 getOpponentId() const {return d_opponent_id;} 575 576 private: 577 //! The Id of the Player object we are at peace with. 578 guint32 d_opponent_id; 579 }; 580 581 //----------------------------------------------------------------------------- 582 583 //! A permanent record of the player going to war with an opponent. 584 class History_DiplomacyWar: public History 585 { 586 public: 587 //! Default constructor. 588 History_DiplomacyWar(Player *p); 589 //! Copy constructor. 590 History_DiplomacyWar(const History_DiplomacyWar &history); 591 //! Load the historical event from an opened saved-game file. 592 History_DiplomacyWar(XML_Helper* helper); 593 //! Destructor. ~History_DiplomacyWar()594 ~History_DiplomacyWar() {}; 595 596 //! Return some debug information about this historical event. 597 Glib::ustring dump() const; 598 599 //! Save the historical event to an opened saved-game file. 600 virtual bool doSave(XML_Helper* helper) const; 601 602 //! Get the Id of the Player object we are at war with. getOpponentId()603 guint32 getOpponentId() const {return d_opponent_id;} 604 605 private: 606 // The Id of the Player object we are at war with. 607 guint32 d_opponent_id; 608 }; 609 610 //----------------------------------------------------------------------------- 611 612 //! A permanent record of the player being treacherous to an opponent. 613 class History_DiplomacyTreachery: public History 614 { 615 public: 616 //! Default constructor. 617 History_DiplomacyTreachery(Player *p); 618 //! Copy constructor. 619 History_DiplomacyTreachery(const History_DiplomacyTreachery &history); 620 //! Load the historical event from an opened saved-game file. 621 History_DiplomacyTreachery(XML_Helper* helper); 622 //! Destructor. ~History_DiplomacyTreachery()623 ~History_DiplomacyTreachery() {}; 624 625 //! Return some debug information about this historical event. 626 Glib::ustring dump() const; 627 628 //! Save the historical event to an opened saved-game file. 629 virtual bool doSave(XML_Helper* helper) const; 630 631 //! Get the Id of the Player object that we peformed treachery on. getOpponentId()632 guint32 getOpponentId() const {return d_opponent_id;} 633 634 private: 635 //! The Id of the Player object that we peformed treachery on. 636 guint32 d_opponent_id; 637 }; 638 639 //----------------------------------------------------------------------------- 640 641 //! A permanent record of a Hero finding powerful allies. 642 class History_HeroFindsAllies : public History 643 { 644 public: 645 //! Default constructor. 646 History_HeroFindsAllies(Hero *h); 647 //! Copy constructor. 648 History_HeroFindsAllies(const History_HeroFindsAllies &history); 649 //! Load the historical event from an opened saved-game file. 650 History_HeroFindsAllies(XML_Helper* helper); 651 //! Destructor. ~History_HeroFindsAllies()652 ~History_HeroFindsAllies() {}; 653 654 //! Return some debug information about this historical event. 655 Glib::ustring dump() const; 656 657 //! Save the historical event to an opened saved-game file. 658 virtual bool doSave(XML_Helper* helper) const; 659 660 //! Get the name of the Hero who found powerful allies. getHeroName()661 Glib::ustring getHeroName() const {return d_hero;} 662 663 private: 664 //! The name of the Hero who found powerful allies at a Ruin. 665 Glib::ustring d_hero; 666 }; 667 668 //----------------------------------------------------------------------------- 669 //! A permanent record of a player ending a turn. 670 class History_EndTurn : public History 671 { 672 public: 673 //! Default constructor. 674 History_EndTurn(); 675 //! Copy constructor. 676 History_EndTurn(const History_EndTurn &history); 677 //! Load the historical event from an opened saved-game file. 678 History_EndTurn(XML_Helper* helper); 679 //! Destructor. ~History_EndTurn()680 ~History_EndTurn() {}; 681 682 //! Return some debug information about this historical event. 683 Glib::ustring dump() const; 684 685 //! Save the historical event to an opened saved-game file. 686 virtual bool doSave(XML_Helper* helper) const; 687 688 private: 689 }; 690 //----------------------------------------------------------------------------- 691 692 //! A permanent record of a ruin being successfully searched by a Hero. 693 class History_HeroRuinExplored: public History 694 { 695 public: 696 //! Default constructor. 697 History_HeroRuinExplored(Hero *h, Ruin *r); 698 //! Copy constructor. 699 History_HeroRuinExplored(const History_HeroRuinExplored &history); 700 //! Load the historical event from an opened saved-game file. 701 History_HeroRuinExplored(XML_Helper* helper); 702 //! Destructor. ~History_HeroRuinExplored()703 ~History_HeroRuinExplored() {}; 704 705 //! Return some debug information about this historical event. 706 Glib::ustring dump() const; 707 708 //! Save the historical event to an opened saved-game file. 709 virtual bool doSave(XML_Helper* helper) const; 710 711 //! Get the name of the Hero who searched the Ruin. getHeroName()712 Glib::ustring getHeroName() const {return d_hero;} 713 714 //! Get the id of the Ruin that was searched. getRuinId()715 guint32 getRuinId() const {return d_ruin;} 716 717 private: 718 //! The name of the Hero who explored the Ruin. 719 Glib::ustring d_hero; 720 721 //! The id of the Ruin that was searched. 722 guint32 d_ruin; 723 }; 724 725 726 //----------------------------------------------------------------------------- 727 728 //! A permanent record of the location of a ruin being given to a Hero. 729 class History_HeroRewardRuin: public History 730 { 731 public: 732 //! Default constructor. 733 History_HeroRewardRuin(Hero *h, Ruin *r); 734 //! Copy constructor. 735 History_HeroRewardRuin(const History_HeroRewardRuin&history); 736 //! Load the historical event from an opened saved-game file. 737 History_HeroRewardRuin(XML_Helper* helper); 738 //! Destructor. ~History_HeroRewardRuin()739 ~History_HeroRewardRuin() {}; 740 741 //! Return some debug information about this historical event. 742 Glib::ustring dump() const; 743 744 //! Save the historical event to an opened saved-game file. 745 virtual bool doSave(XML_Helper* helper) const; 746 747 //! Get the name of the Hero who was given the location of the Ruin. getHeroName()748 Glib::ustring getHeroName() const {return d_hero;} 749 750 //! Get the id of the Ruin that was exposed. getRuinId()751 guint32 getRuinId() const {return d_ruin;} 752 753 private: 754 //! The name of the Hero who was told the location of the Ruin. 755 Glib::ustring d_hero; 756 757 //! The id of the Ruin that was exposed. 758 guint32 d_ruin; 759 }; 760 761 //----------------------------------------------------------------------------- 762 763 //! A permanent record of the player using an item 764 class History_HeroUseItem: public History 765 { 766 public: 767 //! Default constructor. 768 History_HeroUseItem(Hero *h, Item *i, Player *opponent, 769 City *friendly_city, City *enemy_city, 770 City *neutral_city, City *c); 771 //! Copy constructor. 772 History_HeroUseItem(const History_HeroUseItem &history); 773 //! Load the historical event from an opened saved-game file. 774 History_HeroUseItem(XML_Helper* helper); 775 //! Destructor. ~History_HeroUseItem()776 ~History_HeroUseItem() {}; 777 778 //! Return some debug information about this historical event. 779 Glib::ustring dump() const; 780 781 //! Save the historical event to an opened saved-game file. 782 virtual bool doSave(XML_Helper* helper) const; 783 784 //! Get the name of the hero that used the object. getHeroName()785 Glib::ustring getHeroName() const {return d_hero_name;} 786 787 //! Get the name of the item that was used by the hero. getItemName()788 Glib::ustring getItemName() const {return d_item_name;} 789 790 //! Get the reported capabilities of the item. getItemBonus()791 guint32 getItemBonus() const {return d_item_bonus;}; 792 793 //! Get the Id of the Player object that we used the item on. getOpponentId()794 guint32 getOpponentId() const {return d_opponent_id;}; getFriendlyCityId()795 guint32 getFriendlyCityId() const {return d_friendly_city_id;}; getEnemyCityId()796 guint32 getEnemyCityId() const {return d_enemy_city_id;}; getNeutralCityId()797 guint32 getNeutralCityId() const {return d_neutral_city_id;}; getCityId()798 guint32 getCityId() const {return d_city_id;}; 799 800 private: 801 802 //! The name of the hero using an object. 803 Glib::ustring d_hero_name; 804 805 //! The name of the item that was used. 806 Glib::ustring d_item_name; 807 808 //! The kind of item. 809 guint32 d_item_bonus; 810 811 //! The Id of the Player object that we peformed treachery on. 812 /** 813 * Whether or not the item is used against the player is a function 814 * of what kind of item it is. As a result this field may sometimes 815 * be 0, but not used against the white player. 816 */ 817 guint32 d_opponent_id; 818 819 guint32 d_friendly_city_id; 820 guint32 d_enemy_city_id; 821 guint32 d_neutral_city_id; 822 guint32 d_city_id; 823 }; 824 825 #endif //HISTORY_H 826