diff --git a/GameSettings.cpp b/GameSettings.cpp index 63c474ed..1d8a4e06 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -478,7 +478,9 @@ void LoadGameExternalOptions() gGameExternalOptions.gfUseAutoSave = iniReader.ReadBoolean("JA2 Gameplay Settings","USE_AUTO_SAVE",FALSE); // Militia settings + gGameExternalOptions.gfTrainVeteranMilitia = iniReader.ReadBoolean("JA2 Gameplay Settings","TRAIN_VETERAN_MILITIA",FALSE); gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_GROUPS",FALSE); + gGameExternalOptions.gfmusttrainroaming = iniReader.ReadBoolean("JA2 Gameplay Settings","MUST_TRAIN_MOBILE_MILITIA",FALSE); gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",FALSE); gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",FALSE); gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60); @@ -492,6 +494,7 @@ void LoadGameExternalOptions() gGameExternalOptions.iMaxMilitiaPerSector = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_MILITIA_PER_SECTOR",20); gGameExternalOptions.iTrainingSquadSize = iniReader.ReadInteger("JA2 Gameplay Settings","MAX_TRAINING_SQUAD_SIZE",10); gGameExternalOptions.iMilitiaTrainingCost = iniReader.ReadInteger("JA2 Gameplay Settings","MILITIA_TRAINING_COST",750); + gGameExternalOptions.iMilitiaCostModifier = iniReader.ReadInteger("JA2 Gameplay Settings","MILITIA_COST_MODIFIER",3); gGameExternalOptions.iMinLoyaltyToTrain = iniReader.ReadInteger("JA2 Gameplay Settings","MIN_LOYALTY_TO_TRAIN",20); //Assignment Settings (training, repairing, doctoring, etc) diff --git a/GameSettings.h b/GameSettings.h index 6a585808..f286bbd5 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -154,6 +154,7 @@ typedef struct INT32 iMaxMilitiaPerSector; INT32 iTrainingSquadSize; INT32 iMilitiaTrainingCost; + INT32 iMilitiaCostModifier; INT32 iMinLoyaltyToTrain; INT32 iMaxEnemyGroupSize; @@ -212,8 +213,9 @@ typedef struct // Militia Settings BOOLEAN fAllowTacticalMilitiaCommand; - + BOOLEAN gfTrainVeteranMilitia; BOOLEAN gfAllowMilitiaGroups; + BOOLEAN gfmusttrainroaming; BOOLEAN gfAllowReinforcements; BOOLEAN gfAllowReinforcementsOnlyInCity; UINT32 guiBaseQueenPoolIncrement; diff --git a/JA2.opt b/JA2.opt index ac1e1a2a..a37e8d81 100644 Binary files a/JA2.opt and b/JA2.opt differ diff --git a/JA2.plg b/JA2.plg index cdd30165..2dbe4381 100644 --- a/JA2.plg +++ b/JA2.plg @@ -6,7 +6,7 @@ --------------------Configuration: TileEngine - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2B.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP213.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/TileEngine.pch" /YX"TileEngine All.h" /Fo"Release/" /Fd"Release/" /FD /O2b2 /c "C:\JA2\Build\TileEngine\Ambient Control.cpp" @@ -46,8 +46,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2B.tmp" with content "C:\JA2\Build\TileEngine\worldman.cpp" "C:\JA2\Build\TileEngine\XML_ExplosionData.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2B.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2C.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP213.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP214.tmp" with contents [ /nologo /out:"Release\TileEngine.lib" ".\Release\Ambient Control.obj" @@ -87,7 +87,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2C.tmp" with content .\Release\worldman.obj .\Release\XML_ExplosionData.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2C.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP214.tmp"

Output Window

Compiling... Ambient Control.cpp @@ -132,7 +132,7 @@ Creating library... --------------------Configuration: Standard Gaming Platform - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2D.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP215.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NO_ZLIB" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR".\Release/" /Fp".\Release/Standard Gaming Platform.pch" /YX"JA2 SGP ALL.H" /Fo".\Release/" /Fd".\Release/" /FD /c "C:\JA2\Build\Standard Gaming Platform\Button Sound Control.cpp" @@ -172,14 +172,14 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2D.tmp" with content "C:\JA2\Build\Standard Gaming Platform\vsurface.cpp" "C:\JA2\Build\Standard Gaming Platform\WinFont.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2D.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2E.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP215.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP216.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NO_ZLIB" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /D "_DEBUG" /FR".\Release/" /Fp".\Release/Standard Gaming Platform.pch" /YX"JA2 SGP ALL.H" /Fo".\Release/" /Fd".\Release/" /FD /c "C:\JA2\Build\Standard Gaming Platform\DEBUG.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2E.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2F.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP216.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP217.tmp" with contents [ /nologo /out:".\Release\Standard Gaming Platform.lib" ".\Release\Button Sound Control.obj" @@ -221,7 +221,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2F.tmp" with content ".\Release\WinFont.obj" ".\ddraw.lib" ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP2F.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP217.tmp"

Output Window

Compiling... Button Sound Control.cpp @@ -275,7 +275,7 @@ Creating library... --------------------Configuration: Tactical - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP30.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP218.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /FR"Release/" /Fp"Release/Tactical.pch" /YX"Tactical All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Tactical\Air Raid.cpp" @@ -372,14 +372,14 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP30.tmp" with content "C:\JA2\Build\Tactical\XML_Sounds.cpp" "C:\JA2\Build\Tactical\XML_TonyInventory.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP30.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP31.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP218.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP219.tmp" with contents [ /nologo /MT /W3 /GX /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /FR"Release/" /Fp"Release/Tactical.pch" /YX"Tactical All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Tactical\LOS.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP31.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP32.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP219.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21A.tmp" with contents [ /nologo /out:"Release\Tactical.lib" ".\Release\Air Raid.obj" @@ -477,7 +477,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP32.tmp" with content .\Release\XML_Sounds.obj .\Release\XML_TonyInventory.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP32.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21A.tmp"

Output Window

Compiling... Air Raid.cpp @@ -586,7 +586,7 @@ Creating library... --------------------Configuration: Utils - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP33.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21B.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Utils.pch" /YX"Utils All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Utils\_DutchText.cpp" @@ -629,8 +629,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP33.tmp" with content "C:\JA2\Build\Utils\XML_Strings.cpp" "C:\JA2\Build\Utils\XML_Strings2.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP33.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP34.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21B.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21C.tmp" with contents [ /nologo /out:"Release\Utils.lib" .\Release\_DutchText.obj @@ -673,7 +673,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP34.tmp" with content .\Release\XML_Strings.obj .\Release\XML_Strings2.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP34.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21C.tmp"

Output Window

Compiling... _DutchText.cpp @@ -732,7 +732,7 @@ Creating library... --------------------Configuration: TacticalAI - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP35.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21D.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/TacticalAI.pch" /YX"AI All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\TacticalAI\AIList.cpp" @@ -750,8 +750,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP35.tmp" with content "C:\JA2\Build\TacticalAI\QuestDebug.cpp" "C:\JA2\Build\TacticalAI\Realtime.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP35.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP36.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21D.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21E.tmp" with contents [ /nologo /out:"Release\TacticalAI.lib" .\Release\AIList.obj @@ -769,7 +769,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP36.tmp" with content .\Release\QuestDebug.obj .\Release\Realtime.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP36.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21E.tmp"

Output Window

Compiling... AIList.cpp @@ -792,7 +792,7 @@ Creating library... --------------------Configuration: Editor - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP37.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21F.tmp" with contents [ /nologo /MT /W3 /GX /O2 /Ob2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Editor.pch" /YX"Editor All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Editor\Cursor Modes.cpp" @@ -820,8 +820,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP37.tmp" with content "C:\JA2\Build\Editor\smooth.cpp" "C:\JA2\Build\Editor\Smoothing Utils.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP37.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP38.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP21F.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP220.tmp" with contents [ /nologo /out:"Release\Editor.lib" ".\Release\Cursor Modes.obj" @@ -849,11 +849,10 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP38.tmp" with content .\Release\smooth.obj ".\Release\Smoothing Utils.obj" ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP38.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP220.tmp"

Output Window

Compiling... Cursor Modes.cpp -GENERATED PCH FOR EDITOR PROJECT. edit_sys.cpp Editor Callbacks.cpp Editor Modes.cpp @@ -882,7 +881,7 @@ Creating library... --------------------Configuration: Laptop - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP39.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP221.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Laptop.pch" /YX"Laptop All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Laptop\aim.cpp" @@ -943,8 +942,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP39.tmp" with content "C:\JA2\Build\Laptop\sirtech.cpp" "C:\JA2\Build\Laptop\Store Inventory.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP39.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3A.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP221.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP222.tmp" with contents [ /nologo /out:"Release\Laptop.lib" .\Release\aim.obj @@ -1005,7 +1004,7 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3A.tmp" with content .\Release\sirtech.obj ".\Release\Store Inventory.obj" ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3A.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP222.tmp"

Output Window

Compiling... aim.cpp @@ -1071,7 +1070,7 @@ Creating library... --------------------Configuration: Strategic - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3B.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP223.tmp" with contents [ /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Strategic.pch" /YX"Strategic All.h" /Fo"Release/" /Fd"Release/" /FD /c "C:\JA2\Build\Strategic\AI Viewer.cpp" @@ -1094,12 +1093,14 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3B.tmp" with content "C:\JA2\Build\Strategic\mapscreen.cpp" "C:\JA2\Build\Strategic\Meanwhile.cpp" "C:\JA2\Build\Strategic\Merc Contract.cpp" +"C:\JA2\Build\Strategic\MilitiaSquads.cpp" "C:\JA2\Build\Strategic\Player Command.cpp" "C:\JA2\Build\Strategic\PreBattle Interface.cpp" "C:\JA2\Build\Strategic\Queen Command.cpp" "C:\JA2\Build\Strategic\Quest Debug System.cpp" "C:\JA2\Build\Strategic\Quests.cpp" "C:\JA2\Build\Strategic\QuestText.cpp" +"C:\JA2\Build\Strategic\Reinforcement.cpp" "C:\JA2\Build\Strategic\Scheduling.cpp" "C:\JA2\Build\Strategic\Strategic AI.cpp" "C:\JA2\Build\Strategic\Strategic Event Handler.cpp" @@ -1115,11 +1116,9 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3B.tmp" with content "C:\JA2\Build\Strategic\strategic.cpp" "C:\JA2\Build\Strategic\strategicmap.cpp" "C:\JA2\Build\Strategic\Town Militia.cpp" -"C:\JA2\Build\Strategic\MilitiaSquads.cpp" -"C:\JA2\Build\Strategic\Reinforcement.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3B.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3C.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP223.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP224.tmp" with contents [ /nologo /out:"Release\Strategic.lib" ".\Release\AI Viewer.obj" @@ -1142,12 +1141,14 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3C.tmp" with content .\Release\mapscreen.obj .\Release\Meanwhile.obj ".\Release\Merc Contract.obj" +.\Release\MilitiaSquads.obj ".\Release\Player Command.obj" ".\Release\PreBattle Interface.obj" ".\Release\Queen Command.obj" ".\Release\Quest Debug System.obj" .\Release\Quests.obj .\Release\QuestText.obj +.\Release\Reinforcement.obj .\Release\Scheduling.obj ".\Release\Strategic AI.obj" ".\Release\Strategic Event Handler.obj" @@ -1163,10 +1164,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3C.tmp" with content .\Release\strategic.obj .\Release\strategicmap.obj ".\Release\Town Militia.obj" -.\Release\MilitiaSquads.obj -.\Release\Reinforcement.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3C.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP224.tmp"

Output Window

Compiling... AI Viewer.cpp @@ -1190,12 +1189,14 @@ Map Screen Interface.cpp mapscreen.cpp Meanwhile.cpp Merc Contract.cpp +MilitiaSquads.cpp Player Command.cpp PreBattle Interface.cpp Queen Command.cpp Quest Debug System.cpp Quests.cpp QuestText.cpp +Reinforcement.cpp Scheduling.cpp Strategic AI.cpp Strategic Event Handler.cpp @@ -1211,15 +1212,13 @@ Strategic Turns.cpp strategic.cpp strategicmap.cpp Town Militia.cpp -MilitiaSquads.cpp -Reinforcement.cpp Creating library...

--------------------Configuration: ja2 - Win32 Release--------------------

Command Lines

Creating command line "rc.exe /l 0x409 /fo"Release/ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" "C:\JA2\Build\Res\ja2.rc"" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3D.tmp" with contents +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP225.tmp" with contents [ /nologo /G5 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/JA2.pch" /YX"JA2 All.h" /Fo"Release/" /Fd"Release/" /FD /O2b2 /c "C:\JA2\Build\Utils\_Ja25GermanText.cpp" @@ -1246,8 +1245,8 @@ Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3D.tmp" with content "C:\JA2\Build\SCREENS.cpp" "C:\JA2\Build\Sys Globals.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3D.tmp" -Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3E.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP225.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP226.tmp" with contents [ libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"Release/ja2_cvs.map" /machine:I386 /out:"..\ja2_cvs.exe" .\Release\_Ja25GermanText.obj @@ -1284,7 +1283,7 @@ libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advap .\Laptop\Release\Laptop.lib .\Strategic\Release\Strategic.lib ] -Creating command line "link.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP3E.tmp" +Creating command line "link.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP226.tmp"

Output Window

Compiling resources... Compiling... @@ -1307,7 +1306,6 @@ Init.cpp Intro.cpp JA2 Splash.cpp jascreens.cpp -C:\JA2\Build\jascreens.cpp(269) : warning C4101: 'str' : unreferenced local variable Loading Screen.cpp MainMenuScreen.cpp MessageBoxScreen.cpp @@ -1322,7 +1320,7 @@ LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF

Results

-ja2_cvs.exe - 0 error(s), 2 warning(s) +ja2_cvs.exe - 0 error(s), 1 warning(s) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 8787d04e..2bf0d88b 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -1092,21 +1092,43 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) return( TRUE ); } - +// Kaiden: Roaming Militia Training: +// Commenting out the check for: +// IsMilitiaTrainableFromSoldiersSectorMaxed( +// At this point, we don't care if it's full yet BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier ) { - if( BasicCanCharacterTrainMilitia( pSoldier ) && + + if (gGameExternalOptions.gfmusttrainroaming) + { + if( BasicCanCharacterTrainMilitia( pSoldier ) && + MilitiaTrainingAllowedInSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && + DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) && + /*( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) == FALSE ) && */ + ( CountMilitiaTrainersInSoldiersSector( pSoldier ) < gGameExternalOptions.ubMaxMilitiaTrainersPerSector ) ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } + } + else + { + if( BasicCanCharacterTrainMilitia( pSoldier ) && MilitiaTrainingAllowedInSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) && ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) == FALSE ) && ( CountMilitiaTrainersInSoldiersSector( pSoldier ) < gGameExternalOptions.ubMaxMilitiaTrainersPerSector ) ) - { - return( TRUE ); - } - else - { - return( FALSE ); + { + return( TRUE ); + } + else + { + return( FALSE ); + } } } @@ -7372,7 +7394,12 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } - if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) ) + + // Kaiden: Roaming Militia Training: + // Added to the if test here: + // && (!gGameExternalOptions.gfmusttrainroaming) + + if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (!gGameExternalOptions.gfmusttrainroaming)) { if( bTownId == BLANK_SECTOR ) { @@ -7388,7 +7415,12 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); break; - } + } + + + + + if ( CountMilitiaTrainersInSoldiersSector( pSoldier ) >= gGameExternalOptions.ubMaxMilitiaTrainersPerSector ) { diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 783cdeda..260ea5b2 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -456,7 +456,9 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) if( !uiMilitiaCount )return; - // new squad + + //new squad + if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) { if( GetWorldHour() % gGameExternalOptions.guiCreateEachNHours )return; @@ -481,35 +483,41 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] )); - GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); - AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + + // Kaiden: Roaming Militia Training: + // If we're training roaming militia, + // We'll get our new squad elsewhere. + if(!gGameExternalOptions.gfmusttrainroaming) + { + GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); - if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) && CountAllMilitiaInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ) - { -/* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ); - - if(pEnemyGroup && pEnemyGroup->ubGroupID) + if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) && CountAllMilitiaInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ) { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2"); + /* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ); + + if(pEnemyGroup && pEnemyGroup->ubGroupID) + { + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2"); - pEnemyGroup->ubPrevX = sMapX; - pEnemyGroup->ubPrevY = sMapY; + pEnemyGroup->ubPrevX = sMapX; + pEnemyGroup->ubPrevY = sMapY; - pEnemyGroup->ubNextX = SECTORX( pMoveDir[ iRandomRes ][0] ); - pEnemyGroup->ubNextY = SECTORY( pMoveDir[ iRandomRes ][0] ); -*/ - gfMSBattle = TRUE; -// GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); - - EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); -// } + pEnemyGroup->ubNextX = SECTORX( pMoveDir[ iRandomRes ][0] ); + pEnemyGroup->ubNextY = SECTORY( pMoveDir[ iRandomRes ][0] ); + */ + gfMSBattle = TRUE; + // GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); + + EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + // } + } } - } - else return; - + else return; } + // moving squad, if it is not a SAM site else if(!IsThisSectorASAMSector( sMapX, sMapY, 0 )) if( !PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, FALSE ) ) // and there's no player's mercs in the sector @@ -581,6 +589,102 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) } + // Kaiden: Roaming Militia Training: + // If we're training roaming militia, + // we'll get our squad from here: + +void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) +{ + UINT16 pMoveDir[4][3]; + UINT8 uiDirNumber = 0; + UINT32 iRandomRes = 0, iRandom = 0; + UINT8 x;//,y; + SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); + UINT8 uiMilitiaCount; + + if( !gGameExternalOptions.gfAllowMilitiaGroups ) + return; + + if( sMapX == 1 && sMapY == 1 ) + { + ClearBlockMoveList(); + gfMSBattle = FALSE; + } + + if( CheckInBlockMoveList( sMapX, sMapY ) )return; + + uiMilitiaCount = CountMilitia(pSectorInfo); + + if( !uiMilitiaCount )return; + + // new squad + + if(gGameExternalOptions.gfmusttrainroaming) + { + if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) + { + GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, FALSE, FALSE ); + + if(uiDirNumber)// && Random(100) < CHANCE_TO_GENERATE_A_SQUAD) + { + for( x = 1; x < uiDirNumber ; ++x )pMoveDir[x][1] += pMoveDir[x-1][1]; + + iRandomRes = Random( pMoveDir[ uiDirNumber - 1 ][1] ); + + for( x = 0; x < uiDirNumber; ++x) + if( iRandomRes < pMoveDir[x][1] ) + { + iRandomRes = x; + break; + } + + // shouldn't be! + if(iRandomRes >= uiDirNumber)iRandomRes = 0; + + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] )); + + GenerateMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + + if( NumEnemiesInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) && CountAllMilitiaInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ) + { + /* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ) ); + + if(pEnemyGroup && pEnemyGroup->ubGroupID) + { + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2"); + + pEnemyGroup->ubPrevX = sMapX; + pEnemyGroup->ubPrevY = sMapY; + + pEnemyGroup->ubNextX = SECTORX( pMoveDir[ iRandomRes ][0] ); + pEnemyGroup->ubNextY = SECTORY( pMoveDir[ iRandomRes ][0] ); + */ + gfMSBattle = TRUE; + // GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); + + EnterAutoResolveMode( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) ); + // } + } + + } + else return; + } + } + + return; +} + + + + + + + + + + extern BOOLEAN gfMSResetMilitia; void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index c7d3b314..297fef6e 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -12,6 +12,7 @@ extern UINT8 gpAttackDirs[5][4]; extern UINT8 guiDirNumber; void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ); +void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ); void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ); void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3], BOOLEAN fWithCities, BOOLEAN fForBattle, BOOLEAN fOnlyCitySectors ); diff --git a/Strategic/Strategic.dsp b/Strategic/Strategic.dsp index d7fdea14..4084a487 100644 --- a/Strategic/Strategic.dsp +++ b/Strategic/Strategic.dsp @@ -315,6 +315,10 @@ SOURCE=".\Merc Contract.cpp" # End Source File # Begin Source File +SOURCE=.\MilitiaSquads.cpp +# End Source File +# Begin Source File + SOURCE=".\Player Command.cpp" # End Source File # Begin Source File @@ -339,6 +343,10 @@ SOURCE=.\QuestText.cpp # End Source File # Begin Source File +SOURCE=.\Reinforcement.cpp +# End Source File +# Begin Source File + SOURCE=.\Scheduling.cpp # End Source File # Begin Source File @@ -475,6 +483,10 @@ SOURCE=".\Merc Contract.h" # End Source File # Begin Source File +SOURCE=.\MilitiaSquads.h +# End Source File +# Begin Source File + SOURCE=".\Player Command.h" # End Source File # Begin Source File @@ -491,6 +503,10 @@ SOURCE=.\Quests.h # End Source File # Begin Source File +SOURCE=.\Reinforcement.h +# End Source File +# Begin Source File + SOURCE=.\Scheduling.h # End Source File # Begin Source File @@ -546,13 +562,5 @@ SOURCE=.\strategicmap.h SOURCE=".\Town Militia.h" # End Source File # End Group -# Begin Source File - -SOURCE=.\MilitiaSquads.cpp -# End Source File -# Begin Source File - -SOURCE=.\Reinforcement.cpp -# End Source File # End Target # End Project diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index a31c4d56..ef522bac 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -24,6 +24,7 @@ #include "GameSettings.h" #endif +#include "MilitiaSquads.h" #define SIZE_OF_MILITIA_COMPLETED_TRAINING_LIST 50 // temporary local global variables @@ -33,6 +34,7 @@ INT16 gsTownSectorServerSkipY = -1; UINT8 gubTownSectorServerIndex = 0; BOOLEAN gfYesNoPromptIsForContinue = FALSE; // this flag remembers whether we're starting new training, or continuing INT32 giTotalCostOfTraining = 0; +BOOLEAN gfAreWeTrainingMobile = FALSE; //the completed list of sector soldiers for training militia @@ -81,7 +83,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa INT32 iMaxMilitiaPerSector = gGameExternalOptions.iMaxMilitiaPerSector; INT32 iTrainingSquadSize = gGameExternalOptions.iTrainingSquadSize; -DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia1"); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia1"); // get town index ubTownId = StrategicMap[ sMapX + sMapY * MAP_WORLD_X ].bNameId; @@ -101,101 +103,149 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia1"); // 4) If not enough GREENS there to promote, promote GREENs in other sectors. // 5) If all friendly sectors of this town are completely filled with REGULAR militia, then training effect is wasted - while (ubMilitiaTrained < iTrainingSquadSize) + + // Kaiden: Roaming Militia Training: + // If we're not training roaming militia, + // then we will handle everything as normal. + + if( (IsMilitiaTrainableFromSoldiersSectorMaxed( pTrainer )) && (gGameExternalOptions.gfmusttrainroaming)) { - // is there room for another militia in the training sector itself? - if (CountAllMilitiaInSector(sMapX, sMapY) < iMaxMilitiaPerSector) + CreateMilitiaSquads(sMapX, sMapY ); + } + else + { + while (ubMilitiaTrained < iTrainingSquadSize) { - // great! Create a new GREEN militia guy in the training sector - StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1); + // is there room for another militia in the training sector itself? + if (CountAllMilitiaInSector(sMapX, sMapY) < iMaxMilitiaPerSector) + { + // great! Create a new GREEN militia guy in the training sector + StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1); + } + else + { + fFoundOne = FALSE; + + if( ubTownId != BLANK_SECTOR ) + { + InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); + + // check other eligible sectors in this town for room for another militia + while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) ) + { + // is there room for another militia in this neighbouring sector ? + if (CountAllMilitiaInSector(sNeighbourX, sNeighbourY) < iMaxMilitiaPerSector) + { + // great! Create a new GREEN militia guy in the neighbouring sector + StrategicAddMilitiaToSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1); + + fFoundOne = TRUE; + break; + } + } + } + + // if we still haven't been able to train anyone + if (!fFoundOne) + { + // alrighty, then. We'll have to *promote* guys instead. + + // are there any GREEN militia men in the training sector itself? + if (MilitiaInSectorOfRank(sMapX, sMapY, GREEN_MILITIA) > 0) + { + // great! Promote a GREEN militia guy in the training sector to a REGULAR + StrategicPromoteMilitiaInSector(sMapX, sMapY, GREEN_MILITIA, 1); + fFoundOne = TRUE; + } + else + { + if( ubTownId != BLANK_SECTOR ) + { + // dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted + InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); + + // check other eligible sectors in this town for room for another militia + while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) ) + { + // are there any GREEN militia men in the neighbouring sector ? + if (MilitiaInSectorOfRank(sNeighbourX, sNeighbourY, GREEN_MILITIA) > 0) + { + // great! Promote a GREEN militia guy in the neighbouring sector to a REGULAR + StrategicPromoteMilitiaInSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1); + + fFoundOne = TRUE; + break; + } + } + } + + // Kaiden: Veteran militia training + // This is essentially copy/pasted from above + // But the names have been changed to protect the innocent + if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia)) + { + // are there any REGULAR militia men in the training sector itself? + if (MilitiaInSectorOfRank(sMapX, sMapY, REGULAR_MILITIA) > 0) + { + // great! Promote a REGULAR militia guy in the training sector to a REGULAR + StrategicPromoteMilitiaInSector(sMapX, sMapY, REGULAR_MILITIA, 1); + fFoundOne = TRUE; + } + else + { + if( ubTownId != BLANK_SECTOR ) + { + // dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted + InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); + + // check other eligible sectors in this town for room for another militia + while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) ) + { + // are there any REGULAR militia men in the neighbouring sector ? + if (MilitiaInSectorOfRank(sNeighbourX, sNeighbourY, REGULAR_MILITIA) > 0) + { + // great! Promote a GREEN militia guy in the neighbouring sector to a REGULAR + StrategicPromoteMilitiaInSector(sNeighbourX, sNeighbourY, REGULAR_MILITIA, 1); + + fFoundOne = TRUE; + break; + } + } + } + } + } + + // if we still haven't been able to train anyone + if (!fFoundOne) + { + // Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs. + // The training goes to waste in this situation. + break; // the main while loop + } + } + } + } + + // next, please! + ubMilitiaTrained++; } - else + + + // if anyone actually got trained + if (ubMilitiaTrained > 0) { - fFoundOne = FALSE; + // update the screen display + fMapPanelDirty = TRUE; if( ubTownId != BLANK_SECTOR ) { - InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); - - // check other eligible sectors in this town for room for another militia - while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) ) - { - // is there room for another militia in this neighbouring sector ? - if (CountAllMilitiaInSector(sNeighbourX, sNeighbourY) < iMaxMilitiaPerSector) - { - // great! Create a new GREEN militia guy in the neighbouring sector - StrategicAddMilitiaToSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1); - - fFoundOne = TRUE; - break; - } - } + // loyalty in this town increases a bit because we obviously care about them... + IncrementTownLoyalty( ubTownId, LOYALTY_BONUS_FOR_TOWN_TRAINING ); } - // if we still haven't been able to train anyone - if (!fFoundOne) - { - // alrighty, then. We'll have to *promote* guys instead. - - // are there any GREEN militia men in the training sector itself? - if (MilitiaInSectorOfRank(sMapX, sMapY, GREEN_MILITIA) > 0) - { - // great! Promote a GREEN militia guy in the training sector to a REGULAR - StrategicPromoteMilitiaInSector(sMapX, sMapY, GREEN_MILITIA, 1); - } - else - { - if( ubTownId != BLANK_SECTOR ) - { - // dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted - InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY); - - // check other eligible sectors in this town for room for another militia - while( ServeNextFriendlySectorInTown( &sNeighbourX, &sNeighbourY ) ) - { - // are there any GREEN militia men in the neighbouring sector ? - if (MilitiaInSectorOfRank(sNeighbourX, sNeighbourY, GREEN_MILITIA) > 0) - { - // great! Promote a GREEN militia guy in the neighbouring sector to a REGULAR - StrategicPromoteMilitiaInSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1); - - fFoundOne = TRUE; - break; - } - } - } - - // if we still haven't been able to train anyone - if (!fFoundOne) - { - // Well, that's it. All eligible sectors of this town are full of REGULARs or ELITEs. - // The training goes to waste in this situation. - break; // the main while loop - } - } - } } - - // next, please! - ubMilitiaTrained++; } - - // if anyone actually got trained - if (ubMilitiaTrained > 0) - { - // update the screen display - fMapPanelDirty = TRUE; - - if( ubTownId != BLANK_SECTOR ) - { - // loyalty in this town increases a bit because we obviously care about them... - IncrementTownLoyalty( ubTownId, LOYALTY_BONUS_FOR_TOWN_TRAINING ); - } - - } - - // the trainer announces to player that he's finished his assignment. Make his sector flash! AssignmentDone( pTrainer, TRUE, FALSE ); @@ -519,9 +569,21 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2"); iNumberOfSectors = GetNumberOfUnpaidTrainableSectors( ); Assert( iNumberOfSectors > 0 ); + // Kaiden: Roaming Militia Training: + // We want to charge more for Roaming + // get total cost - giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors; - Assert( giTotalCostOfTraining > 0 ); + if( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (gGameExternalOptions.gfmusttrainroaming)) + { + giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors; + Assert( giTotalCostOfTraining > 0 ); + gfAreWeTrainingMobile = TRUE; + } + else + { + giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors; + Assert( giTotalCostOfTraining > 0 ); + } gfYesNoPromptIsForContinue = FALSE; @@ -579,6 +641,7 @@ void HandleInterfaceMessageForContinuingTrainingMilitia( SOLDIERTYPE *pSoldier ) INT32 iMinLoyaltyToTrain = gGameExternalOptions.iMinLoyaltyToTrain; INT32 iMilitiaTrainingCost = gGameExternalOptions.iMilitiaTrainingCost; + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); sSectorX = pSoldier->sSectorX; @@ -599,7 +662,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); return; } - if ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) ) + // Kaiden: Roaming Militia Training: + // Changed the if condition from + // if ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) ) + // And we're not training mobile militia from a SAM Site + + if (( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier )) && (IsThisSectorASAMSector(sSectorX,sSectorY,0 ))) { // we're full!!! go home! bTownId = GetTownIdForSector( sSectorX, sSectorY ); @@ -618,10 +686,47 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); return; } + else + { + if (( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier )) && (!gGameExternalOptions.gfmusttrainroaming)) + { + // we're full!!! go home! + bTownId = GetTownIdForSector( sSectorX, sSectorY ); + if ( bTownId == BLANK_SECTOR ) + { + // wilderness SAM site + GetSectorIDString( sSectorX, sSectorY, 0, sStringB, TRUE ); + void (*tempFptr)(INT16 , INT16 , INT8 , CHAR16 *, BOOLEAN) = GetSectorIDString; + swprintf( (wchar_t *)sString, (wchar_t *)pMilitiaConfirmStrings[ 10 ], sStringB, tempFptr, iMinLoyaltyToTrain ); + } + else + { + // town + swprintf( (wchar_t *)sString, (wchar_t *)pMilitiaConfirmStrings[ 10 ], pTownNames[ bTownId ], iMinLoyaltyToTrain ); + } + DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); + return; + } + } - // continue training always handles just one sector at a time - giTotalCostOfTraining = iMilitiaTrainingCost; + + + + + + // Kaiden: Roaming Militia Training: + // Charging more to train Roaming Militia + if ( IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier ) && (gGameExternalOptions.gfmusttrainroaming)) + { + giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier); + gfAreWeTrainingMobile = TRUE; + } + else + { + // continue training always handles just one sector at a time + giTotalCostOfTraining = iMilitiaTrainingCost; + } // can player afford to continue training? if( LaptopSaveInfo.iCurrentBalance < giTotalCostOfTraining ) { @@ -804,9 +909,19 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia4"); if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) ) { // don't count GREEN militia, they can be trained into regulars first - iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); - iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); - iMaxNumber += iMaxMilitiaPerSector; + // Kaiden: Veteran Militia Training: + // And we don't count regulars either if we're training veterans + if (gGameExternalOptions.gfTrainVeteranMilitia) + { + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); + iMaxNumber += iMaxMilitiaPerSector; + } + else + { + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); + iMaxNumber += iMaxMilitiaPerSector; + } } } @@ -840,11 +955,23 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5"); if( SectorOursAndPeaceful( sSectorX, sSectorY, 0 ) ) { // don't count GREEN militia, they can be trained into regulars first - iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); - iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); - iMaxNumber += iMaxMilitiaPerSector; + + // Kaiden: Veteran Militia Training: + // And we don't count regulars either if we're training veterans + if (gGameExternalOptions.gfTrainVeteranMilitia) + { + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); + iMaxNumber += iMaxMilitiaPerSector; + } + else + { + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA ); + iNumberOfMilitia += MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA ); + iMaxNumber += iMaxMilitiaPerSector; + } } + // now check the number of militia if ( iMaxNumber > iNumberOfMilitia ) { @@ -1123,8 +1250,17 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia6"); Assert( SectorInfo[ ubSector ].fMilitiaTrainingPaid == FALSE ); // spend the money - AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost ) ); - + // Kaiden: Roaming Militia Training: + // Charging more to train Roaming Militia + if ( gfAreWeTrainingMobile) + { + AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier ) ); + gfAreWeTrainingMobile = FALSE; + } + else + { + AddTransactionToPlayersBook( TRAIN_TOWN_MILITIA, ubSector, GetWorldTotalMin(), -( iMilitiaTrainingCost ) ); + } // mark this sector sectors as being paid up SectorInfo[ ubSector ].fMilitiaTrainingPaid = TRUE; diff --git a/builddefines.h b/builddefines.h index 46b8b220..aebb259d 100644 --- a/builddefines.h +++ b/builddefines.h @@ -27,9 +27,11 @@ #ifdef JA2BETAVERSION - #define SGP_DEBUG - #define FORCE_ASSERTS_ON - #define SGP_VIDEO_DEBUGGING + #ifndef JA2EDITOR + #define SGP_DEBUG + #define FORCE_ASSERTS_ON + #define SGP_VIDEO_DEBUGGING + #endif #endif //#define CRIPPLED_VERSION