From 1424b3c3d38998fa3c0ab66c4543a5d80a4c081e Mon Sep 17 00:00:00 2001 From: ChrisL Date: Thu, 4 Dec 2008 17:36:19 +0000 Subject: [PATCH] Added maximum and minimum values for the AP_BONUS settings in the INI file. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2443 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 10 +++++----- gameloop.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 838969d6..e6e0219c 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -490,11 +490,11 @@ void LoadGameExternalOptions() gGameExternalOptions.fAllowTacticalMilitiaCommand = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_TACTICAL_MILITIA_COMMAND",0); // Enemy AP settings - gGameExternalOptions.iEasyAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","NOVICE_AP_BONUS",0); - gGameExternalOptions.iExperiencedAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERIENCED_AP_BONUS",0); - gGameExternalOptions.iExpertAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERT_AP_BONUS",0); - gGameExternalOptions.iInsaneAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","INSANE_AP_BONUS",0); - gGameExternalOptions.iPlayerAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","PLAYER_AP_BONUS",0); + gGameExternalOptions.iEasyAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","NOVICE_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127); + gGameExternalOptions.iExperiencedAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERIENCED_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127); + gGameExternalOptions.iExpertAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","EXPERT_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127); + gGameExternalOptions.iInsaneAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","INSANE_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127); + gGameExternalOptions.iPlayerAPBonus = (INT8) iniReader.ReadInteger("JA2 Tactical Settings","PLAYER_AP_BONUS",0,__max(-APBPConstants[AP_MINIMUM],-128),127); // Sight range gGameExternalOptions.ubStraightSightRange = iniReader.ReadInteger("JA2 Tactical Settings","BASE_SIGHT_RANGE",13); diff --git a/gameloop.cpp b/gameloop.cpp index c506d78a..adf1e6fb 100644 --- a/gameloop.cpp +++ b/gameloop.cpp @@ -106,8 +106,8 @@ BOOLEAN InitializeGame(void) // Snap: Read options from an INI file in the default of custom Data directory // Moved this up because some settings are used during other inits - LoadGameExternalOptions(); LoadGameAPBPConstants(); + LoadGameExternalOptions(); InitSightRange(); //lal // Initlaize mouse subsystems