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

Commit

Permalink
Support for coastal forts (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofmen authored and Idhrendur committed Sep 7, 2018
1 parent 6c324f6 commit 16963b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 14 additions & 6 deletions Vic2ToHoI4/Source/HOI4World/HoI4State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/
#include <fstream>
#include <random>

std::map<int, int> HoI4::State::fortLevels;
// Currently not populated anywhere, so no forts will be created from them; they
// exist for future support of forts.
std::map<int, int> HoI4::State::landFortLevels;
std::map<int, int> HoI4::State::coastFortLevels;

class dockyardProvince: commonItems::parser
{
Expand Down Expand Up @@ -252,8 +255,9 @@ void HoI4::State::output(const std::string& _filename) const
{
naval = navalBases.at(provnum);
}
int fort = fortLevels[provnum];
if (naval == 0 && fort == 0)
int bunker = landFortLevels[provnum];
int coastFort = coastFortLevels[provnum];
if (naval == 0 && bunker == 0 && coastFort == 0)
{
continue;
}
Expand All @@ -262,9 +266,13 @@ void HoI4::State::output(const std::string& _filename) const
{
out << "\t\t\t\tnaval_base = " << naval << "\n";
}
if (fort != 0)
if (bunker != 0)
{
out << "\t\t\t\tbunker = " << fort << "\n";
out << "\t\t\t\tbunker = " << bunker << "\n";
}
if (coastFort != 0)
{
out << "\t\t\t\tcoastal_bunker = " << coastFort << "\n";
}
out << "\t\t\t}\n";
}
Expand Down Expand Up @@ -648,4 +656,4 @@ bool HoI4::State::amICoastal(const coastalProvinces& theCoastalProvinces)
bool HoI4::State::isProvinceInState(int provinceNum)
{
return (provinces.count(provinceNum) > 0);
}
}
3 changes: 2 additions & 1 deletion Vic2ToHoI4/Source/HOI4World/HoI4State.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ class State: commonItems::parser
std::set<int> debugVictoryPoints;
std::set<int> secondaryDebugVictoryPoints;

static std::map<int, int> fortLevels;
static std::map<int, int> landFortLevels;
static std::map<int, int> coastFortLevels;
};

}
Expand Down

0 comments on commit 16963b6

Please sign in to comment.