summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-30 22:59:18 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-30 22:59:18 +0200
commit5e637ca0288ddd631ec33e1d620cd4a73bcdc2be (patch)
treeb26b0e9572f101744aba712133e646fb93ed58d2 /src/app
parentd8a0c8d32e160e7ae86bb5b85ead8e5f71b1fd01 (diff)
downloadcolobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.tar.gz
colobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.tar.bz2
colobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.zip
Switched to new style casts
- rewrote old C-style casts to new ..._cast<> - corrected some dangerous casts - added -Wold-style-cast to compile flags
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 5c6ef49..d20232d 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -461,7 +461,7 @@ void CApplication::UpdateJoystick()
SDL_JoystickUpdate();
- for (int axis = 0; axis < (int) m_joyAxeState.size(); ++axis)
+ for (int axis = 0; axis < static_cast<int>( m_joyAxeState.size() ); ++axis)
{
int newValue = SDL_JoystickGetAxis(m_private->joystick, axis);
@@ -480,7 +480,7 @@ void CApplication::UpdateJoystick()
}
}
- for (int button = 0; button < (int) m_joyButtonState.size(); ++button)
+ for (int button = 0; button < static_cast<int>( m_joyButtonState.size() ); ++button)
{
bool newValue = SDL_JoystickGetButton(m_private->joystick, button) == 1;
@@ -621,14 +621,14 @@ PressState TranslatePressState(unsigned char state)
- y: 0=down, 1=up */
Math::Point CApplication::WindowToInterfaceCoords(Math::IntPoint pos)
{
- return Math::Point( (float)pos.x / (float)m_deviceConfig.size.w,
- 1.0f - (float)pos.y / (float)m_deviceConfig.size.h);
+ return Math::Point( static_cast<float>(pos.x) / static_cast<float>(m_deviceConfig.size.w),
+ 1.0f - static_cast<float>(pos.y) / static_cast<float>(m_deviceConfig.size.h) );
}
Math::IntPoint CApplication::InterfaceToWindowCoords(Math::Point pos)
{
- return Math::IntPoint((int)(pos.x * m_deviceConfig.size.w),
- (int)((1.0f - pos.y) * m_deviceConfig.size.h));
+ return Math::IntPoint(static_cast<int>(pos.x * m_deviceConfig.size.w),
+ static_cast<int>((1.0f - pos.y) * m_deviceConfig.size.h));
}
/** The SDL event parsed is stored internally.
@@ -822,10 +822,10 @@ VideoQueryResult CApplication::GetVideoResolutionList(std::vector<Math::IntSize>
SDL_Rect **modes = SDL_ListModes(NULL, videoFlags);
- if (modes == (SDL_Rect **)0)
+ if (modes == reinterpret_cast<SDL_Rect **>(0) )
return VIDEO_QUERY_NONE; // no modes available
- if (modes == (SDL_Rect **)-1)
+ if (modes == reinterpret_cast<SDL_Rect **>(-1) )
return VIDEO_QUERY_ALL; // all resolutions are possible