From 0b57783a912087f6974124bf620d8c9f973e76b9 Mon Sep 17 00:00:00 2001 From: idhrendur Date: Tue, 29 Jan 2013 19:18:55 -0800 Subject: [PATCH 1/2] Fix crash bug from HRE title being destroyed --- Data Files/Changelog.txt | 9 ++++++++- Source/CK2World/CK2World.cpp | 3 +++ Source/EU3World/EU3World.cpp | 15 +++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Data Files/Changelog.txt b/Data Files/Changelog.txt index 7e276f69f..a8924bd4c 100644 --- a/Data Files/Changelog.txt +++ b/Data Files/Changelog.txt @@ -306,4 +306,11 @@ Revision Log Message 300 Rename CK2+ readme file 301 Log when government gets default conversion 302 EU3 vassals never have vassals -303 Juniors in a PU never have vassals \ No newline at end of file +303 Juniors in a PU never have vassals + + + + + + +310 Fix crash bug from HRE title being destroyed \ No newline at end of file diff --git a/Source/CK2World/CK2World.cpp b/Source/CK2World/CK2World.cpp index 0f2e8b1a9..0c19f80f3 100644 --- a/Source/CK2World/CK2World.cpp +++ b/Source/CK2World/CK2World.cpp @@ -26,9 +26,12 @@ CK2World::CK2World() dynasties.clear(); characters.clear(); traits.clear(); + potentialTitles.clear(); titles.clear(); + hreTitle = NULL; provinces.clear(); baronies.clear(); + wars.clear(); } diff --git a/Source/EU3World/EU3World.cpp b/Source/EU3World/EU3World.cpp index 859119f71..455a9cf61 100644 --- a/Source/EU3World/EU3World.cpp +++ b/Source/EU3World/EU3World.cpp @@ -217,8 +217,8 @@ EU3World::EU3World(CK2World* _srcWorld, EU3Tech* _techData) options[LUCKY_NATIONS] = 2; } - diplomacy = new EU3Diplomacy(); - + diplomacy = new EU3Diplomacy(); + hreEmperor = NULL; japaneseEmperor = NULL; daimyos.clear(); shogun = NULL; @@ -244,7 +244,10 @@ void EU3World::output(FILE* output) fprintf(output, "}\n"); fprintf(output, "start_date=\"%s\"\n", startDate.toString().c_str()); outputTempHeader2(output); - fprintf(output, "emperor=\"%s\"\n", hreEmperor->getTag().c_str()); + if (hreEmperor != NULL) + { + fprintf(output, "emperor=\"%s\"\n", hreEmperor->getTag().c_str()); + } fprintf(output, "imperial_influence=20.000\n"); fprintf(output, "internal_hre_cb=yes\n"); for (map::iterator i = provinces.begin(); i != provinces.end(); i++) @@ -1008,7 +1011,11 @@ void EU3World::assignTags(Object* rulesObj, vector& blockedNations, cons } determineMapSpread(); - hreEmperor = srcWorld->getHRETitle()->getHolder()->getPrimaryTitle()->getDstCountry(); + CK2Title* hreTitle = srcWorld->getHRETitle(); + if (hreTitle != NULL) + { + hreEmperor = hreTitle->getHolder()->getPrimaryTitle()->getDstCountry(); + } } From c3c638543cd6e37d64e67989e6271a501fc8d64e Mon Sep 17 00:00:00 2001 From: idhrendur Date: Wed, 30 Jan 2013 19:36:10 -0800 Subject: [PATCH 2/2] Fix resaving bug --- Data Files/Changelog.txt | 3 ++- Source/EU3World/EU3Country.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Data Files/Changelog.txt b/Data Files/Changelog.txt index a8924bd4c..37c737c71 100644 --- a/Data Files/Changelog.txt +++ b/Data Files/Changelog.txt @@ -313,4 +313,5 @@ Revision Log Message -310 Fix crash bug from HRE title being destroyed \ No newline at end of file +310 Fix crash bug from HRE title being destroyed +311 Fix resaving bug \ No newline at end of file diff --git a/Source/EU3World/EU3Country.cpp b/Source/EU3World/EU3Country.cpp index 5a4500536..978b63429 100644 --- a/Source/EU3World/EU3Country.cpp +++ b/Source/EU3World/EU3Country.cpp @@ -650,7 +650,7 @@ void EU3Country::output(FILE* output) { fprintf(output, "\tgalley=\"%s\"\n", galley.c_str()); } - if(infantry != "") + if(transport != "") { fprintf(output, "\ttransport=\"%s\"\n", transport.c_str()); }