Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Commit

Permalink
One last cleanup (for now) of HoI4World
Browse files Browse the repository at this point in the history
  • Loading branch information
Idhrendur committed Jan 24, 2017
1 parent 72d1a22 commit b0cffa0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 50 deletions.
42 changes: 20 additions & 22 deletions Vic2ToHoI4/Source/HOI4World/HoI4World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,30 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/



#include "HoI4World.h"
#include <fstream>
#include <algorithm>
#include <list>
#include <queue>
#include <unordered_map>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include "ParadoxParser8859_15.h"
#include "ParadoxParserUTF8.h"
#include "Log.h"
#include "OSCompatibilityLayer.h"
#include "../Configuration.h"
#include "../V2World/Vic2Agreement.h"
#include "../V2World/V2Diplomacy.h"
#include "../V2World/V2Province.h"
#include "../V2World/V2Party.h"
#include "HoI4Agreement.h"
#include "HoI4Buildings.h"
#include "HoI4Country.h"
#include "HoI4Diplomacy.h"
#include "HoI4Events.h"
#include "HoI4Faction.h"
#include "HoI4Focus.h"
#include "HoI4FocusTree.h"
#include "HoI4Relations.h"
#include "HoI4Localisation.h"
#include "HoI4Province.h"
#include "HoI4State.h"
#include "HoI4StrategicRegion.h"
#include "HoI4SupplyZones.h"
#include "HoI4WarCreator.h"
#include "../Mappers/CountryMapping.h"
#include "../Mappers/ProvinceMapper.h"
#include "../Mappers/StateMapper.h"
#include <fstream>
using namespace std;




Expand All @@ -63,6 +59,8 @@ HoI4World::HoI4World(const V2World* _sourceWorld)
events = new HoI4Events;
supplyZones = new HoI4SupplyZones(HoI4DefaultStateToProvinceMap);

diplomacy = new HoI4Diplomacy;

states->convertStates();
convertNavalBases();
convertCountries();
Expand Down Expand Up @@ -136,14 +134,14 @@ void HoI4World::convertCountry(pair<string, V2Country*> country, map<int, int>&
return;
}

HoI4Country* destCountry = NULL;
HoI4Country* destCountry = nullptr;
const std::string& HoI4Tag = CountryMapper::getHoI4Tag(country.first);
if (!HoI4Tag.empty())
{
std::string countryFileName = '/' + country.second->getName("english") + ".txt";
destCountry = new HoI4Country(HoI4Tag, countryFileName, this, true);
V2Party* rulingParty = country.second->getRulingParty(sourceWorld->getParties());
if (rulingParty == NULL)
if (rulingParty == nullptr)
{
LOG(LogLevel::Error) << "Could not find the ruling party for " << country.first << ". Were all mods correctly included?";
exit(-1);
Expand Down Expand Up @@ -651,7 +649,7 @@ void HoI4World::convertAgreements()
if ((agreement->type == "alliance") || (agreement->type == "vassal"))
{
HoI4Agreement* HoI4a = new HoI4Agreement(HoI4Tag1, HoI4Tag2, agreement);
diplomacy.addAgreement(HoI4a);
diplomacy->addAgreement(HoI4a);
}

if (agreement->type == "alliance")
Expand Down Expand Up @@ -682,17 +680,17 @@ void HoI4World::convertRelations()
}

HoI4Agreement* HoI4a = new HoI4Agreement(country1, country2, "relation", relationItr.second->getRelations(), date("1936.1.1"));
diplomacy.addAgreement(HoI4a);
diplomacy->addAgreement(HoI4a);

if (relationItr.second->getGuarantee())
{
HoI4Agreement* HoI4a = new HoI4Agreement(country.first, relationItr.first, "guarantee", 0, date("1936.1.1"));
diplomacy.addAgreement(HoI4a);
diplomacy->addAgreement(HoI4a);
}
if (relationItr.second->getSphereLeader())
{
HoI4Agreement* HoI4a = new HoI4Agreement(country.first, relationItr.first, "sphere", 0, date("1936.1.1"));
diplomacy.addAgreement(HoI4a);
diplomacy->addAgreement(HoI4a);
}
}
}
Expand Down Expand Up @@ -1082,7 +1080,7 @@ void HoI4World::output() const
outputColorsfile();
HoI4Localisation::output();
states->output();
diplomacy.output();
diplomacy->output();
outputMap();
supplyZones->output();
outputRelations();
Expand Down
52 changes: 25 additions & 27 deletions Vic2ToHoI4/Source/HOI4World/HoI4World.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,29 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
#ifndef HoI4WORLD_H_
#define HoI4WORLD_H_

#include <string>
#include "HoI4Buildings.h"
#include "HoI4Country.h"
#include "HoI4Province.h"
#include "HoI4Diplomacy.h"
#include "HoI4Events.h"
#include "HoI4Localisation.h"
#include "HoI4States.h"
#include "HoI4StrategicRegion.h"



typedef const map<string, multimap<HoI4RegimentType, unsigned> > unitTypeMapping;
#include "HoI4States.h"
#include "../Mappers/Mapper.h"
#include <map>
#include <string>
#include <vector>
using namespace std;



class HoI4Buildings;
class HoI4Country;
class HoI4Diplomacy;
class HoI4Events;
class HoI4Faction;
class HoI4Province;
class HoI4State;
class HoI4States;
class HoI4StrategicRegion;
class HoI4SupplyZones;
class V2Country;
class V2World;



Expand Down Expand Up @@ -135,31 +140,24 @@ class HoI4World

const V2World* sourceWorld;

HoI4States* states;
//map<int, HoI4Province*> provinces;

HoI4SupplyZones* supplyZones;
map<int, HoI4StrategicRegion*> strategicRegions;
HoI4Buildings* buildings;

map<string, HoI4Country*> countries;
map<string, HoI4Country*> landedCountries;
vector<HoI4Country*> greatPowers;

HoI4States* states;

map<int, HoI4Province*> provinces;
map<string, HoI4Country*> countries;
map<string, HoI4Country*> landedCountries;
HoI4Diplomacy diplomacy;
map<int, int> stateMap;

// map items
map<int, string> continents; // < province, continent >
map<int, HoI4StrategicRegion*> strategicRegions;

vector<HoI4Faction*> factions;
HoI4Diplomacy* diplomacy;
HoI4Events* events;

leaderTraitsMap leaderTraits;
namesMapping namesMap;
portraitMapping portraitMap;

vector<HoI4Faction*> factions;

HoI4Buildings* buildings;
};


Expand Down
2 changes: 1 addition & 1 deletion Vic2ToHoI4/Source/V2World/V2Country.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ V2Party* V2Country::getRulingParty(const vector<V2Party*>& allParties) const
}
else
{
return NULL;
return nullptr;
}
}

Expand Down

0 comments on commit b0cffa0

Please sign in to comment.