summaryrefslogtreecommitdiffstats
path: root/src/ui/editvalue.cpp
diff options
context:
space:
mode:
authorZaba999 <zaba.marcin@gmail.com>2012-09-18 22:33:28 +0200
committerZaba999 <zaba.marcin@gmail.com>2012-09-18 22:33:28 +0200
commit36ae984ac77c5545d3d11dde7e37913a8eff0b0d (patch)
tree94a296b8b816c372b436c56fff8d75263cfe2d4a /src/ui/editvalue.cpp
parenta397922e8d53c6f7ff469d38e5139fd003c705b5 (diff)
downloadcolobot-36ae984ac77c5545d3d11dde7e37913a8eff0b0d.tar.gz
colobot-36ae984ac77c5545d3d11dde7e37913a8eff0b0d.tar.bz2
colobot-36ae984ac77c5545d3d11dde7e37913a8eff0b0d.zip
Warnings cleaned, left only those connected to commented out code.
Diffstat (limited to 'src/ui/editvalue.cpp')
-rw-r--r--src/ui/editvalue.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index e5780fd..1188903 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -18,12 +18,6 @@
// editvalue.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "old/d3dengine.h"
-//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -294,7 +288,7 @@ void CEditValue::SetValue(float value, bool bSendMessage)
if ( m_type == EVT_INT )
{
- sprintf(text, "%d", (int)value);
+ sprintf(text, "%d", static_cast<int>(value));
}
if ( m_type == EVT_FLOAT )
@@ -304,7 +298,7 @@ void CEditValue::SetValue(float value, bool bSendMessage)
if ( m_type == EVT_100 )
{
- sprintf(text, "%d%%", (int)(value*100.0f));
+ sprintf(text, "%d%%", static_cast<int>(value*100.0f));
}
m_edit->SetText(text);
@@ -321,19 +315,19 @@ void CEditValue::SetValue(float value, bool bSendMessage)
float CEditValue::GetValue()
{
char text[100];
- float value;
-
- if ( m_edit == 0 ) 0.0f;
+ float value = 0.0f;
- m_edit->GetText(text, 100);
- sscanf(text, "%f", &value);
-
- if ( m_type == EVT_100 )
+ if ( m_edit != 0 )
{
- value = (value+0.5f)/100.0f;
- if ( value < 0.01f ) value = 0.0f; // less than 1%?
- }
+ m_edit->GetText(text, 100);
+ sscanf(text, "%f", &value);
+ if ( m_type == EVT_100 )
+ {
+ value = (value+0.5f)/100.0f;
+ if ( value < 0.01f ) value = 0.0f; // less than 1%?
+ }
+ }
return value;
}