OpenXcom  1.0
Open-source clone of the original X-Com
Production.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 <yaml-cpp/yaml.h>
21 
22 namespace OpenXcom
23 {
24 
25 class RuleManufacture;
26 class Base;
27 class SavedGame;
28 class Mod;
29 enum productionProgress_e { PROGRESS_NOT_COMPLETE, PROGRESS_COMPLETE, PROGRESS_NOT_ENOUGH_MONEY, PROGRESS_NOT_ENOUGH_MATERIALS, PROGRESS_MAX, PROGRESS_CONSTRUCTION };
30 
32 {
33 public:
34  Production (const RuleManufacture * rules, int amount);
35  int getAmountTotal() const;
36  void setAmountTotal (int);
37  bool getInfiniteAmount() const;
38  void setInfiniteAmount (bool);
39  int getTimeSpent() const;
40  void setTimeSpent (int);
41  int getAmountProduced() const;
42  int getAssignedEngineers() const;
43  void setAssignedEngineers (int);
44  bool getSellItems() const;
45  void setSellItems (bool);
46  productionProgress_e step(Base * b, SavedGame * g, const Mod *m);
47  const RuleManufacture * getRules() const;
48  void startItem(Base * b, SavedGame * g, const Mod *m) const;
49  YAML::Node save() const;
50  void load(const YAML::Node &node);
51 private:
52  const RuleManufacture * _rules;
53  int _amount;
54  bool _infinite;
55  int _timeSpent;
56  int _engineers;
57  bool _sell;
58  bool haveEnoughMoneyForOneMoreUnit(SavedGame * g) const;
59  bool haveEnoughMaterialsForOneMoreUnit(Base * b, const Mod *m) const;
60 };
61 
62 }
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:99
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
Definition: Production.h:31
Represents a player base on the globe.
Definition: Base.h:45
Represents the information needed to manufacture an object.
Definition: RuleManufacture.h:30
Definition: BaseInfoState.cpp:40