Jeck - Quick crashfix when loading without a profiles directory, slight keypad modifications.

This commit is contained in:
wagic.jeck
2009-08-27 03:17:25 +00:00
parent 5aa0aa9374
commit 6728794ce9
7 changed files with 1315 additions and 1305 deletions

View File

@@ -101,7 +101,7 @@ public:
~GameSettings();
int save();
SimplePad * keypadStart(string input, string * _dest = NULL, int _x = SCREEN_WIDTH/2, int _y = SCREEN_HEIGHT/2);
SimplePad * keypadStart(string input, string * _dest = NULL, bool _cancel=true, bool _numpad=false, int _x = SCREEN_WIDTH/2, int _y = SCREEN_HEIGHT/2);
string keypadFinish();
void keypadShutdown();
void keypadTitle(string set);

View File

@@ -40,7 +40,7 @@ public:
SimplePad(bool numbers=false);
SimplePad();
~SimplePad();
int mX; int mY;

View File

@@ -95,7 +95,6 @@ void GameApp::Create()
manaIcons[Constants::MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green");
for (int i = sizeof(manaIcons)/sizeof(manaIcons[0]) - 1; i >= 0; --i) manaIcons[i]->SetHotSpot(16,16);
CommonRes->CreateTexture("sets/back.jpg");
CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285);
CommonRes->GetQuad("back")->SetHotSpot(100, 145);

View File

@@ -282,6 +282,7 @@ string GameSettings::themeGraphic(string filename)
{
char buf[4096];
string theme = (*this)[Options::ACTIVE_THEME].str;
if(theme == "" || theme == "default"){
sprintf(buf,"graphics/%s",filename.c_str());
return buf;
@@ -304,6 +305,8 @@ void GameSettings::checkProfile(){
if(profileOptions != NULL)
SAFE_DELETE(profileOptions);
//Force our directories to exist.
MAKEDIR(RESPATH"/profiles");
string temp = profileFile("","",false,false);
MAKEDIR(temp.c_str());
temp+="/stats";
@@ -394,9 +397,11 @@ void GameSettings::keypadTitle(string set){
if(keypad != NULL)
keypad->title = set;
}
SimplePad * GameSettings::keypadStart(string input, string * _dest,int _x,int _y){
SimplePad * GameSettings::keypadStart(string input, string * _dest,bool _cancel, bool _numpad, int _x,int _y ){
if(keypad == NULL)
keypad = new SimplePad();
keypad->bShowCancel = _cancel;
keypad->bShowNumpad = _numpad;
keypad->mX = _x;
keypad->mY = _y;
keypad->Start(input,_dest);

View File

@@ -331,6 +331,9 @@ void OptionDirectory::Reload(){
char buf[4096];
mDip = opendir(root.c_str());
if(!mDip)
return;
while ((mDit = readdir(mDip))){
if(mDit->d_name[0] != '.'){
sprintf(buf,"%s/%s",root.c_str(),mDit->d_name);
@@ -356,6 +359,9 @@ OptionDirectory::OptionDirectory(string _root, string _id, string _displayValue)
root = _root;
mDip = opendir(root.c_str());
if(!mDip)
return;
while ((mDit = readdir(mDip))){
if(mDit->d_name[0] != '.'){
sprintf(buf,"%s/%s",root.c_str(),mDit->d_name);

View File

@@ -35,7 +35,7 @@ void SimplePad::linkKeys(int from, int to, int dir){
}
}
SimplePad::SimplePad(bool numbers){
SimplePad::SimplePad(){
nbitems = 0;
bActive = false;
selected = 0;