OpenXcom  1.0
Open-source clone of the original X-Com
DebriefingState.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "../Engine/State.h"
21 #include <string>
22 #include <vector>
23 #include <map>
24 #include "../Savegame/SavedGame.h"
25 
26 namespace OpenXcom
27 {
28 
29 class TextButton;
30 class Window;
31 class Text;
32 class TextList;
33 class BattleItem;
34 class Craft;
35 class Base;
36 class Region;
37 class Country;
38 class RuleItem;
39 class BattleUnit;
40 struct UnitStats;
41 
43  std::string item;
44  int qty;
45  int score;
46  bool recovery;
47 
48  DebriefingStat(const std::string &_item, bool _recovery) : item(_item), qty(0), score(0), recovery(_recovery) {};
49  };
50 
51 struct ReequipStat { std::string item; int qty; std::string craft; };
52 
53 struct RecoveryItem { std::string name; int value; };
54 
59 class DebriefingState : public State
60 {
61 private:
62  typedef std::pair<std::string, UnitStats> SoldierStatsEntry;
63 
64  Region *_region;
65  Country *_country;
66  Base *_base;
67  std::vector<DebriefingStat*> _stats;
68  std::vector<SoldierStatsEntry> _soldierStats;
69  TextButton *_btnOk, *_btnStats;
70  Window *_window;
71  Text *_txtTitle, *_txtItem, *_txtQuantity, *_txtScore, *_txtRecovery, *_txtRating,
72  *_txtSoldier, *_txtTU, *_txtStamina, *_txtHealth, *_txtBravery, *_txtReactions,
73  *_txtFiring, *_txtThrowing, *_txtMelee, *_txtStrength, *_txtPsiStrength, *_txtPsiSkill;
74  TextList *_lstStats, *_lstRecovery, *_lstTotal, *_lstSoldierStats;
75  std::string _currentTooltip;
76  Text *_txtTooltip;
77  std::vector<ReequipStat> _missingItems;
78  std::map<RuleItem*, int> _rounds;
79  std::map<int, RecoveryItem*> _recoveryStats;
80  bool _positiveScore, _noContainment, _manageContainment, _destroyBase;
81  int _limitsEnforced;
82  MissionStatistics *_missionStatistics;
83  std::vector<Soldier*> _soldiersCommended, _deadSoldiersCommended;
85  void addStat(const std::string &name, int quantity, int score);
87  void prepareDebriefing();
89  void recoverItems(std::vector<BattleItem*> *from, Base *base);
91  void recoverAlien(BattleUnit *from, Base *base);
93  void reequipCraft(Base *base, Craft *craft, bool vehicleItemsCanBeDestroyed);
95  bool _showSoldierStats;
97  void applyVisibility();
99  std::string makeSoldierString(int stat);
100 public:
102  DebriefingState();
106  void btnOkClick(Action *action);
107  void init();
109  void btnStatsClick(Action *action);
111  void txtTooltipIn(Action *action);
113  void txtTooltipOut(Action *action);
114 };
115 
116 }
void txtTooltipIn(Action *action)
Handler for showing tooltip.
Definition: DebriefingState.cpp:635
Represents a craft stored in a base.
Definition: Craft.h:45
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
~DebriefingState()
Cleans up the Debriefing state.
Definition: DebriefingState.cpp:553
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Box with a coloured border and custom background.
Definition: Window.h:40
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: DebriefingState.cpp:666
void btnStatsClick(Action *action)
Handler for clicking the STATS button.
Definition: DebriefingState.cpp:656
List of Text&#39;s split into columns.
Definition: TextList.h:40
Text string displayed on screen.
Definition: Text.h:40
Debriefing screen shown after a Battlescape mission that displays the results.
Definition: DebriefingState.h:59
Container for mission statistics.
Definition: MissionStatistics.h:33
Definition: DebriefingState.h:51
Represents a player base on the globe.
Definition: Base.h:45
Definition: DebriefingState.h:53
void txtTooltipOut(Action *action)
Handler for hiding tooltip.
Definition: DebriefingState.cpp:644
Coloured button with a text label.
Definition: TextButton.h:38
Definition: DebriefingState.h:42
void init()
Initializes the state.
Definition: DebriefingState.cpp:613
Represents a region of the world.
Definition: Region.h:33
Represents a country that funds the player.
Definition: Country.h:33
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:59
DebriefingState()
Creates the Debriefing state.
Definition: DebriefingState.cpp:76
Definition: BaseInfoState.cpp:40