* Fix a few compilation issues.
This commit is contained in:
jean.chalard
2009-08-28 01:58:57 +00:00
parent 62e12380a4
commit e5bbbb358f
2 changed files with 9 additions and 9 deletions

View File

@@ -105,7 +105,7 @@ class OptionSelect:public OptionItem{
virtual void Render(); virtual void Render();
virtual void setData(); virtual void setData();
virtual void initSelections(); virtual void initSelections();
virtual void updateValue(){value++; if (value > selections.size() - 1 || value < 0) value=0;}; virtual void updateValue(){value++; if (value > selections.size() - 1) value=0;};
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
@@ -138,7 +138,7 @@ private:
JTexture * mAvatarTex; JTexture * mAvatarTex;
GameApp * app; GameApp * app;
string preview; string preview;
int initialValue; size_t initialValue;
}; };
class OptionsList{ class OptionsList{

View File

@@ -117,7 +117,7 @@ void OptionSelect::Render(){
renderer->FillRoundRect(x-5,y-2,width-x-5,height,2,options[Metrics::OPTION_ITEM_FC].asColor(ARGB(150,50,50,50))); renderer->FillRoundRect(x-5,y-2,width-x-5,height,2,options[Metrics::OPTION_ITEM_FC].asColor(ARGB(150,50,50,50)));
mFont->DrawString(displayValue.c_str(),x,y); mFont->DrawString(displayValue.c_str(),x,y);
if(value >= 0 && value < selections.size()) if (value < selections.size())
mFont->DrawString(selections[value].c_str(),width-10,y,JGETEXT_RIGHT); mFont->DrawString(selections[value].c_str(),width-10,y,JGETEXT_RIGHT);
else else
mFont->DrawString("Unset",width-10,y,JGETEXT_RIGHT); mFont->DrawString("Unset",width-10,y,JGETEXT_RIGHT);
@@ -126,7 +126,7 @@ void OptionSelect::Render(){
void OptionSelect::setData() void OptionSelect::setData()
{ {
if(id == "") return; if(id == "") return;
if(value >= 0 && value < selections.size()) if (value < selections.size())
options[id] = GameOption(selections[value]); options[id] = GameOption(selections[value]);
} }
@@ -207,7 +207,7 @@ OptionProfile::OptionProfile(GameApp * _app): OptionDirectory(RESPATH"/profiles"
void OptionProfile::updateValue(){ void OptionProfile::updateValue(){
value++; value++;
if (value > selections.size() - 1 || value < 0) if (value > selections.size() - 1)
value=0; value=0;
populate(); populate();
@@ -216,7 +216,7 @@ void OptionProfile::updateValue(){
void OptionProfile::populate(){ void OptionProfile::populate(){
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
string temp = options[Options::ACTIVE_PROFILE].str; string temp = options[Options::ACTIVE_PROFILE].str;
if(value < 0 || value >= selections.size()){ //TODO fail gracefully. if (value >= selections.size()){ //TODO fail gracefully.
return; return;
} }
@@ -304,7 +304,7 @@ bool OptionProfile::Leaving(){
void OptionProfile::cancelSubmode() void OptionProfile::cancelSubmode()
{ {
if(initialValue < 0 || initialValue >= selections.size()) if (initialValue >= selections.size())
return; return;
options[Options::ACTIVE_PROFILE] = selections[initialValue]; options[Options::ACTIVE_PROFILE] = selections[initialValue];
@@ -313,7 +313,7 @@ void OptionProfile::cancelSubmode()
} }
void OptionProfile::acceptSubmode() void OptionProfile::acceptSubmode()
{ {
if(value < 0 || value >= selections.size()) if (value >= selections.size())
return; return;
options[Options::ACTIVE_PROFILE] = selections[value]; options[Options::ACTIVE_PROFILE] = selections[value];
@@ -775,4 +775,4 @@ return out << "OptionString ::: displayValue : " << displayValue
<< " ; value : " << value << " ; value : " << value
<< " ; hasFocus : " << hasFocus << " ; hasFocus : " << hasFocus
<< " ; x,y : " << x << "," << y; << " ; x,y : " << x << "," << y;
} }