Skip to content

Commit

Permalink
Fix ordering in constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
ahockersten committed Aug 25, 2014
1 parent ed5faf0 commit c998728
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 35 deletions.
4 changes: 2 additions & 2 deletions ai/predictive_ai.hpp
Expand Up @@ -390,12 +390,12 @@ struct FollowAI : WormAI, AiContext
: frame(0)
, model(weights, testing)
, evaluationBudget(0)
, targetAi(targetAiInit)
, effectScaler(0)
, weights(weights)
, targetAi(targetAiInit)
, candPlan(candPopSize)
, best(0)
, testing(testing)
, weights(weights)
#if AI_THREADS
, workQueue(2)
#endif
Expand Down
4 changes: 2 additions & 2 deletions common.cpp
Expand Up @@ -634,9 +634,9 @@ template<typename Writer>
struct TextWriter
{
TextWriter(Writer& writer)
: writer(writer)
, first(true)
: first(true)
, indent(0)
, writer(writer)
{
}

Expand Down
2 changes: 1 addition & 1 deletion game.cpp
Expand Up @@ -26,11 +26,11 @@ Game::Game(
, soundPlayer(soundPlayer)
, settings(settingsInit)
, statsRecorder(new NormalStatsRecorder)
, level(*common)
, screenFlash(0)
, gotChanged(false)
, lastKilledIdx(-1)
, paused(true)
, level(*common)
, quickSim(false)
{
rand.seed(uint32_t(std::time(0)));
Expand Down
23 changes: 12 additions & 11 deletions game.hpp
Expand Up @@ -85,25 +85,26 @@ struct Game
if (idx < 0) return 0;
return worms[idx];
}

Level level;


gvl::shared_ptr<Common> common;
gvl::shared_ptr<SoundPlayer> soundPlayer;
gvl::shared_ptr<Settings> settings;
gvl::shared_ptr<StatsRecorder> statsRecorder;
int screenFlash;
bool gotChanged;
gvl::shared_ptr<SoundPlayer> soundPlayer;
gvl::shared_ptr<Settings> settings;
gvl::shared_ptr<StatsRecorder> statsRecorder;

Level level;

int screenFlash;
bool gotChanged;
int lastKilledIdx;
bool paused;
bool paused;
int cycles;
Rand rand;

Holdazone holdazone;

std::vector<Viewport*> viewports;
std::vector<Worm*> worms;

typedef ExactObjectList<Bonus, 99> BonusList;
typedef ExactObjectList<WObject, 600> WObjectList;
typedef ExactObjectList<SObject, 700> SObjectList;
Expand Down
6 changes: 3 additions & 3 deletions gfx.cpp
Expand Up @@ -289,12 +289,12 @@ Gfx::Gfx()
, back(0)
, running(true)
, fullscreen(false)
, doubleRes(true)
, menuCycles(0)
, windowW(320 * 2)
, windowH(200 * 2)
, prevMag(0)
, keyBufPtr(keyBuf)
, doubleRes(true)
{
clearKeys();
}
Expand Down Expand Up @@ -807,8 +807,8 @@ struct ProfileLoadBehavior : ItemBehavior
struct PlayerSettingsBehavior : ItemBehavior
{
PlayerSettingsBehavior(Common& common, int player)
: player(player)
, common(common)
: common(common)
, player(player)
{
}

Expand Down
12 changes: 6 additions & 6 deletions menu/booleanSwitchBehavior.hpp
Expand Up @@ -10,23 +10,23 @@ struct Menu;
struct BooleanSwitchBehavior : ItemBehavior
{
BooleanSwitchBehavior(Common& common, bool& v)
: common(common), v(v)
, set([&](bool newV) { v = newV; })
: set([&](bool newV) { v = newV; })
, common(common), v(v)
{
}

BooleanSwitchBehavior(Common& common, bool& v, std::function<void(bool)> set)
: common(common), v(v)
, set(set)
: set(set)
, common(common), v(v)
{
}

std::function<void(bool)> set;

bool onLeftRight(Menu& menu, MenuItem& item, int dir);
int onEnter(Menu& menu, MenuItem& item);
void onUpdate(Menu& menu, MenuItem& item);

Common& common;
bool& v;
};
Expand Down
10 changes: 5 additions & 5 deletions settings.cpp
Expand Up @@ -23,17 +23,17 @@ Extensions::Extensions()
: recordReplays(true)
, loadPowerlevelPalette(true)
, scaleFilter(Settings::SfNearest)
, bloodParticleMax(700)
, bloodParticleMax(700)
, aiFrames(70*2), aiMutations(2)
, aiTraces(false)
, aiParallels(3)
, fullscreenW(640)
, fullscreenH(480)
, aiFrames(70*2), aiMutations(2)
, zoneTimeout(30)
, selectBotWeapons(true)
, aiTraces(false)
, aiParallels(3)
, allowViewingSpawnPoint(false)
{
}
}

Settings::Settings()
: maxBonuses(4)
Expand Down
10 changes: 5 additions & 5 deletions stats_recorder.hpp
Expand Up @@ -65,14 +65,14 @@ struct WormFrameStats
struct WormStats
{
WormStats()
: damage(0), damageDealt(0)
, selfDamage(0), spawnTime(-1)
: damage(0), damageDealt(0), selfDamage(0)
, damageHm(504 / 2, 350 / 2, 504, 350)
, presence(504 / 2, 350 / 2, 504, 350)
, lives(0), timer(0), kills(0)
, aiProcessTime(0)
, weaponChangeGood(0)
, weaponChangeBad(0)
, spawnTime(-1)
, lives(0), timer(0), kills(0)
, aiProcessTime(0)
{
for (int i = 0; i < 40; ++i)
weapons[i].index = i;
Expand Down Expand Up @@ -116,8 +116,8 @@ struct NormalStatsRecorder : StatsRecorder
{
NormalStatsRecorder()
: frame(0), frameStart(0), processTimeTotal(0)
, presence(504 / 2, 350 / 2, 504, 350)
, gameTime(0)
, presence(504 / 2, 350 / 2, 504, 350)
{
for (int i = 0; i < 2; ++i)
{
Expand Down

0 comments on commit c998728

Please sign in to comment.