Skip to content

Commit 6d89a93

Browse files
committed
on second thought...
using 0 seems much saner. plus it removes the need for manipulation in newbattle state, and the need to include the defs. also default all the equipment in new battle mode to 0.
1 parent e0ae394 commit 6d89a93

2 files changed

Lines changed: 41 additions & 48 deletions

File tree

src/Engine/Options.cpp

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <sstream>
2929
#include <fstream>
3030
#include <algorithm>
31-
#include <climits>
3231
#include <yaml-cpp/yaml.h>
3332
#include "Exception.h"
3433
#include "Logger.h"
@@ -139,46 +138,46 @@ void createDefault()
139138
setInt("NewBattleCraft", 0);
140139

141140
// new battle loadout data
142-
setInt("NewBattle_STR_AC_AP_AMMO", 1);
143-
setInt("NewBattle_STR_AC_HE_AMMO", 1);
144-
setInt("NewBattle_STR_AC_I_AMMO", 1);
145-
setInt("NewBattle_STR_ALIEN_GRENADE", 1);
146-
setInt("NewBattle_STR_AUTO_CANNON", 1);
147-
setInt("NewBattle_STR_BLASTER_BOMB", 1);
148-
setInt("NewBattle_STR_BLASTER_LAUNCHER", 1);
149-
setInt("NewBattle_STR_ELECTRO_FLARE", 1);
150-
setInt("NewBattle_STR_GRENADE", 1);
151-
setInt("NewBattle_STR_HC_AP_AMMO", 1);
152-
setInt("NewBattle_STR_HC_HE_AMMO", 1);
153-
setInt("NewBattle_STR_HC_I_AMMO", 1);
154-
setInt("NewBattle_STR_HEAVY_CANNON", 1);
155-
setInt("NewBattle_STR_HEAVY_LASER", 1);
156-
setInt("NewBattle_STR_HEAVY_PLASMA", 1);
157-
setInt("NewBattle_STR_HEAVY_PLASMA_CLIP", 1);
158-
setInt("NewBattle_STR_HIGH_EXPLOSIVE", 1);
159-
setInt("NewBattle_STR_INCENDIARY_ROCKET", 1);
160-
setInt("NewBattle_STR_LARGE_ROCKET", 1);
161-
setInt("NewBattle_STR_LASER_PISTOL", 1);
162-
setInt("NewBattle_STR_LASER_RIFLE", 1);
163-
setInt("NewBattle_STR_MEDI_KIT", 1);
164-
setInt("NewBattle_STR_MIND_PROBE", 1);
165-
setInt("NewBattle_STR_MOTION_SCANNER", 1);
166-
setInt("NewBattle_STR_PISTOL", 1);
167-
setInt("NewBattle_STR_PISTOL_CLIP", 1);
168-
setInt("NewBattle_STR_PLASMA_PISTOL", 1);
169-
setInt("NewBattle_STR_PLASMA_PISTOL_CLIP", 1);
170-
setInt("NewBattle_STR_PLASMA_RIFLE", 1);
171-
setInt("NewBattle_STR_PLASMA_RIFLE_CLIP", 1);
172-
setInt("NewBattle_STR_PROXIMITY_GRENADE", 1);
173-
setInt("NewBattle_STR_PSI_AMP", 1);
174-
setInt("NewBattle_STR_RIFLE", 1);
175-
setInt("NewBattle_STR_RIFLE_CLIP", 1);
176-
setInt("NewBattle_STR_ROCKET_LAUNCHER", 1);
177-
setInt("NewBattle_STR_SMALL_LAUNCHER", 1);
178-
setInt("NewBattle_STR_SMALL_ROCKET", 1);
179-
setInt("NewBattle_STR_SMOKE_GRENADE", 1);
180-
setInt("NewBattle_STR_STUN_BOMB", 1);
181-
setInt("NewBattle_STR_STUN_ROD", 1);
141+
setInt("NewBattle_STR_AC_AP_AMMO", 0);
142+
setInt("NewBattle_STR_AC_HE_AMMO", 0);
143+
setInt("NewBattle_STR_AC_I_AMMO", 0);
144+
setInt("NewBattle_STR_ALIEN_GRENADE", 0);
145+
setInt("NewBattle_STR_AUTO_CANNON", 0);
146+
setInt("NewBattle_STR_BLASTER_BOMB", 0);
147+
setInt("NewBattle_STR_BLASTER_LAUNCHER", 0);
148+
setInt("NewBattle_STR_ELECTRO_FLARE", 0);
149+
setInt("NewBattle_STR_GRENADE", 0);
150+
setInt("NewBattle_STR_HC_AP_AMMO", 0);
151+
setInt("NewBattle_STR_HC_HE_AMMO", 0);
152+
setInt("NewBattle_STR_HC_I_AMMO", 0);
153+
setInt("NewBattle_STR_HEAVY_CANNON", 0);
154+
setInt("NewBattle_STR_HEAVY_LASER", 0);
155+
setInt("NewBattle_STR_HEAVY_PLASMA", 0);
156+
setInt("NewBattle_STR_HEAVY_PLASMA_CLIP", 0);
157+
setInt("NewBattle_STR_HIGH_EXPLOSIVE", 0);
158+
setInt("NewBattle_STR_INCENDIARY_ROCKET", 0);
159+
setInt("NewBattle_STR_LARGE_ROCKET", 0);
160+
setInt("NewBattle_STR_LASER_PISTOL", 0);
161+
setInt("NewBattle_STR_LASER_RIFLE", 0);
162+
setInt("NewBattle_STR_MEDI_KIT", 0);
163+
setInt("NewBattle_STR_MIND_PROBE", 0);
164+
setInt("NewBattle_STR_MOTION_SCANNER", 0);
165+
setInt("NewBattle_STR_PISTOL", 0);
166+
setInt("NewBattle_STR_PISTOL_CLIP", 0);
167+
setInt("NewBattle_STR_PLASMA_PISTOL", 0);
168+
setInt("NewBattle_STR_PLASMA_PISTOL_CLIP", 0);
169+
setInt("NewBattle_STR_PLASMA_RIFLE", 0);
170+
setInt("NewBattle_STR_PLASMA_RIFLE_CLIP", 0);
171+
setInt("NewBattle_STR_PROXIMITY_GRENADE", 0);
172+
setInt("NewBattle_STR_PSI_AMP", 0);
173+
setInt("NewBattle_STR_RIFLE", 0);
174+
setInt("NewBattle_STR_RIFLE_CLIP", 0);
175+
setInt("NewBattle_STR_ROCKET_LAUNCHER", 0);
176+
setInt("NewBattle_STR_SMALL_LAUNCHER", 0);
177+
setInt("NewBattle_STR_SMALL_ROCKET", 0);
178+
setInt("NewBattle_STR_SMOKE_GRENADE", 0);
179+
setInt("NewBattle_STR_STUN_BOMB", 0);
180+
setInt("NewBattle_STR_STUN_ROD", 0);
182181

183182
// controls
184183
setInt("keyOk", SDLK_RETURN);
@@ -545,7 +544,7 @@ std::string getString(const std::string& id)
545544
int getInt(const std::string& id)
546545
{
547546
std::stringstream ss;
548-
int value = INT_MAX;
547+
int value = 0;
549548
if (_options.find(id) != _options.end())
550549
{
551550
ss << std::dec << _options[id];

src/Menu/NewBattleState.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include "../Engine/Action.h"
4545
#include "../Engine/Options.h"
4646
#include "../Basescape/CraftInfoState.h"
47-
#include <climits>
4847

4948
namespace OpenXcom
5049
{
@@ -345,11 +344,6 @@ void NewBattleState::initSave()
345344
if (rule->getBattleType() != BT_NONE && !rule->isFixed() && (*i).substr(0, 8) != "STR_HWP_")
346345
{
347346
int amount = Options::getInt("NewBattle_" + rule->getName());
348-
if (amount == INT_MAX)
349-
{
350-
amount=0;
351-
Options::setInt("NewBattle_" + rule->getName(), 0);
352-
}
353347
amount = std::max(0, std::min(amount, 100));
354348
_craft->getItems()->addItem(*i, amount);
355349
}

0 commit comments

Comments
 (0)