Compile fixes for MSVC2013

master
Piotr Dziwinski 2015-08-16 00:06:27 +02:00
parent db3596ace1
commit d703eb7165
16 changed files with 77 additions and 29 deletions

View File

@ -141,7 +141,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message(STATUS "Detected MSVC compiler")
set(NORMAL_CXX_FLAGS "/wd\"4244\" /wd\"4309\" /wd\"4800\" /wd\"4996\"") # disable some useless warnings
set(NORMAL_CXX_FLAGS "/wd\"4244\" /wd\"4309\" /wd\"4800\" /wd\"4996\" /wd\"4351\"") # disable some useless warnings
set(RELEASE_CXX_FLAGS "")
set(DEBUG_CXX_FLAGS "")
set(TEST_CXX_FLAGS "")

View File

@ -37,7 +37,7 @@ template<> CInput* CSingleton<CInput>::m_instance = nullptr;
CInput::CInput()
: m_keyPresses()
{
m_keyTable =
m_keyTable = std::map<InputSlot, std::string>
{
{ INPUT_SLOT_LEFT, "left" },
{ INPUT_SLOT_RIGHT, "right" },

View File

@ -570,7 +570,7 @@ struct KeyEventData : public EventData
//! NOTE: applicable only to EVENT_KEY_DOWN events!
unsigned int unicode = 0;
//! Input binding slot for this key
InputSlot slot = {};
InputSlot slot = INPUT_SLOT_LEFT;
};
/**
@ -600,7 +600,7 @@ struct MouseButtonEventData : public EventData
}
//! The mouse button
MouseButton button = {};
MouseButton button = MOUSE_BUTTON_LEFT;
};
/**
@ -625,7 +625,7 @@ struct MouseWheelEventData : public EventData
}
//! Wheel direction
WheelDirection dir = {};
WheelDirection dir = WHEEL_UP;
};
/**
@ -713,6 +713,34 @@ struct Event
customParam(0)
{}
Event(const Event&) = delete;
Event& operator=(const Event&) = delete;
// Workaround for MSVC2013
Event(Event&& other)
: type(std::move(other.type)),
rTime(std::move(other.rTime)),
motionInput(std::move(other.motionInput)),
kmodState(std::move(other.kmodState)),
mousePos(std::move(other.mousePos)),
mouseButtonsState(std::move(other.mouseButtonsState)),
customParam(std::move(other.customParam)),
data(std::move(other.data))
{}
Event& operator=(Event&& other)
{
type = std::move(other.type);
rTime = std::move(other.rTime);
motionInput = std::move(other.motionInput);
kmodState = std::move(other.kmodState);
mousePos = std::move(other.mousePos);
mouseButtonsState = std::move(other.mouseButtonsState);
customParam = std::move(other.customParam);
data = std::move(other.data);
return *this;
}
//! Convenience function for getting appropriate EventData subclass
template<typename EventDataSubclass>
EventDataSubclass* GetData()

View File

@ -4758,7 +4758,7 @@ void CEngine::DrawStats()
std::stringstream str;
auto drawStatsLine = [&](const std::string& name = "", const std::string& value = "")
auto drawStatsLine = [&](const std::string& name, const std::string& value)
{
if (!name.empty())
{
@ -4799,13 +4799,13 @@ void CEngine::DrawStats()
m_app->GetPerformanceCounterData(PCNT_RENDER_SHADOW_MAP);
drawStatsCounter("Event processing", PCNT_EVENT_PROCESSING);
drawStatsLine();
drawStatsLine("", "");
drawStatsCounter("Frame update", PCNT_UPDATE_ALL);
drawStatsValue (" Engine update", engineUpdate);
drawStatsCounter(" Particle update", PCNT_UPDATE_PARTICLE);
drawStatsCounter(" Game update", PCNT_UPDATE_GAME);
drawStatsValue( " Other update", otherUpdate);
drawStatsLine();
drawStatsLine("", "");
drawStatsCounter("Frame render", PCNT_RENDER_ALL);
drawStatsCounter(" Particle render", PCNT_RENDER_PARTICLE);
drawStatsCounter(" Water render", PCNT_RENDER_WATER);
@ -4815,10 +4815,10 @@ void CEngine::DrawStats()
drawStatsCounter(" Shadow map render", PCNT_RENDER_SHADOW_MAP);
drawStatsValue( " Other render", otherRender);
drawStatsCounter("Swap buffers & VSync", PCNT_SWAP_BUFFERS);
drawStatsLine();
drawStatsLine("", "");
drawStatsLine( "Triangles", StrUtils::ToString<int>(m_statisticTriangle));
drawStatsValue( "FPS", m_fps);
drawStatsLine();
drawStatsLine("", "");
str.str("");
str << std::fixed << std::setprecision(2) << m_statisticPos.x << "; " << m_statisticPos.z;
drawStatsLine( "Position", str.str());

View File

@ -395,7 +395,7 @@ struct EngineGroundMark
//! Phase of life
EngineGroundMarkPhase phase = ENG_GR_MARK_PHASE_NULL;
//! Times for 3 life phases
float delay[3] = { 0.0f };
float delay[3] = {};
//! Fixed time
float fix = 0.0f;
//! Position for marks

View File

@ -220,7 +220,7 @@ struct Track
int posUsed = 0.0f; // number of positions in "pos"
int head = 0; // head to write index
Math::Vector pos[MAXTRACKLEN];
float len[MAXTRACKLEN] = {0.0f};
float len[MAXTRACKLEN] = {};
};
struct WheelTrace
@ -360,7 +360,7 @@ protected:
int m_wheelTraceIndex = 0;
WheelTrace m_wheelTrace[MAXWHEELTRACE];
int m_totalInterface[MAXPARTITYPE][SH_MAX] = {};
bool m_frameUpdate[SH_MAX] = {false};
bool m_frameUpdate[SH_MAX] = {};
int m_fogTotal = 0;
int m_fog[MAXPARTIFOG] = {};
int m_uniqueStamp = 0;

View File

@ -174,7 +174,7 @@ protected:
Math::Vector finalAngle;
};
PyroBurnPart m_burnPart[10];
int m_burnKeepPart[10] = {0};
int m_burnKeepPart[10] = {};
float m_burnFall = 0.0f;
float m_fallFloor = 0.0f;

View File

@ -336,7 +336,7 @@ protected:
//! Terrain hardness (defines e.g. sound of walking)
float hardness = 0.0f;
//! IDs of neighbor materials: up, right, down, left
char mat[4] = {0};
char mat[4] = {};
};
//! Terrain materials
std::vector<TerrainMaterial> m_materials;
@ -350,7 +350,7 @@ protected:
//! ID of material
short id = 0;
//! IDs of neighbor materials: up, right, down, left
char mat[4] = {0};
char mat[4] = {};
};

View File

@ -131,7 +131,7 @@ protected:
CParticle* m_particle = nullptr;
CSoundInterface* m_sound = nullptr;
WaterType m_type[2] = {WATER_NULL, WATER_NULL};
WaterType m_type[2] = {};
std::string m_fileName;
//! Overall level
float m_level = 0.0f;

View File

@ -170,7 +170,7 @@ struct OldModelHeader
//! Total number of triangles
int totalTriangles = 0;
//! Reserved area
int reserved[10] = {0};
int reserved[10] = {};
};
@ -188,7 +188,7 @@ struct OldModelTriangleV1
Vertex p2;
Vertex p3;
Material material;
char texName[20] = {0};
char texName[20] = {};
float min = 0;
float max = 0;
};
@ -207,7 +207,7 @@ struct OldModelTriangleV2
Vertex p2;
Vertex p3;
Material material;
char texName[20] = {0};
char texName[20] = {};
float min = 0.0f;
float max = 0.0f;
long state = 0;
@ -231,7 +231,7 @@ struct OldModelTriangleV3
VertexTex2 p2;
VertexTex2 p3;
Material material;
char texName[20] = {0};
char texName[20] = {};
float min = 0.0f;
float max = 0.0f;
long state = 0;

View File

@ -268,7 +268,7 @@ private:
GLint uni_ShadowTexture = 0;
//! true enables texture
GLint uni_TextureEnabled[3] = {0};
GLint uni_TextureEnabled[3] = {};
// Alpha test parameters
//! true enables alpha test
@ -289,7 +289,7 @@ private:
//! true enables lighting
GLint uni_LightingEnabled = 0;
//! true enables light source
GLint uni_LightEnabled[8] = {0};
GLint uni_LightEnabled[8] = {};
};

View File

@ -117,7 +117,7 @@ struct NewScriptName
{
bool used = false;
ObjectType type = OBJECT_NULL;
char name[40] = {0};
char name[40] = {};
};
@ -133,7 +133,7 @@ struct ShowLimit
Math::Vector pos;
float radius = 0.0f;
int total = 0;
int parti[MAXSHOWPARTI] = {0};
int parti[MAXSHOWPARTI] = {};
CObject* link = nullptr;
float duration = 0.0f;
float time = 0.0f;

View File

@ -40,6 +40,26 @@
struct OldMusic
{
OldMusic() = default;
OldMusic(const OldMusic&) = delete;
OldMusic& operator=(const OldMusic&) = delete;
// Workaround for MSVC2013
OldMusic(OldMusic&& other)
: music(std::move(other.music)),
fadeTime(std::move(other.fadeTime)),
currentTime(std::move(other.currentTime))
{}
OldMusic& operator=(OldMusic&& other)
{
music = std::move(other.music);
fadeTime = std::move(other.fadeTime);
currentTime = std::move(other.currentTime);
return *this;
}
std::unique_ptr<Channel> music;
float fadeTime = 0.0f;
float currentTime = 0.0f;

View File

@ -42,7 +42,7 @@ struct SoundOper
float finalFrequency = 0.0f;
float totalTime = 0.0f;
float currentTime = 0.0f;
SoundNext nextOper = {};
SoundNext nextOper = SOPER_CONTINUE;
};

View File

@ -118,7 +118,7 @@ protected:
struct Item
{
char text[100] = {0};
char text[100] = {};
bool check = false;
bool enable = true;
};

View File

@ -447,8 +447,8 @@ void CScreenSetupGraphics::ChangeSetupButtons()
pes = static_cast<CEnumSlider*>(pw->SearchControl(EVENT_INTERFACE_TEXTURE_FILTER));
if ( pes != 0 )
{
value = pes->GetVisibleValue();
m_engine->SetTextureFilterMode(static_cast<Gfx::TexFilter>(value));
int valueIndex = pes->GetVisibleValueIndex();
m_engine->SetTextureFilterMode(static_cast<Gfx::TexFilter>(valueIndex));
}
pes = static_cast<CEnumSlider*>(pw->SearchControl(EVENT_INTERFACE_TEXTURE_MIPMAP));