Reorder some declarations and initializations to avoid order mismatch

While none of the mismatches were having a side-effect, this silences a
number of -Wreorder warnings which were drowning out potentially
important diagnostics.
issue1247
Nicolas Hake 2015-02-04 19:26:45 +01:00
parent 2ca9a77cc4
commit e2a8f6d303
10 changed files with 62 additions and 53 deletions

View File

@ -36,23 +36,9 @@ public:
COS_Game = 0, // game (landscape) coordinates
COS_Viewport = 1 // viewport (GUI) coordinates
};
private:
StdCopyStrBuf sIdentifier; // name as seen in script and config
StdCopyStrBuf sGUIName; // name as displayed to player
StdCopyStrBuf sGUIDesc; // key description displayed to player in config dialog
bool fGlobal; // if true, control can be bound to the global player only
bool fIsHoldKey; // if true, the control can be in down and up state
int32_t iRepeatDelay; // if >0, the key will generate successive events when held down
int32_t iInitialRepeatDelay; // delay after which KeyRepeat will be enabled
bool fDefaultDisabled; // if true, the control is disabled by default and needs to be enabled by script
C4ID idControlExtraData; // extra data to be passed to script function
CoordinateSpace eCoordSpace; // coordinate space to be used for mouse coordinates when control is triggered by mouse
bool fSendCursorPos; // if true, x/y parameters will be set by current GUI mouse cursor pos (or GetCursor()-GUI coordinate pos for gamepad)
public:
enum Actions //action to be performed when control is triggered
{
CDA_None=0, // do nothing
CDA_None = 0, // do nothing
CDA_Script, // default: Script callback
CDA_Menu, // open player menu (async)
CDA_MenuOK, CDA_MenuCancel, CDA_MenuLeft, CDA_MenuUp, CDA_MenuRight, CDA_MenuDown, // player menu controls (async)
@ -60,11 +46,26 @@ public:
CDA_ObjectMenuOK, CDA_ObjectMenuOKAll, CDA_ObjectMenuSelect, CDA_ObjectMenuCancel, CDA_ObjectMenuLeft, CDA_ObjectMenuUp, CDA_ObjectMenuRight, CDA_ObjectMenuDown, // object menu controls (sync)
CDA_ZoomIn, CDA_ZoomOut // player viewport control (async)
};
private:
StdCopyStrBuf sIdentifier; // name as seen in script and config
StdCopyStrBuf sGUIName; // name as displayed to player
StdCopyStrBuf sGUIDesc; // key description displayed to player in config dialog
bool fGlobal; // if true, control can be bound to the global player only
bool fIsHoldKey; // if true, the control can be in down and up state
bool fDefaultDisabled; // if true, the control is disabled by default and needs to be enabled by script
bool fSendCursorPos; // if true, x/y parameters will be set by current GUI mouse cursor pos (or GetCursor()-GUI coordinate pos for gamepad)
int32_t iRepeatDelay; // if >0, the key will generate successive events when held down
int32_t iInitialRepeatDelay; // delay after which KeyRepeat will be enabled
C4ID idControlExtraData; // extra data to be passed to script function
CoordinateSpace eCoordSpace; // coordinate space to be used for mouse coordinates when control is triggered by mouse
Actions eAction;
public:
C4PlayerControlDef() : fGlobal(false), fIsHoldKey(false), fDefaultDisabled(false), idControlExtraData(C4ID::None), fSendCursorPos(false), eAction(CDA_Script), eCoordSpace(COS_Game) {}
C4PlayerControlDef() :
fGlobal(false), fIsHoldKey(false), fDefaultDisabled(false), fSendCursorPos(false),
idControlExtraData(C4ID::None), eCoordSpace(COS_Game), eAction(CDA_Script)
{}
~C4PlayerControlDef() {};
void CompileFunc(StdCompiler *pComp);
@ -144,6 +145,18 @@ typedef std::vector<C4KeyCodeEx> C4KeyCodeExVec;
// a key/mouse/gamepad assignment to a PlayerControlDef
class C4PlayerControlAssignment
{
public:
// action to be performed on the control upon this key
enum TriggerModes
{
CTM_Default = 0, // standard behaviour: The control will be triggered
CTM_Hold = 1 << 0, // the control will be put into "down"-mode
CTM_Release = 1 << 1, // the hold mode of the control will be released
CTM_AlwaysUnhandled = 1 << 2, // the key will not block handling of other keys even if it got handled
CTM_HandleDownStatesOnly = 1 << 3, // used when an already handled release key is processed to reset down states of overridden keys only
CTM_ClearRecentKeys = 1 << 4 // if this assignment is triggered, RecentKeys are reset so no more combos can be generated
};
private:
// KeyCombo list:
// if size()>1, the control is triggered only if this combo is fulfilled
@ -167,33 +180,22 @@ private:
StdCopyStrBuf sGUIName; // name as displayed to player. If empty, name stored in control def should be used.
StdCopyStrBuf sGUIDesc; // key description displayed to player in config dialog. If empty, name stored in control def should be used.
bool fGUIDisabled; // whether this key can't be reassigned through the GUI dialogue
bool fOverrideAssignments; // override all other assignments to the same key?
bool is_inherited; // set for assignments that were copied from a parent set without modification
bool fRefsResolved; // set to true after sControlName and sKeyNames have been resolved to runtime values
int32_t iGUIGroup; // in which this control is grouped in the gui
int32_t iControl; // the control to be executed on this key, i.e. the resolved sControlName
int32_t iPriority; // higher priority assignments get handled first
bool fOverrideAssignments; // override all other assignments to the same key?
const C4PlayerControlAssignment *inherited_assignment; // valid for assignments that were copied from a parent: source assignment
bool is_inherited; // set for assignments that were copied from a parent set without modification
public:
// action to be performed on the control upon this key
enum TriggerModes
{
CTM_Default=0, // standard behaviour: The control will be triggered
CTM_Hold= 1<<0, // the control will be put into "down"-mode
CTM_Release= 1<<1, // the hold mode of the control will be released
CTM_AlwaysUnhandled= 1<<2, // the key will not block handling of other keys even if it got handled
CTM_HandleDownStatesOnly = 1<<3, // used when an already handled release key is processed to reset down states of overridden keys only
CTM_ClearRecentKeys = 1<<4 // if this assignment is triggered, RecentKeys are reset so no more combos can be generated
};
private:
int32_t iTriggerMode;
bool fRefsResolved; // set to true after sControlName and sKeyNames have been resolved to runtime values
const C4PlayerControlAssignment *inherited_assignment; // valid for assignments that were copied from a parent: source assignment
public:
C4PlayerControlAssignment() : TriggerKey(), iControl(CON_None), iPriority(0), fOverrideAssignments(false), iTriggerMode(CTM_Default), fRefsResolved(false), inherited_assignment(NULL),is_inherited(false), iGUIGroup(0) {}
C4PlayerControlAssignment() :
TriggerKey(), fOverrideAssignments(false), is_inherited(false), fRefsResolved(false),
iGUIGroup(0), iControl(CON_None), iPriority(0), iTriggerMode(CTM_Default),
inherited_assignment(NULL)
{}
~C4PlayerControlAssignment() {}
void CompileFunc(StdCompiler *pComp);

View File

@ -240,7 +240,7 @@ public:
throw std::runtime_error(std::string("Cannot load ") + FontFaceName + ": " + FormatString("%d",e).getData());
#endif
}
CStdVectorFont(StdBuf & Data): RefCnt(1), Data(Data)
CStdVectorFont(StdBuf & Data) : Data(Data), RefCnt(1)
{
// Initialize Freetype
if (FT_Init_FreeType(&library))

View File

@ -27,8 +27,9 @@
// ----------- C4GameOptionsList::Option ----------------------------------------------------------------
C4GameOptionsList::Option::Option(C4GameOptionsList *pForDlg)
: BaseClass(C4Rect(0,0,0,0)), pPrimarySubcomponent(NULL), pForDlg(pForDlg) { }
C4GameOptionsList::Option::Option(C4GameOptionsList *pForDlg) :
BaseClass(C4Rect(0, 0, 0, 0)), pForDlg(pForDlg), pPrimarySubcomponent(NULL)
{}
void C4GameOptionsList::Option::InitOption(C4GameOptionsList *pForDlg)
{

View File

@ -120,7 +120,7 @@ public:
int32_t iMinPlrCount;
public:
Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent) : Entry(pLoader, pParent), fNoMissionAccess(false), iMinPlrCount(0), nAchievements(0) {}
Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent) : Entry(pLoader, pParent), fNoMissionAccess(false), nAchievements(0), iMinPlrCount(0) {}
virtual ~Scenario() {}
virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded); // do fallbacks for title and icon; check whether scenario is valid

View File

@ -152,7 +152,9 @@ public:
bool IsConstant() const { return isConstant; }
bool IsRandom() const { return valueFunction == &C4ParticleValueProvider::Random; }
C4ParticleValueProvider() : startValue(0.f), endValue(0.f), currentValue(0.f), rerollInterval(0), smoothing(0), valueFunction(0), keyFrameCount(0), isConstant(true), floatValueToChange(0), typeOfValueToChange(VAL_TYPE_FLOAT) { }
C4ParticleValueProvider() :
startValue(0.f), endValue(0.f), currentValue(0.f), rerollInterval(0), smoothing(0), keyFrameCount(0), valueFunction(0), isConstant(true), floatValueToChange(0), typeOfValueToChange(VAL_TYPE_FLOAT)
{ }
~C4ParticleValueProvider()
{
for (std::vector<C4ParticleValueProvider*>::iterator iter = childrenValueProviders.begin(); iter != childrenValueProviders.end(); ++iter)

View File

@ -69,10 +69,10 @@ struct LightMapZoom {
} // anonymous namespace
C4FoWAmbient::C4FoWAmbient()
: Tex(0), Resolution(0.), Radius(0.), FullCoverage(0.),
SizeX(0), SizeY(0), LandscapeX(0), LandscapeY(0),
Brightness(1.)
C4FoWAmbient::C4FoWAmbient() :
Tex(0), Resolution(0.), Radius(0.), FullCoverage(0.),
SizeX(0), LandscapeX(0), SizeY(0), LandscapeY(0),
Brightness(1.)
{
}

View File

@ -686,9 +686,10 @@ protected:
// Name number in parent map
const char *Pos;
// Constructor
NameNode(NameNode *pParent = NULL)
: Parent(pParent), FirstChild(NULL), PrevChild(NULL), NextChild(NULL), LastChild(NULL),
Indent(-1), Pos(NULL), Section(false)
NameNode(NameNode *pParent = NULL) :
Section(false), Parent(pParent),
FirstChild(NULL), PrevChild(NULL), NextChild(NULL), LastChild(NULL),
Indent(-1), Pos(NULL)
{ }
};
NameNode *pNameRoot, *pName;

View File

@ -410,7 +410,8 @@ void C4MusicFileSDL::SetVolume(int iLevel)
/* Ogg Vobis */
C4MusicFileOgg::C4MusicFileOgg() : playing(false), current_section(0), channel(0), streaming_done(false), byte_pos_total(0), volume(1.0f), loaded(false)
C4MusicFileOgg::C4MusicFileOgg() :
playing(false), streaming_done(false), loaded(false), channel(0), current_section(0), byte_pos_total(0), volume(1.0f)
{
for (size_t i=0; i<num_buffers; ++i)
buffers[i] = 0;

View File

@ -27,7 +27,9 @@ class C4MusicFile
{
public:
C4MusicFile() : LastPlayed(-1), NoPlay(false), SongExtracted(false), loop(false) { }
C4MusicFile() :
pNext(NULL), LastPlayed(-1), NoPlay(false), loop(false), SongExtracted(false)
{ }
virtual ~C4MusicFile() { }
// data

View File

@ -108,9 +108,9 @@ std::string C4AulScript::Translate(const std::string &text) const
C4AulScriptFunc::C4AulScriptFunc(C4AulScript *pOwner, C4ScriptHost *pOrgScript, const char *pName, const char *Script):
C4AulFunc(pOwner, pName),
Script(Script),
OwnerOverloaded(NULL),
ParCount(0),
Script(Script),
pOrgScript(pOrgScript),
tProfileTime(0)
{
@ -120,11 +120,11 @@ C4AulScriptFunc::C4AulScriptFunc(C4AulScript *pOwner, C4ScriptHost *pOrgScript,
C4AulScriptFunc::C4AulScriptFunc(C4AulScript *pOwner, const C4AulScriptFunc &FromFunc):
C4AulFunc(pOwner, FromFunc.GetName()),
OwnerOverloaded(NULL),
ParCount(FromFunc.ParCount),
Script(FromFunc.Script),
VarNamed(FromFunc.VarNamed),
ParNamed(FromFunc.ParNamed),
OwnerOverloaded(NULL),
ParCount(FromFunc.ParCount),
pOrgScript(FromFunc.pOrgScript),
tProfileTime(0)
{