Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial funding adjust #696

Merged
merged 15 commits into from Oct 20, 2013
1 change: 1 addition & 0 deletions bin/data/Ruleset/Xcom1Ruleset.rul
Expand Up @@ -8607,6 +8607,7 @@ costSoldier: 20000
costEngineer: 25000
costScientist: 30000
timePersonnel: 72
initialFunding: 6000
ufoTrajectories:
- id: P0
groundTimer: 3000
Expand Down
5 changes: 3 additions & 2 deletions src/Ruleset/Ruleset.cpp
Expand Up @@ -66,7 +66,7 @@ namespace OpenXcom
/**
* Creates a ruleset with blank sets of rules.
*/
Ruleset::Ruleset() : _costSoldier(0), _costEngineer(0), _costScientist(0), _timePersonnel(0), _startingTime(6, 1, 1, 1999, 12, 0, 0), _modIndex(0), _facilityListOrder(0), _craftListOrder(0), _itemListOrder(0), _researchListOrder(0), _manufactureListOrder(0), _ufopaediaListOrder(0)
Ruleset::Ruleset() : _costSoldier(0), _costEngineer(0), _costScientist(0), _timePersonnel(0), _initialFunding(0), _startingTime(6, 1, 1, 1999, 12, 0, 0), _modIndex(0), _facilityListOrder(0), _craftListOrder(0), _itemListOrder(0), _researchListOrder(0), _manufactureListOrder(0), _ufopaediaListOrder(0)
{
// Check in which data dir the folder is stored
std::string path = CrossPlatform::getDataFolder("SoldierName/");
Expand Down Expand Up @@ -507,6 +507,7 @@ void Ruleset::loadFile(const std::string &filename)
_costEngineer = doc["costEngineer"].as<int>(_costEngineer);
_costScientist = doc["costScientist"].as<int>(_costScientist);
_timePersonnel = doc["timePersonnel"].as<int>(_timePersonnel);
_initialFunding = doc["initialFunding"].as<int>(_initialFunding);
for (YAML::const_iterator i = doc["ufoTrajectories"].begin(); i != doc["ufoTrajectories"].end(); ++i)
{
std::string id = (*i)["id"].as<std::string>();
Expand Down Expand Up @@ -615,7 +616,7 @@ SavedGame *Ruleset::newSave() const
save->getCountries()->push_back(new Country(getCountry(*i)));
}
// Adjust funding to total $6M
int missing = ((6000 - save->getCountryFunding()/1000) / (int)save->getCountries()->size()) * 1000;
int missing = ((_initialFunding - save->getCountryFunding()/1000) / (int)save->getCountries()->size()) * 1000;
for (std::vector<Country*>::iterator i = save->getCountries()->begin(); i != save->getCountries()->end(); ++i)
{
(*i)->setFunding((*i)->getFunding().back() + missing);
Expand Down
2 changes: 1 addition & 1 deletion src/Ruleset/Ruleset.h
Expand Up @@ -92,7 +92,7 @@ class Ruleset
std::vector<std::pair<std::string, ExtraSprites *> > _extraSprites;
std::vector<std::pair<std::string, ExtraSounds *> > _extraSounds;
std::map<std::string, ExtraStrings *> _extraStrings;
int _costSoldier, _costEngineer, _costScientist, _timePersonnel;
int _costSoldier, _costEngineer, _costScientist, _timePersonnel, _initialFunding;
YAML::Node _startingBase;
GameTime _startingTime;
std::vector<std::string> _countriesIndex, _regionsIndex, _facilitiesIndex, _craftsIndex, _craftWeaponsIndex, _itemsIndex, _ufosIndex;
Expand Down