Fixed some compilation warnings

* fixed warnings about hiding virtual functions and several others
dev-ui
Piotr Dziwinski 2013-05-26 17:45:15 +02:00
parent 1a3aa0d60f
commit 538745a731
11 changed files with 56 additions and 38 deletions

View File

@ -428,7 +428,7 @@ void CAutoInfo::UpdateList()
{
info = m_object->GetInfo(i);
sprintf(text, "%s = %.2f", info.name, info.value);
pl->SetName(i, text);
pl->SetItemName(i, text);
}
}
@ -466,7 +466,7 @@ void CAutoInfo::UpdateListVirus()
}
text[j] = 0;
pl->SetName(i, text);
pl->SetItemName(i, text);
}
}

View File

@ -77,6 +77,11 @@ void CAutoJostle::Start(int param, float force)
}
}
// Should never be called
void CAutoJostle::Start(int param)
{
}
// Management of an event.

View File

@ -37,7 +37,9 @@ public:
bool EventProcess(const Event &event);
Error IsEnded();
protected:
private:
// Overriden to avoid warning about hiding virtual function
virtual void Start(int param) override;
protected:
float m_force;

View File

@ -2486,7 +2486,7 @@ void CBrain::UpdateScript(Ui::CWindow *pw)
}
}
pl->SetName(i, name);
pl->SetItemName(i, name);
}
if ( !bSoluce )

View File

@ -4038,7 +4038,7 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i
if ( var == 0 && baseName[0] != 0 )
{
sprintf(buffer, "%s = null;", baseName);
list->SetName(rankList++, buffer);
list->SetItemName(rankList++, buffer);
return;
}
@ -4080,7 +4080,7 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i
value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = %s;", varName, p);
list->SetName(rankList++, buffer);
list->SetItemName(rankList++, buffer);
}
else if ( type == CBotTypString )
{
@ -4088,7 +4088,7 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i
value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = \"%s\";", varName, p);
list->SetName(rankList++, buffer);
list->SetItemName(rankList++, buffer);
}
else if ( type == CBotTypArrayPointer )
{
@ -4104,7 +4104,7 @@ void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, i
else
{
sprintf(buffer, "%s = ?;", varName);
list->SetName(rankList++, buffer);
list->SetItemName(rankList++, buffer);
}
index ++;

View File

@ -88,6 +88,14 @@ bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMs
return MoveAdjust();
}
// Should never be called
bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
assert(false);
return false;
}
// Adjusted after a change of dimensions.
bool CList::MoveAdjust()
@ -611,7 +619,7 @@ bool CList::GetBlink()
// Specifies the text of a line.
void CList::SetName(int i, const char* name)
void CList::SetItemName(int i, const char* name)
{
if ( i < 0 || i >= LISTMAXTOTAL )
return;
@ -630,7 +638,7 @@ void CList::SetName(int i, const char* name)
// Returns the text of a line.
char* CList::GetName(int i)
char* CList::GetItemName(int i)
{
if ( i < 0 || i >= m_totalLine )
return 0;
@ -808,4 +816,4 @@ void CList::MoveScroll()
}
}
} // namespace Ui

View File

@ -69,8 +69,8 @@ class CList : public CControl
void SetBlink(bool bEnable);
bool GetBlink();
void SetName(int i, const char* name);
char* GetName(int i);
void SetItemName(int i, const char* name);
char* GetItemName(int i);
void SetCheck(int i, bool bMode);
bool GetCheck(int i);
@ -93,6 +93,10 @@ class CList : public CControl
void MoveScroll();
void DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign justif);
private:
// Overridden to avoid warning about hiding the virtual function
virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override;
protected:
CButton* m_button[LISTMAXDISPLAY];
CScroll* m_scroll;
@ -117,5 +121,4 @@ class CList : public CControl
};
}
} // namespace Ui

View File

@ -199,7 +199,7 @@ CMainDialog::~CMainDialog()
void CMainDialog::ChangePhase(Phase phase)
{
CWindow* pw;
CWindow* pw = nullptr;
CEdit* pe;
CEditValue* pv;
CLabel* pl;
@ -2310,7 +2310,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( pw == 0 ) break;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == 0 ) break;
StartDeleteGame(pl->GetName(pl->GetSelect()));
StartDeleteGame(pl->GetItemName(pl->GetSelect()));
break;
default:
@ -3688,7 +3688,7 @@ void CMainDialog::ReadNameList()
for (size_t i=0 ; i<fileNames.size() ; ++i )
{
pl->SetName(i, fileNames.at(i).c_str());
pl->SetItemName(i, fileNames.at(i).c_str());
}
}
@ -3764,7 +3764,7 @@ void CMainDialog::UpdateNameList()
for ( i=0 ; i<total ; i++ )
{
// TODO: stricmp?
if ( strcmp(name, pl->GetName(i)) == 0 )
if ( strcmp(name, pl->GetItemName(i)) == 0 )
{
pl->SetSelect(i);
pl->ShowSelect(false);
@ -3800,7 +3800,7 @@ void CMainDialog::UpdateNameEdit()
}
else
{
name = pl->GetName(sel);
name = pl->GetItemName(sel);
pe->SetText(name);
pe->SetCursor(strlen(name), 0);
}
@ -3824,7 +3824,7 @@ void CMainDialog::UpdateNameFace()
sel = pl->GetSelect();
if ( sel == -1 ) return;
name = pl->GetName(sel);
name = pl->GetItemName(sel);
ReadGamerPerso(name);
}
@ -3855,7 +3855,7 @@ void CMainDialog::NameSelect()
}
else
{
m_main->SetGamerName(pl->GetName(sel));
m_main->SetGamerName(pl->GetItemName(sel));
m_main->ChangePhase(PHASE_INIT);
}
@ -3982,7 +3982,7 @@ void CMainDialog::NameDelete()
m_sound->Play(SOUND_TZOING);
return;
}
gamer = pl->GetName(sel);
gamer = pl->GetItemName(sel);
// Deletes all the contents of the file.
sprintf(dir, "%s/%s", m_savegameDir.c_str(), gamer);
@ -4417,7 +4417,7 @@ void CMainDialog::IOReadList()
}
fclose(file);
pl->SetName(m_saveList.size(), name);
pl->SetItemName(m_saveList.size(), name);
m_saveList.push_back(dir_iter->path());
}
}
@ -4426,7 +4426,7 @@ void CMainDialog::IOReadList()
// zly indeks
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs ) {
GetResource(RES_TEXT, RT_IO_NEW, name);
pl->SetName(m_saveList.size(), name);
pl->SetItemName(m_saveList.size(), name);
}
pl->SetSelect(m_saveList.size());
@ -4505,7 +4505,7 @@ void CMainDialog::IODeleteScene()
}
}
catch (std::exception & e) {
GetLogger()->Error("Error removing save %s : %s\n", pl->GetName(sel), e.what());
GetLogger()->Error("Error removing save %s : %s\n", pl->GetItemName(sel), e.what());
}
IOReadList();
@ -4754,7 +4754,7 @@ void CMainDialog::UpdateSceneChap(int &chap)
fclose(file);
}
pl->SetName(j, name);
pl->SetItemName(j, name);
pl->SetEnable(j, true);
}
}
@ -4807,7 +4807,7 @@ void CMainDialog::UpdateSceneChap(int &chap)
bPassed = GetGamerInfoPassed((j+1)*100);
sprintf(line, "%d: %s", j+1, name);
pl->SetName(j, line);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
@ -4917,7 +4917,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
bPassed = GetGamerInfoPassed((chap+1)*100+(j+1));
sprintf(line, "%d: %s", j+1, name);
pl->SetName(j, line);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
@ -5099,7 +5099,7 @@ void CMainDialog::UpdateDisplayDevice()
j = 0;
while ( bufDevices[i] != 0 )
{
pl->SetName(j++, bufDevices+i);
pl->SetItemName(j++, bufDevices+i);
while ( bufDevices[i++] != 0 );
}
@ -5129,7 +5129,7 @@ void CMainDialog::UpdateDisplayMode()
for (Math::IntPoint mode : modes) {
mode_text.str("");
mode_text << mode.x << "x" << mode.y;
pl->SetName(i++, mode_text.str().c_str());
pl->SetItemName(i++, mode_text.str().c_str());
}
pl->SetSelect(m_setupSelMode);
@ -5153,12 +5153,12 @@ void CMainDialog::ChangeDisplay()
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
if ( pl == 0 ) return;
m_setupSelDevice = pl->GetSelect();
//device = pl->GetName(m_setupSelDevice);
//device = pl->GetItemName(m_setupSelDevice);
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
if ( pl == 0 ) return;
m_setupSelMode = pl->GetSelect();
//mode = pl->GetName(m_setupSelMode);
//mode = pl->GetItemName(m_setupSelMode);
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
if ( pc == 0 ) return;

View File

@ -1397,7 +1397,7 @@ void CStudio::UpdateChangeList()
pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT));
if ( pe == nullptr ) return;
strcpy(name, pl->GetName(pl->GetSelect()));
strcpy(name, pl->GetItemName(pl->GetSelect()));
name[pe->GetMaxChar()] = 0; // truncates according lg max editable
p = strchr(name, '\t'); // seeks first tab
if ( p != 0 ) *p = 0;
@ -1526,7 +1526,7 @@ void CStudio::UpdateDialogList()
std::ostringstream temp;
TimeToAscii(fs::last_write_time(file->path()), time);
temp << file->path().filename().string() << '\t' << fs::file_size(file->path()) << " \t" << time;
pl->SetName(i++, temp.str().c_str());
pl->SetItemName(i++, temp.str().c_str());
}
}
}

View File

@ -576,12 +576,12 @@ bool CWindow::GetTooltip(Math::Point pos, std::string &name)
// Specifies the name for the title bar.
void CWindow::SetName(std::string name)
void CWindow::SetName(std::string name, bool tooltip)
{
CButton* pc;
bool bAdjust;
CControl::SetName(name);
CControl::SetName(name, tooltip);
if ( m_buttonReduce != 0 )
{

View File

@ -83,7 +83,7 @@ public:
EventType GetEventTypeFull();
EventType GetEventTypeClose();
void SetName(std::string name);
virtual void SetName(std::string name, bool tooltip = true) override;
void SetTrashEvent(bool bTrash);
bool GetTrashEvent();