Warnings cleaned, left only those connected to commented out code.

dev-ui
Zaba999 2012-09-18 22:33:28 +02:00
parent a397922e8d
commit 36ae984ac7
19 changed files with 291 additions and 313 deletions

View File

@ -347,7 +347,7 @@ void AddExt(char* filename, const char* ext)
// Specifies the user folder.
void UserDir(bool bUser, char* dir)
void UserDir(bool bUser, const char* dir)
{
g_bUserDir = bUser;
strcpy(g_userDir, dir);

View File

@ -47,5 +47,5 @@ extern void TimeToAscii(time_t time, char *buffer);
extern bool CopyFileToTemp(char* filename);
extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, const char* ext);
extern void UserDir(bool bUser, char* dir);
extern void UserDir(bool bUser, const char* dir);
extern void UserDir(char* buffer, const char* dir, const char* def);

View File

@ -6362,7 +6362,7 @@ char* CRobotMain::GetFilesDir()
//! Change the player's name
void CRobotMain::SetGamerName(char *name)
void CRobotMain::SetGamerName(const char *name)
{
strcpy(m_gamerName, name);
SetGlobalGamerName(m_gamerName);

View File

@ -245,7 +245,7 @@ public:
char* GetPublicDir();
char* GetFilesDir();
void SetGamerName(char *name);
void SetGamerName(const char *name);
char* GetGamerName();
int GetGamerFace();
int GetGamerGlasses();

View File

@ -2755,7 +2755,7 @@ CScript::~CScript()
// Gives the script editable block of text.
void CScript::PutScript(Ui::CEdit* edit, char* name)
void CScript::PutScript(Ui::CEdit* edit, const char* name)
{
if ( m_script == 0 )
{
@ -3517,7 +3517,7 @@ void CScript::GetError(char* buffer)
// New program.
void CScript::New(Ui::CEdit* edit, char* name)
void CScript::New(Ui::CEdit* edit, const char* name)
{
FILE *file = NULL;
char res[100];

View File

@ -53,7 +53,7 @@ public:
static void InitFonctions();
void PutScript(Ui::CEdit* edit, char* name);
void PutScript(Ui::CEdit* edit, const char* name);
bool GetScript(Ui::CEdit* edit);
bool GetCompile();
@ -74,7 +74,7 @@ public:
int GetError();
void GetError(char* buffer);
void New(Ui::CEdit* edit, char* name);
void New(Ui::CEdit* edit, const char* name);
bool SendScript(char* text);
bool ReadScript(const char* filename);
bool WriteScript(const char* filename);

View File

@ -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;
float value = 0.0f;
if ( m_edit == 0 ) 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;
}

View File

@ -75,15 +75,13 @@ protected:
void MoveAdjust();
void HiliteValue(const Event &event);
protected:
Ui::CEdit* m_edit;
Ui::CButton* m_buttonUp;
Ui::CButton* m_buttonDown;
EditValueType m_type;
float m_stepValue;
float m_minValue;
float m_maxValue;
EditValueType m_type;
float m_stepValue;
float m_minValue;
float m_maxValue;
};

View File

@ -75,7 +75,7 @@ bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
// Specifies the name of the image display.
void CImage::SetFilenameImage(char *name)
void CImage::SetFilenameImage(const char *name)
{
if ( m_filename[0] != 0 )
{

View File

@ -42,7 +42,7 @@ public:
void Draw();
void SetFilenameImage(char *name);
void SetFilenameImage(const char *name);
char* GetFilenameImage();
protected:

View File

@ -602,7 +602,7 @@ bool CList::GetBlink()
// Specifies the text of a line.
void CList::SetName(int i, char* name)
void CList::SetName(int i, const char* name)
{
if ( i < 0 || i >= LISTMAXTOTAL )
return;
@ -759,16 +759,16 @@ void CList::UpdateScroll()
value = 0.0f;
step = 0.0f;
} else {
ratio = static_cast<float>m_displayLine / m_totalLine;
ratio = static_cast<float>(m_displayLine) / m_totalLine;
if ( ratio > 1.0f ) ratio = 1.0f;
value = static_cast<float>m_firstLine / (m_totalLine - m_displayLine);
value = static_cast<float>(m_firstLine) / (m_totalLine - m_displayLine);
if ( value < 0.0f )
value = 0.0f;
if ( value > 1.0f )
value = 1.0f;
step = static_cast<float>1.0f/ (m_totalLine - m_displayLine);
step = static_cast<float>(1.0f)/ (m_totalLine - m_displayLine);
if ( step < 0.0f )
step = 0.0f;
}

View File

@ -69,7 +69,7 @@ class CList : public CControl
void SetBlink(bool bEnable);
bool GetBlink();
void SetName(int i, char* name);
void SetName(int i, const char* name);
char* GetName(int i);
void SetCheck(int i, bool bMode);

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
// mainmap.cpp
#include <ui/mainmap.h>
#include "ui/mainmap.h"
namespace Ui {
@ -37,7 +37,7 @@ CMainMap::CMainMap()
m_interface = static_cast<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
m_event = static_cast<CEventQueue*>(m_iMan->SearchInstance(CLASS_EVENT));
m_engine = (Gfx::CEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
m_mapMode = 1;
m_bFixImage = false;

View File

@ -866,20 +866,13 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
void CMap::DrawHighlight(Math::Point pos)
{
Math::Point dim, uv1, uv2;
bool bOut, bUp, bDown, bLeft, bRight;
Math::Point dim, uv1, uv2;
if ( m_bToy || m_fixImage[0] != 0 ) return; // map with still image?
pos.x = (pos.x-m_offset.x)*(m_zoom*0.5f)/m_half+0.5f;
pos.y = (pos.y-m_offset.y)*(m_zoom*0.5f)/m_half+0.5f;
bOut = bUp = bDown = bLeft = bRight = false;
if ( pos.x < 0.06f ) { pos.x = 0.02f; bOut = bLeft = true; }
if ( pos.y < 0.06f ) { pos.y = 0.02f; bOut = bDown = true; }
if ( pos.x > 0.94f ) { pos.x = 0.98f; bOut = bRight = true; }
if ( pos.y > 0.94f ) { pos.y = 0.98f; bOut = bUp = true; }
pos.x = m_mapPos.x+m_mapDim.x*pos.x;
pos.y = m_mapPos.y+m_mapDim.y*pos.y;
dim.x = 2.0f/128.0f*0.75f;
@ -1013,8 +1006,8 @@ void CMap::UpdateTerrain()
{
for ( x=0 ; x<256 ; x++ )
{
pos.x = ((float)x-128.0f)*m_half/128.0f;
pos.z = -((float)y-128.0f)*m_half/128.0f;
pos.x = (static_cast<float>(x)-128.0f)*m_half/128.0f;
pos.z = -(static_cast<float>(y)-128.0f)*m_half/128.0f;
pos.y = 0.0f;
if ( pos.x >= -m_half && pos.x <= m_half &&
@ -1077,8 +1070,8 @@ void CMap::UpdateTerrain(int bx, int by, int ex, int ey)
{
for ( x=bx ; x<ex ; x++ )
{
pos.x = ((float)x-128.0f)*m_half/128.0f;
pos.z = -((float)y-128.0f)*m_half/128.0f;
pos.x = (static_cast<float>(x)-128.0f)*m_half/128.0f;
pos.z = -(static_cast<float>(y)-128.0f)*m_half/128.0f;
pos.y = 0.0f;
if ( pos.x >= -m_half && pos.x <= m_half &&

View File

@ -99,7 +99,7 @@ void CScroll::MoveAdjust()
if ( m_buttonUp == 0 )
{
m_buttonUp = new CButton();
pc = (CButton*)m_buttonUp;
pc = m_buttonUp;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 49, EVENT_NULL);
pc->SetRepeat(true);
m_eventUp = pc->GetEventType();
@ -108,7 +108,7 @@ void CScroll::MoveAdjust()
if ( m_buttonDown == 0 )
{
m_buttonDown = new CButton();
pc = (CButton*)m_buttonDown;
pc = m_buttonDown;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 50, EVENT_NULL);
pc->SetRepeat(true);
m_eventDown = pc->GetEventType();
@ -345,7 +345,7 @@ void CScroll::Draw()
dim.y *= m_visibleRatio;
DrawVertex(pos, dim, 2);
n = (int)(dim.y*0.8f/0.012f);
n = static_cast<int>(dim.y*0.8f/0.012f);
if ( n < 1 ) n = 1;
if ( n > 5 ) n = 5;

View File

@ -467,7 +467,7 @@ void CSlider::Draw()
if ( m_bHoriz )
{
sprintf(text, "%d", (int)(m_min+m_visibleValue*(m_max-m_min)));
sprintf(text, "%d", static_cast<int>(m_min+m_visibleValue*(m_max-m_min)));
h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
pos.x = m_pos.x+m_dim.x+(10.0f/640.0f);
pos.y = m_pos.y+(m_dim.y-h)/2.0f;
@ -483,7 +483,7 @@ void CSlider::Draw()
pos.y += (h-CURSOR_WIDTH)*m_visibleValue;
dim.x = 50.0f/640.0f;
dim.y = 16.0f/480.0f;
sprintf(text, "%d", (int)(m_min+(m_visibleValue*(m_max-m_min))));
sprintf(text, "%d", static_cast<int>(m_min+(m_visibleValue*(m_max-m_min))));
m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
}

View File

@ -507,7 +507,7 @@ void CStudio::SearchToken(CEdit* edit)
for ( i=0 ; i<OBJECT_MAX ; i++ )
{
type = static_cast< ObjectType >(i);
text = GetObjectName(type);
text = const_cast<char *>(GetObjectName(type));
if ( text[0] != 0 )
{
if ( strcmp(token, text) == 0 )
@ -517,7 +517,7 @@ void CStudio::SearchToken(CEdit* edit)
return;
}
}
text = GetObjectAlias(type);
text = const_cast<char *>(GetObjectAlias(type));
if ( text[0] != 0 )
{
if ( strcmp(token, text) == 0 )
@ -530,7 +530,7 @@ void CStudio::SearchToken(CEdit* edit)
}
}
text = GetHelpText(token);
text = const_cast<char *>(GetHelpText(token));
if ( text[0] == 0 && m_helpFilename.length() > 0 )
{
SetInfoText(std::string(token), true);
@ -606,11 +606,8 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
edit->SetFontStretch(0.7f);
edit->SetDisplaySpec(true);
edit->SetAutoIndent(m_engine->GetEditIndentMode());
// TODO replace to PutScript after change to std::string
char* tmp;
strcpy(tmp, name.c_str());
// m_script->PutScript(edit, name);
m_script->PutScript(edit, tmp);
m_script->PutScript(edit, name.c_str());
ColorizeScript(edit);
ViewEditScript();
@ -908,9 +905,7 @@ void CStudio::SetInfoText(std::string text, bool bClickable)
if ( list == 0 ) return;
list->Flush(); // just text
char* tmp;
strcpy(tmp,text.c_str());
list->SetName(0, tmp); // TODO
list->SetName(0, text.c_str());
if ( text[0] == 0 ) bClickable = false;
list->SetSelectCap(bClickable);
@ -1224,7 +1219,7 @@ void CStudio::AdjustDialog()
pla->SetDim(ddim);
}
nli = (int)((wdim.y-120.0f/480.0f)/(18.0f/480.0f));
nli = static_cast<int>((wdim.y-120.0f/480.0f)/(18.0f/480.0f));
ddim.y = nli*18.0f/480.0f+9.0f/480.0f;
ppos.y = wpos.y+wdim.y-48.0f/480.0f-ddim.y;
pli = static_cast< CList* >(pw->SearchControl(EVENT_DIALOG_LIST));

View File

@ -18,7 +18,7 @@
// window.cpp
#include <ui/window.h>
#include "ui/window.h"
@ -124,7 +124,7 @@ CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, Event
{
// m_table[i] = new CButton(m_iMan);
m_table[i] = new CButton();
pc = (CButton*)m_table[i];
pc = static_cast<CButton*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -147,7 +147,7 @@ CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventTy
{
// m_table[i] = new CColor(m_iMan);
m_table[i] = new CColor();
pc = (CColor*)m_table[i];
pc = static_cast<CColor*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -170,7 +170,7 @@ CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventTy
{
// m_table[i] = new CCheck(m_iMan);
m_table[i] = new CCheck();
pc = (CCheck*)m_table[i];
pc = static_cast<CCheck*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -193,7 +193,7 @@ CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType e
{
// m_table[i] = new CKey(m_iMan);
m_table[i] = new CKey();
pc = (CKey*)m_table[i];
pc = static_cast<CKey*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -216,7 +216,7 @@ CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventTy
{
// m_table[i] = new CGroup(m_iMan);
m_table[i] = new CGroup();
pc = (CGroup*)m_table[i];
pc = static_cast<CGroup*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -239,7 +239,7 @@ CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventTy
{
// m_table[i] = new CImage(m_iMan);
m_table[i] = new CImage();
pc = (CImage*)m_table[i];
pc = static_cast<CImage*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -262,7 +262,7 @@ CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventTy
{
// m_table[i] = new CLabel(m_iMan);
m_table[i] = new CLabel();
pc = (CLabel*)m_table[i];
pc = static_cast<CLabel*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
auto p = name.find("\\");
@ -291,7 +291,7 @@ CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType
{
// m_table[i] = new CEdit(m_iMan);
m_table[i] = new CEdit();
pc = (CEdit*)m_table[i];
pc = static_cast<CEdit*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -314,7 +314,7 @@ CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon,
{
// m_table[i] = new CEditValue(m_iMan);
m_table[i] = new CEditValue();
pc = (CEditValue*)m_table[i];
pc = static_cast<CEditValue*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -337,7 +337,7 @@ CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, Event
{
// m_table[i] = new CScroll(m_iMan);
m_table[i] = new CScroll();
pc = (CScroll*)m_table[i];
pc = static_cast<CScroll*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -360,7 +360,7 @@ CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, Event
{
// m_table[i] = new CSlider(m_iMan);
m_table[i] = new CSlider();
pc = (CSlider*)m_table[i];
pc = static_cast<CSlider*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -384,7 +384,7 @@ CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventType
{
// m_table[i] = new CList(m_iMan);
m_table[i] = new CList();
pc = (CList*)m_table[i];
pc = static_cast<CList*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg, expand);
return pc;
}
@ -406,7 +406,7 @@ CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, E
if ( m_table[i] == 0 )
{
m_table[i] = new CShortcut();
ps = (CShortcut*)m_table[i];
ps = static_cast<CShortcut*>(m_table[i]);
ps->Create(pos, dim, icon, eventMsg);
return ps;
}
@ -428,7 +428,7 @@ CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType e
if ( m_table[i] == 0 )
{
m_table[i] = new CMap();
pm = (CMap*)m_table[i];
pm = static_cast<CMap*>(m_table[i]);
pm->Create(pos, dim, icon, eventMsg);
return pm;
}
@ -450,7 +450,7 @@ CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventTy
if ( m_table[i] == 0 )
{
m_table[i] = new CGauge();
pc = (CGauge*)m_table[i];
pc = static_cast<CGauge*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -472,7 +472,7 @@ CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, Eve
if ( m_table[i] == 0 )
{
m_table[i] = new CCompass();
pc = (CCompass*)m_table[i];
pc = static_cast<CCompass*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -494,7 +494,7 @@ CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, Event
if ( m_table[i] == 0 )
{
m_table[i] = new CTarget();
pc = (CTarget*)m_table[i];
pc = static_cast<CTarget*>(m_table[i]);
pc->Create(pos, dim, icon, eventMsg);
return pc;
}
@ -618,11 +618,11 @@ void CWindow::SetName(std::string name)
if ( m_name.length() > 0 && m_bRedim ) // title bar exists?
{
m_buttonReduce = new CButton();
pc = (CButton*)m_buttonReduce;
pc = m_buttonReduce;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
m_buttonFull = new CButton();
pc = (CButton*)m_buttonFull;
pc = m_buttonFull;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
bAdjust = true;
@ -631,7 +631,7 @@ void CWindow::SetName(std::string name)
if ( m_name.length() > 0 && m_bClosable ) // title bar exists?
{
m_buttonClose = new CButton();
pc = (CButton*)m_buttonClose;
pc = m_buttonClose;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
bAdjust = true;