From 418cf24039043d499ae6c6b75cedfa59ba955faa Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 3 Sep 2021 05:15:54 +0000 Subject: [PATCH] misc fixes (by rftr): - cleaned up warnings in Rebel Command.cpp - ARC: Draft directive is hidden if volunteer pool option is disabled - fixed dropdown menu behaviour at the RIS website git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9163 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/Intelmarket.cpp | 53 ++++++++++++++++++------------------- Strategic/Rebel Command.cpp | 16 +++++------ 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/Laptop/Intelmarket.cpp b/Laptop/Intelmarket.cpp index f4568cca..ee5e691e 100644 --- a/Laptop/Intelmarket.cpp +++ b/Laptop/Intelmarket.cpp @@ -263,6 +263,32 @@ void IntelBuyButtonCallback( GUI_BUTTON *btn, INT32 reason ) void EnterIntelmarket() { + std::vector > dropdownvector; + + for ( INT16 i = 0; i < 16; ++i ) + { + if ( !( LaptopSaveInfo.usMapIntelFlags & ( 1 << i ) ) ) + { + swprintf( gIntelBuyMapPartNamesStr[i], szIntelWebsiteText[TEXT_INTEL_MAPREGION_1 + i] ); + gIntelBuyMapPartNamesStr[i][63] = '/0'; + + dropdownvector.push_back( std::make_pair( i, gIntelBuyMapPartNamesStr[i] ) ); + } + } + + if ( !dropdownvector.empty() ) + { + DropDownTemplate::getInstance().SetEntries( dropdownvector ); + DropDownTemplate::getInstance().SetHelpText( szIntelWebsiteText[TEXT_INTEL_DROPDOWN_HELPTEXT] ); + DropDownTemplate::getInstance().Create( LAPTOP_SCREEN_UL_X, MCA_START_CONTENT_Y + 40 ); + DropDownTemplate::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); + DropDownTemplate::getInstance().SetColorMarked( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); + } + else + { + DropDownTemplate::getInstance().ClearEntries(); + } + InitDefaults_IM(); BuildIntelInfoArray(); @@ -302,33 +328,6 @@ void HandleIntelmarket() { if ( fIntelRedraw ) { - UINT8 count = 0; - std::vector > dropdownvector; - - for ( INT16 i = 0; i < 16; ++i ) - { - if ( !( LaptopSaveInfo.usMapIntelFlags & ( 1 << i ) ) ) - { - swprintf( gIntelBuyMapPartNamesStr[i], szIntelWebsiteText[TEXT_INTEL_MAPREGION_1 + i] ); - gIntelBuyMapPartNamesStr[i][63] = '/0'; - - dropdownvector.push_back( std::make_pair( i, gIntelBuyMapPartNamesStr[i] ) ); - } - } - - if ( !dropdownvector.empty() ) - { - DropDownTemplate::getInstance().SetEntries( dropdownvector ); - DropDownTemplate::getInstance().SetHelpText( szIntelWebsiteText[TEXT_INTEL_DROPDOWN_HELPTEXT] ); - DropDownTemplate::getInstance().Create( LAPTOP_SCREEN_UL_X, MCA_START_CONTENT_Y + 40 ); - DropDownTemplate::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); - DropDownTemplate::getInstance().SetColorMarked( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); - } - else - { - DropDownTemplate::getInstance().ClearEntries(); - } - RenderIntelmarket(); fIntelRedraw = FALSE; diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 8013b36e..207488be 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -364,7 +364,7 @@ void DeployOrReactivateAdminTeam(INT16 regionId) if (rebelCommandSaveInfo.regions[regionId].adminStatus == RAS_INACTIVE) { - if (IsTownUnderCompleteControlByEnemy(regionId)) + if (IsTownUnderCompleteControlByEnemy(static_cast(regionId))) { DoLapTopMessageBox(MSG_BOX_LAPTOP_DEFAULT, szRebelCommandText[RCT_NOT_SAFE_TO_REACTIVATE_ADMIN_TEAM], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); return; @@ -622,13 +622,13 @@ void SetupAdminActionBox(const UINT8 actionIndex, const UINT16 descriptionText, y += 18; btnId = CreateTextButton(szRebelCommandText[RCT_PREV_ARROW], FONT10ARIAL, FONT_MCOLOR_LTYELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, x, y, 35, 18, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, [](GUI_BUTTON* btn, INT32 reason) { - ButtonHelper(btn, reason, [btn]() { adminActionChangeIndex--; if (adminActionChangeIndex < 0) adminActionChangeIndex = adminActionChangeList.size() - 1; }); + ButtonHelper(btn, reason, [btn]() { adminActionChangeIndex--; if (adminActionChangeIndex < 0) adminActionChangeIndex = static_cast(adminActionChangeList.size() - 1); }); }); adminActionChangeBtnIds.push_back(btnId); btnId = CreateTextButton(szRebelCommandText[RCT_NEXT_ARROW], FONT10ARIAL, FONT_MCOLOR_LTYELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, x+35, y, 35, 18, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, [](GUI_BUTTON* btn, INT32 reason) { - ButtonHelper(btn, reason, [btn]() { adminActionChangeIndex++; if (adminActionChangeIndex >= adminActionChangeList.size()) adminActionChangeIndex = 0; }); + ButtonHelper(btn, reason, [btn]() { adminActionChangeIndex++; if (adminActionChangeIndex >= static_cast(adminActionChangeList.size())) adminActionChangeIndex = 0; }); }); adminActionChangeBtnIds.push_back(btnId); @@ -753,7 +753,7 @@ BOOLEAN EnterWebsite() directivesList.push_back(std::make_pair(RCD_RAID_MINES, szRebelCommandDirectivesText[RCDT_RAID_MINES])); if (HighestPlayerProgressPercentage() >= gRebelCommandSettings.uCreateTurncoatsProgressRequirement) directivesList.push_back(std::make_pair(RCD_CREATE_TURNCOATS, szRebelCommandDirectivesText[RCDT_CREATE_TURNCOATS])); - if (HighestPlayerProgressPercentage() >= gRebelCommandSettings.uDraftProgressRequirement) + if (HighestPlayerProgressPercentage() >= gRebelCommandSettings.uDraftProgressRequirement && gGameExternalOptions.fMilitiaVolunteerPool == TRUE) directivesList.push_back(std::make_pair(RCD_DRAFT, szRebelCommandDirectivesText[RCDT_DRAFT])); REBEL_COMMAND_DROPDOWN.SetEntries(directivesList); @@ -2186,7 +2186,7 @@ void DailyUpdate() // increment supplies const UINT8 progress = CurrentPlayerProgressPercentage(); - iIncomingSuppliesPerDay = progress * gRebelCommandSettings.fIncomeModifier + static_cast((directive == RCD_GATHER_SUPPLIES ? rebelCommandSaveInfo.directives[RCD_GATHER_SUPPLIES].GetValue1() : 0)); + iIncomingSuppliesPerDay = static_cast(progress * gRebelCommandSettings.fIncomeModifier + (directive == RCD_GATHER_SUPPLIES ? rebelCommandSaveInfo.directives[RCD_GATHER_SUPPLIES].GetValue1() : 0)); rebelCommandSaveInfo.iSupplies += iIncomingSuppliesPerDay; // get regional bonuses @@ -2334,12 +2334,12 @@ void Init() } // set base values - iIncomingSuppliesPerDay = CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier; + iIncomingSuppliesPerDay = static_cast(CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier); rebelCommandSaveInfo.iSelectedDirective = RCD_GATHER_SUPPLIES; rebelCommandSaveInfo.iActiveDirective = RCD_GATHER_SUPPLIES; rebelCommandSaveInfo.iMilitiaStatsLevel = 0; // let's be nice and give some supplies to people who enable this feature partway through a campaign so they don't start from zero - rebelCommandSaveInfo.iSupplies = GetWorldDay() * CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier / 3; + rebelCommandSaveInfo.iSupplies = static_cast(GetWorldDay() * CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier / 3); // initialise admin actions -- first one is always supply line std::vector actions; @@ -2635,7 +2635,7 @@ template<> void DropDownTemplate::SetRefresh() using namespace RebelCommand; const INT16 newDirective = REBEL_COMMAND_DROPDOWN.GetSelectedEntryKey(); rebelCommandSaveInfo.iSelectedDirective = newDirective; - iIncomingSuppliesPerDay = CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier + static_cast((newDirective == RCD_GATHER_SUPPLIES ? rebelCommandSaveInfo.directives[RCD_GATHER_SUPPLIES].GetValue1() : 0)); + iIncomingSuppliesPerDay = static_cast(CurrentPlayerProgressPercentage() * gRebelCommandSettings.fIncomeModifier + (newDirective == RCD_GATHER_SUPPLIES ? rebelCommandSaveInfo.directives[RCD_GATHER_SUPPLIES].GetValue1() : 0)); redraw = TRUE; }