CCreatureWindow.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #pragma once
  2. #include "GUIClasses.h"
  3. #include "../lib/HeroBonus.h"
  4. /*
  5. * CCreatureWindow.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. struct Bonus;
  14. class CCreature;
  15. class CStackInstance;
  16. class CStack;
  17. class AdventureMapButton;
  18. class CBonusItem;
  19. class CCreatureWindow : public CIntObject
  20. {
  21. public:
  22. enum CreWinType {OTHER = 0, BATTLE = 1, ARMY = 2, HERO = 3}; //only last one should open permanently
  23. //bool active; //TODO: comment me
  24. int type;//0 - rclick popup; 1 - normal window
  25. int bonusRows; //height of skill window
  26. std::string count; //creature count in text format
  27. const CCreature *c; //related creature
  28. const CStackInstance *stack;
  29. const CBonusSystemNode *stackNode;
  30. const CGHeroInstance *heroOwner;
  31. std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
  32. std::vector<CBonusItem*> bonusItems;
  33. std::vector<LRClickableAreaWText*> spellEffects;
  34. CPicture *bitmap; //background
  35. CCreaturePic *anim; //related creature's animation
  36. MoraleLuckBox *luck, *morale;
  37. LRClickableAreaWTextComp * expArea; //displays exp details
  38. CArtPlace *creatureArtifact;
  39. CSlider * slider; //Abilities
  40. AdventureMapButton *dismiss, *upgrade, *ok;
  41. AdventureMapButton * leftArtRoll, * rightArtRoll; //artifact selection
  42. //TODO: Artifact drop
  43. boost::function<void()> dsm; //dismiss button callback
  44. boost::function<void()> Upg; //upgrade button callback
  45. CCreatureWindow(const CStack & stack, int type); //battle c-tor
  46. CCreatureWindow (const CStackInstance &stack, int Type); //pop-up c-tor
  47. CCreatureWindow(const CStackInstance &st, int Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //full garrison window
  48. CCreatureWindow(int Cid, int Type, int creatureCount); //c-tor
  49. void init(const CStackInstance *stack, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner);
  50. void showAll(SDL_Surface * to);
  51. void show(SDL_Surface * to);
  52. void printLine(int nr, const std::string &text, int baseVal, int val=-1, bool range=false);
  53. void recreateSkillList(int pos);
  54. ~CCreatureWindow(); //d-tor
  55. //void activate();
  56. //void deactivate();
  57. void close();
  58. void clickRight(tribool down, bool previousState); //call-in
  59. void sliderMoved(int newpos);
  60. //void keyPressed (const SDL_KeyboardEvent & key); //call-in
  61. void scrollArt(int dir);
  62. };
  63. class CBonusItem : public LRClickableAreaWTextComp //responsible for displaying creature skill, active or not
  64. {
  65. public:
  66. std::string name, description;
  67. CPicture * bonusGraphics;
  68. bool visible;
  69. CBonusItem();
  70. CBonusItem(const SRect &Pos, const std::string &Name, const std::string &Description, const std::string &graphicsName);
  71. ~CBonusItem();
  72. void setBonus (const Bonus &bonus);
  73. void showAll (SDL_Surface * to);
  74. };