diff --git a/src/extensions/scenario/scenarioext.cpp b/src/extensions/scenario/scenarioext.cpp index bcf5f38e8..3e71c2ea8 100644 --- a/src/extensions/scenario/scenarioext.cpp +++ b/src/extensions/scenario/scenarioext.cpp @@ -41,7 +41,8 @@ * @author: CCHyper */ ScenarioClassExtension::ScenarioClassExtension(const ScenarioClass *this_ptr) : - GlobalExtensionClass(this_ptr) + GlobalExtensionClass(this_ptr), + SidebarSide(SIDE_NONE) { //if (this_ptr) EXT_DEBUG_TRACE("ScenarioClassExtension::ScenarioClassExtension - 0x%08X\n", (uintptr_t)(ThisPtr)); diff --git a/src/extensions/scenario/scenarioext.h b/src/extensions/scenario/scenarioext.h index 67af04b02..96e296093 100644 --- a/src/extensions/scenario/scenarioext.h +++ b/src/extensions/scenario/scenarioext.h @@ -51,7 +51,11 @@ class ScenarioClassExtension final : public GlobalExtensionClass virtual const char *Full_Name() const override { return "Scenario"; } void Init_Clear(); + bool Read_INI(CCINIClass &ini); public: - + /** + * x + */ + SideType SidebarSide; }; diff --git a/src/extensions/scenario/scenarioext_hooks.cpp b/src/extensions/scenario/scenarioext_hooks.cpp index ed51ed3a3..af531041f 100644 --- a/src/extensions/scenario/scenarioext_hooks.cpp +++ b/src/extensions/scenario/scenarioext_hooks.cpp @@ -492,6 +492,16 @@ static bool Read_Scenario_INI_Init_Side(CCINIClass &ini) ASSERT_FATAL_PRINT(Scen->SpeechSide != SIDE_NONE && Scen->SpeechSide < Sides.Count(), "Invalid \"SpeechSide\" value in [Basic] section!"); + /** + * #issue-309 + * + * Read sidebar side override. + */ + ScenExtension->SidebarSide = housetype->Side; + ScenExtension->SidebarSide = ini.Get_SideType("Basic", "SidebarSide", ScenExtension->SidebarSide); + + ASSERT_FATAL_PRINT(ScenExtension->SidebarSide != SIDE_NONE && ScenExtension->SidebarSide < Sides.Count(), "Invalid \"SidebarSide\" value in [Basic] section!"); + } else { #if 0 @@ -510,6 +520,7 @@ static bool Read_Scenario_INI_Init_Side(CCINIClass &ini) Scen->IsGDI = (unsigned char)housetype->Side & 0xFF; Scen->SpeechSide = housetype->Side; + ScenExtension->SidebarSide = housetype->Side; } @@ -546,9 +557,9 @@ static bool Read_Scenario_INI_Prep_For_Side() #endif DEBUG_INFO("Calling Prep_For_Side()...\n"); - if (!Prep_For_Side(housetype->Side)) { + if (!Prep_For_Side(ScenExtension->SidebarSide)) { - DEBUG_WARNING("Prep_For_Side(%d) failed! Trying with side 0...\n", housetype->Side); + DEBUG_WARNING("Prep_For_Side(%d) failed! Trying with side 0...\n", ScenExtension->SidebarSide); /** * Try once again but with the Side 0 (GDI) assets. diff --git a/src/vinifera/vinifera_saveload.cpp b/src/vinifera/vinifera_saveload.cpp index d96d32ffb..8b951314a 100644 --- a/src/vinifera/vinifera_saveload.cpp +++ b/src/vinifera/vinifera_saveload.cpp @@ -106,6 +106,8 @@ #include "addon.h" #include "ccini.h" +#include "scenarioext.h" + /** * Constant of the current build version number. This number should be @@ -509,7 +511,7 @@ bool Vinifera_Get_All(IStream *pStm, bool load_net) * Fetch the houses side type and use this to decide which assets to load. */ DEBUG_INFO("About to call Prep_For_Side()...\n"); - if (!Prep_For_Side(housetype->Side)) { + if (!Prep_For_Side(ScenExtension->SidebarSide)) { DEBUG_WARNING("Prep_For_Side(%d) failed! Trying with side '%d'...\n", housetype->Side); /**