OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Transfer.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_TRANSFER_H
20 #define OPENXCOM_TRANSFER_H
21 
22 #include <string>
23 #include <yaml-cpp/yaml.h>
24 
25 namespace OpenXcom
26 {
27 
28 enum TransferType { TRANSFER_SOLDIER, TRANSFER_CRAFT, TRANSFER_ITEM, TRANSFER_SCIENTIST, TRANSFER_ENGINEER };
29 
30 class Soldier;
31 class Craft;
32 class Language;
33 class Base;
34 class Ruleset;
35 class SavedGame;
36 
42 class Transfer
43 {
44 private:
45  int _hours;
46  Soldier *_soldier;
47  Craft *_craft;
48  std::string _itemId;
49  int _itemQty, _scientists, _engineers;
50  bool _delivered;
51 public:
53  Transfer(int hours);
55  ~Transfer();
57  bool load(const YAML::Node& node, Base *base, const Ruleset *rule, SavedGame *save);
59  YAML::Node save() const;
61  void setSoldier(Soldier *soldier);
63  void setCraft(Craft *craft);
65  Craft *getCraft();
67  std::string getItems() const;
69  void setItems(const std::string &id, int qty = 1);
71  void setScientists(int scientists);
73  void setEngineers(int engineers);
75  std::wstring getName(Language *lang) const;
77  int getHours() const;
79  int getQuantity() const;
81  TransferType getType() const;
83  void advance(Base *base);
86 
87 };
88 
89 }
90 
91 #endif
void advance(Base *base)
Advances the transfer.
Definition: Transfer.cpp:285
Represents a craft stored in a base.
Definition: Craft.h:44
int getQuantity() const
Gets the quantity of the transfer.
Definition: Transfer.cpp:238
int getHours() const
Gets the hours remaining of the transfer.
Definition: Transfer.cpp:229
Transfer(int hours)
Creates a new transfer.
Definition: Transfer.cpp:34
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:80
Represents an item transfer.
Definition: Transfer.h:42
void setItems(const std::string &id, int qty=1)
Sets the items of the transfer.
Definition: Transfer.cpp:174
Soldier * getSoldier()
Get a pointer to the soldier being transferred.
Definition: Transfer.cpp:320
~Transfer()
Cleans up the transfer.
Definition: Transfer.cpp:41
Contains strings used throughout the game for localization.
Definition: Language.h:42
Set of rules and stats for a game.
Definition: Ruleset.h:69
bool load(const YAML::Node &node, Base *base, const Ruleset *rule, SavedGame *save)
Loads the transfer from YAML.
Definition: Transfer.cpp:58
Represents a soldier hired by the player.
Definition: Soldier.h:49
YAML::Node save() const
Saves the transfer to YAML.
Definition: Transfer.cpp:101
void setCraft(Craft *craft)
Sets the craft of the transfer.
Definition: Transfer.cpp:146
Represents a player base on the globe.
Definition: Base.h:47
std::wstring getName(Language *lang) const
Gets the name of the transfer.
Definition: Transfer.cpp:203
TransferType getType() const
Gets the type of the transfer.
Definition: Transfer.cpp:259
void setScientists(int scientists)
Sets the scientists of the transfer.
Definition: Transfer.cpp:184
Craft * getCraft()
Gets the craft of the transfer.
Definition: Transfer.cpp:155
void setSoldier(Soldier *soldier)
Sets the soldier of the transfer.
Definition: Transfer.cpp:137
std::string getItems() const
Gets the items of the transfer.
Definition: Transfer.cpp:164
void setEngineers(int engineers)
Sets the engineers of the transfer.
Definition: Transfer.cpp:193