- Added a possibility to put a file "Res.txt" instead of the folder "Res". The file Res.txt is a simple 1 line text file, telling where to find the Res folder, terminated by "/". For example: "../../wagic_res".
This addresses issue 428 . This could also help us in the future, to develop mods.
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-11-07 09:26:29 +00:00
parent b14e3808db
commit 5d907f5abe
31 changed files with 115 additions and 94 deletions

View File

@@ -220,13 +220,13 @@ MTGPack * MTGPacks::randomPack(int key){
return packs[key%s];
}
void MTGPacks::loadAll(){
DIR *mDip = opendir(RESPATH"/packs/");
DIR *mDip = opendir(JGE_GET_RES("packs/").c_str());
struct dirent *mDit;
if(!mDip) return;
while ((mDit = readdir(mDip))){
char myFilename[4096];
sprintf(myFilename, RESPATH"/packs/%s", mDit->d_name);
sprintf(myFilename, JGE_GET_RES("packs/%s").c_str(), mDit->d_name);
if(mDit->d_name[0] == '.') continue;
if(!strcmp(mDit->d_name,"default_booster.txt")) continue;
MTGPack * p = NEW MTGPack(myFilename);
@@ -276,7 +276,7 @@ bool MTGPack::isUnlocked(){
MTGPack * MTGPacks::getDefault(){
if(!defaultBooster.isValid()){
defaultBooster.load(RESPATH"/packs/default_booster.txt");
defaultBooster.load(JGE_GET_RES("packs/default_booster.txt"));
defaultBooster.unlockStatus = 1;
if(!defaultBooster.isValid()){
MTGPackSlot * ps = NEW MTGPackSlot(); ps->copies = 1;