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
+1 -1
View File
@@ -101,7 +101,7 @@ public:
~GameSettings(); ~GameSettings();
int save(); 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(); string keypadFinish();
void keypadShutdown(); void keypadShutdown();
void keypadTitle(string set); void keypadTitle(string set);
+1 -1
View File
@@ -40,7 +40,7 @@ public:
SimplePad(bool numbers=false); SimplePad();
~SimplePad(); ~SimplePad();
int mX; int mY; int mX; int mY;
-1
View File
@@ -95,7 +95,6 @@ void GameApp::Create()
manaIcons[Constants::MTG_COLOR_GREEN] = GameApp::CommonRes->GetQuad("c_green"); 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); for (int i = sizeof(manaIcons)/sizeof(manaIcons[0]) - 1; i >= 0; --i) manaIcons[i]->SetHotSpot(16,16);
CommonRes->CreateTexture("sets/back.jpg"); CommonRes->CreateTexture("sets/back.jpg");
CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285); CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285);
CommonRes->GetQuad("back")->SetHotSpot(100, 145); CommonRes->GetQuad("back")->SetHotSpot(100, 145);
+6 -1
View File
@@ -282,6 +282,7 @@ string GameSettings::themeGraphic(string filename)
{ {
char buf[4096]; char buf[4096];
string theme = (*this)[Options::ACTIVE_THEME].str; string theme = (*this)[Options::ACTIVE_THEME].str;
if(theme == "" || theme == "default"){ if(theme == "" || theme == "default"){
sprintf(buf,"graphics/%s",filename.c_str()); sprintf(buf,"graphics/%s",filename.c_str());
return buf; return buf;
@@ -304,6 +305,8 @@ void GameSettings::checkProfile(){
if(profileOptions != NULL) if(profileOptions != NULL)
SAFE_DELETE(profileOptions); SAFE_DELETE(profileOptions);
//Force our directories to exist.
MAKEDIR(RESPATH"/profiles");
string temp = profileFile("","",false,false); string temp = profileFile("","",false,false);
MAKEDIR(temp.c_str()); MAKEDIR(temp.c_str());
temp+="/stats"; temp+="/stats";
@@ -394,9 +397,11 @@ void GameSettings::keypadTitle(string set){
if(keypad != NULL) if(keypad != NULL)
keypad->title = set; 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) if(keypad == NULL)
keypad = new SimplePad(); keypad = new SimplePad();
keypad->bShowCancel = _cancel;
keypad->bShowNumpad = _numpad;
keypad->mX = _x; keypad->mX = _x;
keypad->mY = _y; keypad->mY = _y;
keypad->Start(input,_dest); keypad->Start(input,_dest);
+6
View File
@@ -331,6 +331,9 @@ void OptionDirectory::Reload(){
char buf[4096]; char buf[4096];
mDip = opendir(root.c_str()); mDip = opendir(root.c_str());
if(!mDip)
return;
while ((mDit = readdir(mDip))){ while ((mDit = readdir(mDip))){
if(mDit->d_name[0] != '.'){ if(mDit->d_name[0] != '.'){
sprintf(buf,"%s/%s",root.c_str(),mDit->d_name); sprintf(buf,"%s/%s",root.c_str(),mDit->d_name);
@@ -356,6 +359,9 @@ OptionDirectory::OptionDirectory(string _root, string _id, string _displayValue)
root = _root; root = _root;
mDip = opendir(root.c_str()); mDip = opendir(root.c_str());
if(!mDip)
return;
while ((mDit = readdir(mDip))){ while ((mDit = readdir(mDip))){
if(mDit->d_name[0] != '.'){ if(mDit->d_name[0] != '.'){
sprintf(buf,"%s/%s",root.c_str(),mDit->d_name); sprintf(buf,"%s/%s",root.c_str(),mDit->d_name);
+1 -1
View File
@@ -35,7 +35,7 @@ void SimplePad::linkKeys(int from, int to, int dir){
} }
} }
SimplePad::SimplePad(bool numbers){ SimplePad::SimplePad(){
nbitems = 0; nbitems = 0;
bActive = false; bActive = false;
selected = 0; selected = 0;