Skip to content
Permalink
Browse files

Add "transferTime" property to ruleset soldiers.

  • Loading branch information
SupSuper committed Dec 5, 2018
1 parent 70aace3 commit 47d522c0f676d4c5b453671ac50328c5fb1fefa5
Showing with 19 additions and 3 deletions.
  1. +4 −1 src/Basescape/PurchaseState.cpp
  2. +12 −1 src/Mod/RuleSoldier.cpp
  3. +3 −1 src/Mod/RuleSoldier.h
@@ -338,7 +338,10 @@ void PurchaseState::btnOkClick(Action *)
for (int s = 0; s < i->amount; s++)
{
RuleSoldier *rule = (RuleSoldier*)i->rule;
t = new Transfer(_game->getMod()->getPersonnelTime());
int time = rule->getTransferTime();
if (time == 0)
time = _game->getMod()->getPersonnelTime();
t = new Transfer(time);
t->setSoldier(_game->getMod()->genSoldier(_game->getSavedGame(), rule->getType()));
_base->getTransfers()->push_back(t);
}
@@ -29,7 +29,7 @@ namespace OpenXcom
* type of soldier.
* @param type String defining the type.
*/
RuleSoldier::RuleSoldier(const std::string &type) : _type(type), _costBuy(0), _costSalary(0), _standHeight(0), _kneelHeight(0), _floatHeight(0), _femaleFrequency(50), _value(20)
RuleSoldier::RuleSoldier(const std::string &type) : _type(type), _costBuy(0), _costSalary(0), _standHeight(0), _kneelHeight(0), _floatHeight(0), _femaleFrequency(50), _value(20), _transferTime(0)
{
}

@@ -67,6 +67,7 @@ void RuleSoldier::load(const YAML::Node &node, Mod *mod)
_floatHeight = node["floatHeight"].as<int>(_floatHeight);
_femaleFrequency = node["femaleFrequency"].as<int>(_femaleFrequency);
_value = node["value"].as<int>(_value);
_transferTime = node["transferTime"].as<int>(_transferTime);

if (node["deathMale"])
{
@@ -283,4 +284,14 @@ int RuleSoldier::getValue() const
return _value;
}

/**
* Gets the amount of time this item
* takes to arrive at a base.
* @return The time in hours.
*/
int RuleSoldier::getTransferTime() const
{
return _transferTime;
}

}
@@ -40,7 +40,7 @@ class RuleSoldier
UnitStats _minStats, _maxStats, _statCaps;
std::string _armor;
int _costBuy, _costSalary, _standHeight, _kneelHeight, _floatHeight;
int _femaleFrequency, _value;
int _femaleFrequency, _value, _transferTime;
std::vector<int> _deathSoundMale, _deathSoundFemale;
std::vector<SoldierNamePool*> _names;

@@ -84,6 +84,8 @@ class RuleSoldier
const std::vector<SoldierNamePool*> &getNames() const;
/// Gets the value - for score calculation.
int getValue() const;
/// Gets the soldier's transfer time.
int getTransferTime() const;
};

}

0 comments on commit 47d522c

Please sign in to comment.
You can’t perform that action at this time.