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

Commit

Permalink
Add second method of tech group conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Idhrendur committed Mar 25, 2013
1 parent be362bb commit 678aa03
Show file tree
Hide file tree
Showing 9 changed files with 359 additions and 61 deletions.
3 changes: 2 additions & 1 deletion Data Files/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,5 @@ Revision Log Message
351
352
353
354 Unlanded countries inherit tech group from holder of their potential capital
354 Unlanded countries inherit tech group from holder of their potential capital
355 Add second method of tech group conversion
7 changes: 7 additions & 0 deletions Data Files/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ configuration =
CK2directory = "D:\Paradox Interactive\Crusader Kings II"


### Tech Options

# techGroupMethod: the method by which tech groups are determined. Options are:
# "learningRate" - use the CK2 learning rate to determine tech groups
# "culturalTech" - use the amount of tech gained in CK2, broken down by relious and culture groups, to determine tech. NOTE: do not use this option along with mods, as it relies heavily on default religions and cultures
techGroupMethod = "learningRate"


### Economy (base tax, manpower, and population) Options

Expand Down
19 changes: 11 additions & 8 deletions Source/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ Configuration::Configuration()

CK2Path = obj[0]->getLeaf("CK2directory");
EU3Path = obj[0]->getLeaf("EU3directory");
proxyMultiplierMethod = obj[0]->getLeaf("proxyMultiplierMethod");
multipleProvsMethod = obj[0]->getLeaf("multipleProvsMethod");
manpower = obj[0]->getLeaf("manpower");

techGroupMethod = obj[0]->getLeaf("techGroupMethod");

proxyMultiplierMethod = obj[0]->getLeaf("proxyMultiplierMethod");
multipleProvsMethod = obj[0]->getLeaf("multipleProvsMethod");
manpower = obj[0]->getLeaf("manpower");
manpowerblendamount = obj[0]->getLeaf("manpowerblendamount");
basetax = obj[0]->getLeaf("basetax");
basetax = obj[0]->getLeaf("basetax");
basetaxblendamount = obj[0]->getLeaf("basetaxblendamount");
population = obj[0]->getLeaf("population");
population = obj[0]->getLeaf("population");
populationblendamount = obj[0]->getLeaf("populationblendamount");
HRETitle = obj[0]->getLeaf("HRETitle");
mergeTitles = obj[0]->getLeaf("mergeTitles");
vassalScore = obj[0]->getLeaf("vassalScore");
HRETitle = obj[0]->getLeaf("HRETitle");
mergeTitles = obj[0]->getLeaf("mergeTitles");
vassalScore = obj[0]->getLeaf("vassalScore");

advisors = obj[0]->getLeaf("advisors");
leaders = obj[0]->getLeaf("leaders");
Expand Down
8 changes: 8 additions & 0 deletions Source/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class Configuration // Singleton
return getInstance()->EU3Path;
}

static string getTechGroupMethod()
{
return getInstance()->techGroupMethod;
}

static string getProxyMultiplierMethod()
{
return getInstance()->proxyMultiplierMethod;
Expand Down Expand Up @@ -160,6 +165,9 @@ class Configuration // Singleton

string CK2Path;
string EU3Path;

string techGroupMethod;

string proxyMultiplierMethod;
string multipleProvsMethod;
string manpower;
Expand Down
21 changes: 21 additions & 0 deletions Source/EU3World/EU3Country.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,27 @@ void EU3Country::determineLearningScore()
learningScore /= numBaronies;
}

void EU3Country::determineTechScore()
{
int numProvinces = 0;
for (vector<EU3Province*>::iterator provinceItr = provinces.begin(); provinceItr < provinces.end(); provinceItr++)
{
vector<CK2Province*> srcProvinces = (*provinceItr)->getSrcProvinces();
for (vector<CK2Province*>::iterator srcItr = srcProvinces.begin(); srcItr < srcProvinces.end(); srcItr++)
{
vector<double> techLevels = (*srcItr)->getTechLevels();
for (unsigned int i = 0; i < techLevels.size(); i++)
{
techScore += techLevels[i] / 24;
}
numProvinces++;
}
}

techScore /= numProvinces;
}



void EU3Country::addAcceptedCultures()
{
Expand Down
3 changes: 3 additions & 0 deletions Source/EU3World/EU3Country.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class EU3Country

void output(FILE*);
void determineLearningScore();
void determineTechScore();
void addAcceptedCultures();
void determineGovernment(double prestigeFactor);
void determineEconomy(const cultureGroupMapping& cultureGroups, const map<string, double>& unitPrices);
Expand Down Expand Up @@ -61,6 +62,7 @@ class EU3Country
vector<EU3Province*> getCores() const { return cores; };
vector<EU3Advisor*> getAdvisors() const { return advisors; };
double getLearningScore() const { return learningScore; };
double getTechScore() const { return techScore; };
int getAbsorbScore() const { return absorbScore; };
string getTag() const { return tag; };
string getGovernment() const { return government; };
Expand All @@ -82,6 +84,7 @@ class EU3Country
vector<EU3Province*> cores;
vector<EU3Advisor*> advisors;
double learningScore;
double techScore;
int absorbScore;

string tag;
Expand Down
Loading

0 comments on commit 678aa03

Please sign in to comment.