Revision: 5970
http://exult.svn.sourceforge.net/exult/?rev=5970&view=rev
Author: marzojr
Date: 2008-08-14 15:12:29 +0000 (Thu, 14 Aug 2008)
Log Message:
-----------
* data/si/shape_info.txt: Eliminating duplicate data.
* audio/conv.cc: Added indices for the array elements.
* All others: games/mods now store the cfg name as well as the path prefix
tag. The latter is now mostly decoupled from the former (the exception:
for new games, it is "DEVEL_" plus the uppercase of the cfg name), being
based on the game's identity instead.
Modified Paths:
--------------
exult/trunk/ChangeLog
exult/trunk/audio/conv.cc
exult/trunk/data/si/shape_info.txt
exult/trunk/exultmenu.cc
exult/trunk/game.cc
exult/trunk/gamemgr/modmgr.cc
exult/trunk/gamemgr/modmgr.h
exult/trunk/mapedit/studio.cc
Modified: exult/trunk/ChangeLog
===================================================================
--- exult/trunk/ChangeLog 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/ChangeLog 2008-08-14 15:12:29 UTC (rev 5970)
@@ -1,3 +1,11 @@
+2008-08-14 Marzo Sette Torres Junior <marzojr@...>
+ * data/si/shape_info.txt: Eliminating duplicate data.
+ * audio/conv.cc: Added indices for the array elements.
+ * All others: games/mods now store the cfg name as well as the path prefix
+ tag. The latter is now mostly decoupled from the former (the exception:
+ for new games, it is "DEVEL_" plus the uppercase of the cfg name), being
+ based on the game's identity instead.
+
2008-08-12 Marzo Sette Torres Junior <marzojr@...>
* Fixing yesterday's multiracial fix for the cases where SS is installed
under 'serpentisle' in Exult.cfg (like is most likely is for the vast
Modified: exult/trunk/audio/conv.cc
===================================================================
--- exult/trunk/audio/conv.cc 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/audio/conv.cc 2008-08-14 15:12:29 UTC (rev 5970)
@@ -21,121 +21,121 @@
// sfx with ??? are converted to sfx #135 so you can tell
// it's wrong. Some I suspect to be something so it's not set 135
const int bgconv[] = {
- 12, //Bow Twang
- 80, //Missile ??
- 9, //Blade
- 11, //Blunt
- 125, //Hit
- 61, //Graze
- 92, //Rotating
- 40, //Explos #1
- 41, //Explos #2
- 42, //Explos #3
- 127, //Whip pta
- 71, //Thunder
- 44, //Fireball
- 65, //Torches
- 94, //Gumps!!!!!
- 56, //Gavel
- 121, //Treadle
- 117, //Clock tick
- 118, //Clock tock
- 16, //Chime
- 45, //Fire 1
- 46, //Fire 2
- 47, //Fire 3
- 28, //Bell Ding
- 30, //Bell Dong
- 72, //Log Saw
- 78, //Mill Stone
- 68, //Key
- 70, //Lever
- 135, //Roulette
- 32, //Creeeeaack
- 31, //Creeeeaack
- 89, //Portcullis
- 88, //Portcullis close
- 35, //Drawbridge
- 34, //Drawbridge
- 135, //Fuse ???
- 95, //Shadoobie
- 99, //Splash
- 126, //W. Anchor
- 37, //D. Anchor
- 18, //Creeeeaack
- 17, //Creeeeaack
- 2, //gumpster
- 1, //gumpster
- 49, //Forge
- 33, //Douse
- 7, //Bellows
- 50, //Fountain
- 109, //Surf's up
- 107, //Stream
- 133, //Waterfall
- 129, //Wind ???
- 135, //Rainman ???
- 114, //Swamp 1
- 110, //Swamp 2
- 111, //Swamp 3
- 112, //Swamp 4
- 113, //Swamp 5
- 132, //Waterwheel
- 39, //Eruption ???
- 22, //Crickets
- 116, //Thunder
- 128, //Whirlpool
- 64, //Heal
- 20, //Spell
- 67, //Spell
- 130, //Wizard ???
- 57, //General
- 48, //Fizzle
- 84, //New Spell
- 82, //MPdrain
- 83, //MPgain
- 134, //Footstep L
- 134, //Footstep R
- 108, //Success
- 43, //Failure
- 55, //Moongate
- 54, //Moongate B
- 26, //Entity Hum
- 101, //Entity Hum
- 115, //Entity Hum
- 96, //Shreik
- 135, //Slap ???
- 135, //Oooffff ???
- 135, //Whaahh ???
- 10, //Blocked !!
- 52, //Furl
- 124, //Unfurl
- 135, //MISSING
- 36, //Drink ???
- 38, //Eat ???
- 135, //Whip ptb
- 135, //Doorslam
- 135, //Portcullis
- 135, //Drawbridge
- 135, //Closed
- 100, //SpinnWheel
- 79, //Minning ???
- 59, //Minning ???
- 93, //Shutters
- 135, //1armbandit ???
- 73, //Loom
- 103, //Stalags
- 75, //MagicWeap
- 86, //Poison
- 65, //Ignite
- 62, //Yo yo LA ???
- 131, //Wind Spell
- 90, //Protect
- 91, //PoisonSpel ???
- 66, //IgniteSpel
- 21, //CradleRock
- 5, //Beeezzzzz
- 74, //Machines
- 255, //Static - not used in SI
- 136 //Tick Tock
+ 12, //Bow Twang 0
+ 80, //Missile ?? 1
+ 9, //Blade 2
+ 11, //Blunt 3
+ 125, //Hit 4
+ 61, //Graze 5
+ 92, //Rotating 6
+ 40, //Explos #1 7
+ 41, //Explos #2 8
+ 42, //Explos #3 9
+ 127, //Whip pta 10
+ 71, //Thunder 11
+ 44, //Fireball 12
+ 65, //Torches 13
+ 94, //Gumps!!!!! 14
+ 56, //Gavel 15
+ 121, //Treadle 16
+ 117, //Clock tick 17
+ 118, //Clock tock 18
+ 16, //Chime 19
+ 45, //Fire 1 20
+ 46, //Fire 2 21
+ 47, //Fire 3 22
+ 28, //Bell Ding 23
+ 30, //Bell Dong 24
+ 72, //Log Saw 25
+ 78, //Mill Stone 26
+ 68, //Key 27
+ 70, //Lever 28
+ 135, //Roulette 29
+ 32, //Creeeeaack 30
+ 31, //Creeeeaack 31
+ 89, //Portcullis 32
+ 88, //Portcullis close 33
+ 35, //Drawbridge 34
+ 34, //Drawbridge 35
+ 135, //Fuse ??? 36
+ 95, //Shadoobie 37
+ 99, //Splash 38
+ 126, //W. Anchor 39
+ 37, //D. Anchor 40
+ 18, //Creeeeaack 41
+ 17, //Creeeeaack 42
+ 2, //gumpster 43
+ 1, //gumpster 44
+ 49, //Forge 45
+ 33, //Douse 46
+ 7, //Bellows 47
+ 50, //Fountain 48
+ 109, //Surf's up 49
+ 107, //Stream 50
+ 133, //Waterfall 51
+ 129, //Wind ??? 52
+ 135, //Rainman ??? 53
+ 114, //Swamp 1 54
+ 110, //Swamp 2 55
+ 111, //Swamp 3 56
+ 112, //Swamp 4 57
+ 113, //Swamp 5 58
+ 132, //Waterwheel 59
+ 39, //Eruption ??? 60
+ 22, //Crickets 61
+ 116, //Thunder 62
+ 128, //Whirlpool 63
+ 64, //Heal 64
+ 20, //Spell 65
+ 67, //Spell 66
+ 130, //Wizard ??? 67
+ 57, //General 68
+ 48, //Fizzle 69
+ 84, //New Spell 70
+ 82, //MPdrain 71
+ 83, //MPgain 72
+ 134, //Footstep L 73
+ 134, //Footstep R 74
+ 108, //Success 75
+ 43, //Failure 76
+ 55, //Moongate 77
+ 54, //Moongate B 78
+ 26, //Entity Hum 79
+ 101, //Entity Hum 80
+ 115, //Entity Hum 81
+ 96, //Shreik 82
+ 135, //Slap ??? 83
+ 135, //Oooffff ??? 84
+ 135, //Whaahh ??? 85
+ 10, //Blocked !! 86
+ 52, //Furl 87
+ 124, //Unfurl 88
+ 135, //MISSING 89
+ 36, //Drink ??? 90
+ 38, //Eat ??? 91
+ 135, //Whip ptb 92
+ 135, //Doorslam 93
+ 135, //Portcullis 94
+ 135, //Drawbridge 95
+ 135, //Closed 96
+ 100, //SpinnWheel 97
+ 79, //Minning ??? 98
+ 59, //Minning ??? 99
+ 93, //Shutters 100
+ 135, //1armbandit ??? 101
+ 73, //Loom 102
+ 103, //Stalags 103
+ 75, //MagicWeap 104
+ 86, //Poison 105
+ 65, //Ignite 106
+ 62, //Yo yo LA ??? 107
+ 131, //Wind Spell 108
+ 90, //Protect 109
+ 91, //PoisonSpel ??? 110
+ 66, //IgniteSpel 111
+ 21, //CradleRock 112
+ 5, //Beeezzzzz 113
+ 74, //Machines 114
+ 255, //Static - not used in SI 115
+ 136 //Tick Tock 116
};
Modified: exult/trunk/data/si/shape_info.txt
===================================================================
--- exult/trunk/data/si/shape_info.txt 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/data/si/shape_info.txt 2008-08-14 15:12:29 UTC (rev 5970)
@@ -159,10 +159,6 @@
#
:301/71
-# Poison/Sleep Field
-#
-:900/129
-
# Pulsating object
#
:726:26
Modified: exult/trunk/exultmenu.cc
===================================================================
--- exult/trunk/exultmenu.cc 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/exultmenu.cc 2008-08-14 15:12:29 UTC (rev 5970)
@@ -323,7 +323,7 @@
char *menustringname = new char[strlen(exultgame.get_menu_string().c_str())+1];
strcpy(menustringname, exultgame.get_menu_string().c_str());
Shape_frame *sfxicon = exult_flx.get_shape(EXULT_FLX_SFX_ICON_SHP,
- Audio::get_ptr()->can_sfx(exultgame.get_title())?1:0);
+ Audio::get_ptr()->can_sfx(exultgame.get_cfgname())?1:0);
MenuGameEntry *entry = new MenuGameEntry(fonton, font,
menustringname,
sfxicon, menux, ypos);
Modified: exult/trunk/game.cc
===================================================================
--- exult/trunk/game.cc 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/game.cc 2008-08-14 15:12:29 UTC (rev 5970)
@@ -98,7 +98,7 @@
Game *Game::create_game(BaseGameInfo *mygame)
{
mygame->setup_game_paths();
- gametitle = mygame->get_title();
+ gametitle = mygame->get_cfgname();
modtitle = mygame->get_mod_title();
game_type = mygame->get_game_type();
expansion = mygame->have_expansion();
Modified: exult/trunk/gamemgr/modmgr.cc
===================================================================
--- exult/trunk/gamemgr/modmgr.cc 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/gamemgr/modmgr.cc 2008-08-14 15:12:29 UTC (rev 5970)
@@ -43,21 +43,27 @@
using std::string;
using std::vector;
+#if 0
+#define DEBUG_PATHS 1
+#endif
+
// BaseGameInfo: Generic information and functions common to mods and games
void BaseGameInfo::setup_game_paths ()
{
// Make aliases to the current game's paths.
- string system_path_tag(to_uppercase(title.c_str()));
- clone_system_path("<STATIC>", "<" + system_path_tag + "_STATIC>");
- clone_system_path("<MODS>", "<" + system_path_tag + "_MODS>");
+ clone_system_path("<STATIC>", "<" + path_prefix + "_STATIC>");
+ clone_system_path("<MODS>", "<" + path_prefix + "_MODS>");
+ string mod_path_tag = path_prefix;
+
if (!mod_title.empty())
- system_path_tag = system_path_tag + "_" + mod_title;
- to_uppercase(system_path_tag);
- clone_system_path("<GAMEDAT>", "<" + system_path_tag + "_GAMEDAT>");
- clone_system_path("<SAVEGAME>", "<" + system_path_tag + "_SAVEGAME>");
- if (is_system_path_defined("<" + system_path_tag + "_PATCH>"))
- clone_system_path("<PATCH>", "<" + system_path_tag + "_PATCH>");
+ mod_path_tag += ("_" + to_uppercase((const string)mod_title));
+
+ clone_system_path("<GAMEDAT>", "<" + mod_path_tag + "_GAMEDAT>");
+ clone_system_path("<SAVEGAME>", "<" + mod_path_tag + "_SAVEGAME>");
+
+ if (is_system_path_defined("<" + mod_path_tag + "_PATCH>"))
+ clone_system_path("<PATCH>", "<" + mod_path_tag + "_PATCH>");
else
clear_system_path("<PATCH>");
@@ -83,13 +89,15 @@
Exult_Game game,
const string& name,
const string& mod,
+ const string& path,
bool exp,
const Configuration& modconfig
)
{
type = game;
- title = name;
+ cfgname = name;
mod_title = mod;
+ path_prefix = path;
expansion = exp;
string config_path, default_dir, modversion, savedir, patchdir, gamedatdir;
@@ -148,13 +156,14 @@
}
}
- string tagstr(mod_title), systagstr(to_uppercase(title.c_str())),
- system_path_tag(to_uppercase(title + ("_" + tagstr))),
- mods_dir("<" + systagstr + "_MODS>"), data_directory(mods_dir + "/" + tagstr),
+ string tagstr(to_uppercase((const string)mod_title)),
+ system_path_tag(path_prefix + "_" + tagstr),
+ mods_dir("<" + path_prefix + "_MODS>"),
+ data_directory(mods_dir + "/" + mod_title),
mods_macro("__MODS__"), mod_path_macro("__MOD_PATH__");
const char *home = 0;
- string home_game(""); // Gets $HOME/.exult/title/tagstr.
+ string home_game(""); // Gets $HOME/.exult/path_prefix/mod_title.
string save_path = data_directory;
#if (!defined(WIN32) && !defined(MACOS))
@@ -162,14 +171,14 @@
{
home_game = home;
home_game += "/.exult";
- // Create $HOME/.exult/title.
+ // Create $HOME/.exult/cfgname.
U7mkdir(home_game.c_str(), 0755);
- home_game = home_game + '/' + title;
+ home_game = home_game + '/' + cfgname;
U7mkdir(home_game.c_str(), 0755);
// Successfully created dir?
if (U7exists(home_game.c_str()))
{
- home_game = home_game + '/' + tagstr;
+ home_game = home_game + '/' + mod_title;
U7mkdir(home_game.c_str(), 0755);
if (U7exists(home_game.c_str()))
save_path = home_game;
@@ -177,6 +186,10 @@
}
#endif
+#ifdef DEBUG_PATHS
+ cout << "path prefix of " << cfgname << " mod " << mod_title
+ << " is: " << system_path_tag << endl;
+#endif
config_path = "mod_info/gamedat_path";
default_dir = save_path + "/gamedat";
modconfig.value(config_path, gamedatdir, default_dir.c_str());
@@ -184,6 +197,10 @@
ReplaceMacro(gamedatdir, mods_macro, mods_dir);
ReplaceMacro(gamedatdir, mod_path_macro, save_path);
add_system_path("<" + system_path_tag + "_GAMEDAT>", get_system_path(gamedatdir));
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
+ << " game directories to: " << get_system_path(gamedatdir) << endl;
+#endif
config_path = "mod_info/savegame_path";
modconfig.value(config_path, savedir, save_path.c_str());
@@ -191,6 +208,10 @@
ReplaceMacro(savedir, mods_macro, mods_dir);
ReplaceMacro(savedir, mod_path_macro, save_path);
add_system_path("<" + system_path_tag + "_SAVEGAME>", get_system_path(savedir));
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
+ << " game directories to: " << get_system_path(savedir) << endl;
+#endif
config_path = "mod_info/patch";
default_dir = data_directory + "/patch";
@@ -199,6 +220,10 @@
ReplaceMacro(patchdir, mods_macro, mods_dir);
ReplaceMacro(patchdir, mod_path_macro, data_directory);
add_system_path("<" + system_path_tag + "_PATCH>", get_system_path(patchdir));
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
+ << " game directories to: " << get_system_path(patchdir) << endl;
+#endif
}
#ifdef HAVE_ZIP_SUPPORT
@@ -296,58 +321,79 @@
}
// ModManager: class that manages a game's modlist and paths
-ModManager::ModManager (const string& name, const string& menu)
+ModManager::ModManager (const string& name, const string& menu, bool needtitle)
{
- title = name;
+ cfgname = name;
mod_title = "";
- menustring = menu;
to_uppercase(name);
// We will NOT trust config with these values.
// We MUST NOT use path tags at this point yet!
string static_dir;
{
- string data_directory, default_dir("./" + title),
- config_path, base_cfg_path("config/disk/game/" + title);
+ string data_directory, default_dir("./" + cfgname),
+ config_path, base_cfg_path("config/disk/game/" + cfgname);
config_path = base_cfg_path + "/path";
config->value(config_path.c_str(), data_directory, default_dir.c_str());
config_path = base_cfg_path + "/static_path";
default_dir = data_directory + "/static";
config->value(config_path.c_str(), static_dir, default_dir.c_str());
}
+
string initgam_path(static_dir + "/initgame.dat");
found = U7exists(initgam_path);
+
if (!found)
return; // Everything else if futile if base game not found.
- char *static_identity = get_game_identity(initgam_path.c_str(), title);
+
+ char *static_identity = get_game_identity(initgam_path.c_str(), cfgname);
+
+ string new_title;
if (!strcmp(static_identity,"ULTIMA7"))
{
type = BLACK_GATE;
+ path_prefix = to_uppercase(CFG_BG_NAME);
+ if (needtitle)
+ new_title = CFG_BG_TITLE;
expansion = false;
}
else if (!strcmp(static_identity, "FORGE"))
{
type = BLACK_GATE;
+ path_prefix = to_uppercase(CFG_FOV_NAME);
+ if (needtitle)
+ new_title = CFG_FOV_TITLE;
expansion = true;
}
else if (!strcmp(static_identity, "SERPENT ISLE"))
{
type = SERPENT_ISLE;
+ path_prefix = to_uppercase(CFG_SI_NAME);
+ if (needtitle)
+ new_title = CFG_SI_TITLE;
expansion = false;
}
else if (!strcmp(static_identity, "SILVER SEED"))
{
type = SERPENT_ISLE;
+ path_prefix = to_uppercase(CFG_SS_NAME);
+ if (needtitle)
+ new_title = CFG_SS_TITLE;
expansion = true;
}
else
{
type = EXULT_DEVEL_GAME;
+ path_prefix = "DEVEL" + to_uppercase(name);
+ new_title = menu; // To be safe.
expansion = false;
}
delete[] static_identity;
- modlist.clear();
+ menustring = needtitle ? new_title : menu;
+
+ get_game_paths();
+ gather_mods();
}
void ModManager::gather_mods()
@@ -355,9 +401,7 @@
modlist.clear(); // Just to be on the safe side.
FileList filenames;
- string pathtag(title);
- to_uppercase(pathtag);
- string pathname("<" + pathtag + "_MODS>");
+ string pathname("<" + path_prefix + "_MODS>");
int ptroff = get_system_path(pathname).length()+1;
// If the dir doesn't exist, leave at once.
@@ -374,7 +418,8 @@
{
string modtitle = filenames[i].substr(ptroff,
filenames[i].size() - ptroff - 4);
- modlist.push_back(ModInfo(type, title, modtitle, expansion,
+ modlist.push_back(ModInfo(type, cfgname,
+ modtitle, path_prefix, expansion,
Configuration(filenames[i], "modinfo")));
}
}
@@ -399,7 +444,8 @@
void ModManager::add_mod (const string& mod, Configuration& modconfig)
{
- modlist.push_back(ModInfo(type, title, mod, expansion, modconfig));
+ modlist.push_back(ModInfo(type, cfgname, mod, path_prefix,
+ expansion, modconfig));
store_system_paths();
}
@@ -432,32 +478,35 @@
* per-game system_path entries, which are then used later once the
* game is selected.
*/
-static void get_game_paths(const string &gametitle, const string &pathtag)
+void ModManager::get_game_paths()
{
string data_directory, static_dir, gamedat_dir, savegame_dir,
- default_dir("./" + gametitle),
- system_path_tag(to_uppercase(pathtag)), config_path,
- base_cfg_path("config/disk/game/" + gametitle);
+ default_dir("./" + cfgname), config_path,
+ base_cfg_path("config/disk/game/" + cfgname);
config_path = base_cfg_path + "/path";
config->value(config_path.c_str(), data_directory, default_dir.c_str());
if (data_directory == default_dir)
config->set(config_path.c_str(), data_directory, true);
-#if 0
- cout << "setting " << gametitle
+#ifdef DEBUG_PATHS
+ cout << "path prefix of " << cfgname
+ << " is: " << path_prefix << endl;
+#endif
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
<< " game directories to: " << data_directory << endl;
#endif
config_path = base_cfg_path + "/static_path";
default_dir = data_directory + "/static";
config->value(config_path.c_str(), static_dir, default_dir.c_str());
- add_system_path("<" + system_path_tag + "_STATIC>", static_dir);
-#if 0
- cout << "setting " << gametitle
+ add_system_path("<" + path_prefix + "_STATIC>", static_dir);
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
<< " static directory to: " << static_dir << endl;
#endif
const char *home = 0; // Will get $HOME.
- string home_game(""); // Gets $HOME/.exult/gametitle.
+ string home_game(""); // Gets $HOME/.exult/cfgname.
config_path = base_cfg_path + "/gamedat_path";
default_dir = data_directory + "/gamedat";
config->value(config_path.c_str(), gamedat_dir, "");
@@ -468,13 +517,13 @@
{
home_game = home;
home_game += "/.exult";
- // Create $HOME/.exult/gametitle.
+ // Create $HOME/.exult/cfgname.
U7mkdir(home_game.c_str(), 0755);
- home_game = home_game + '/' + gametitle;
+ home_game = home_game + '/' + cfgname;
U7mkdir(home_game.c_str(), 0755);
// Successfully created dir?
if (U7exists(home_game.c_str()))
- { // Use $HOME/.exult/gametitle/gamedat.
+ { // Use $HOME/.exult/cfgname/gamedat.
gamedat_dir = home_game + "/gamedat";
config->set(config_path.c_str(), gamedat_dir.c_str(),
true);
@@ -485,9 +534,9 @@
#endif
if (gamedat_dir == "") // Didn't create it in $HOME/.exult?
gamedat_dir = default_dir;
- add_system_path("<" + system_path_tag + "_GAMEDAT>", gamedat_dir);
-#if 0
- cout << "setting " << gametitle
+ add_system_path("<" + path_prefix + "_GAMEDAT>", gamedat_dir);
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
<< " gamedat directory to: " << gamedat_dir << endl;
#endif
@@ -501,9 +550,9 @@
home_game.c_str());
config->set(config_path.c_str(), savegame_dir.c_str(), true);
}
- add_system_path("<" + system_path_tag + "_SAVEGAME>", savegame_dir);
-#if 0
- cout << "setting " << gametitle
+ add_system_path("<" + path_prefix + "_SAVEGAME>", savegame_dir);
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
<< " savegame directory to: " << savegame_dir << endl;
#endif
@@ -512,7 +561,7 @@
default_dir = data_directory + "/patch";
config->value(config_path.c_str(), patch_directory,
default_dir.c_str());
- add_system_path("<" + system_path_tag + "_PATCH>", patch_directory.c_str());
+ add_system_path("<" + path_prefix + "_PATCH>", patch_directory.c_str());
config_path = base_cfg_path + "/mods";
string mods_directory;
@@ -525,7 +574,11 @@
mods_directory.resize(mods_directory.length()-1);
config->set(config_path.c_str(), mods_directory, true);
}
- add_system_path("<" + system_path_tag + "_MODS>", mods_directory.c_str());
+ add_system_path("<" + path_prefix + "_MODS>", mods_directory.c_str());
+#ifdef DEBUG_PATHS
+ cout << "setting " << cfgname
+ << " savegame directory to: " << mods_directory << endl;
+#endif
}
// GameManager: class that manages the installed games
@@ -554,55 +607,31 @@
{
string gameentry = *it;
// Load the paths for all games found:
- string name = gameentry, new_title, pathtag;
- to_uppercase(name);
- name += "\nMissing Title";
+ string base_title = gameentry, new_title;
+ to_uppercase(base_title);
+ base_title += "\nMissing Title";
config->value(config_path + "/" + gameentry + "/title",
- game_title, name.c_str());
- bool need_title = game_title == name;
+ game_title, base_title.c_str());
+ bool need_title = game_title == base_title;
// This checks static identity and sets game type.
- ModManager game = ModManager(gameentry, game_title);
+ ModManager game = ModManager(gameentry, game_title, need_title);
if (!game.is_there())
continue;
if (game.get_game_type() == BLACK_GATE)
{
if (game.have_expansion())
- {
fovind = games.size();
- new_title = CFG_FOV_TITLE;
- pathtag = CFG_FOV_NAME;
- }
else
- {
bgind = games.size();
- new_title = CFG_BG_TITLE;
- pathtag = CFG_BG_NAME;
- }
}
else if (game.get_game_type() == SERPENT_ISLE)
{
if (game.have_expansion())
- {
ssind = games.size();
- new_title = CFG_SS_TITLE;
- pathtag = CFG_SS_NAME;
- }
else
- {
siind = games.size();
- new_title = CFG_SI_TITLE;
- pathtag = CFG_SI_NAME;
- }
}
- else
- pathtag = gameentry;
- if (need_title && new_title.size() > 0)
- game.set_menu_string(new_title);
-
- get_game_paths(gameentry, pathtag);
- game.set_title(pathtag);
- game.gather_mods();
games.push_back(game);
}
@@ -670,7 +699,7 @@
{
for (vector<ModManager>::iterator it = games.begin();
it != games.end(); ++it)
- if (it->get_title() == name)
+ if (it->get_cfgname() == name)
return &*it;
return 0;
}
@@ -678,14 +707,13 @@
int GameManager::find_game_index (const string& name)
{
for(int i=0; i < games.size(); i++)
- if (games[i].get_title() == name)
+ if (games[i].get_cfgname() == name)
return i;
return -1;
}
void GameManager::add_game (const string& name, const string& menu)
{
- get_game_paths(name, name);
- games.push_back(ModManager(name, menu));
+ games.push_back(ModManager(name, menu, false));
store_system_paths();
}
Modified: exult/trunk/gamemgr/modmgr.h
===================================================================
--- exult/trunk/gamemgr/modmgr.h 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/gamemgr/modmgr.h 2008-08-14 15:12:29 UTC (rev 5970)
@@ -33,35 +33,38 @@
{
protected:
Exult_Game type; // Game type
- string title; // The *Game* title
+ string cfgname; // What the game is called in Exult.cfg
+ string path_prefix; // System path prefix for the game/mod.
string mod_title; // Internal mod name, the mod's title
string menustring; // Text displayed in mods menu
bool expansion; // For FoV/SS ONLY.
bool found; // If the game/mod is found.
public:
- BaseGameInfo () : type(NONE), title(""), mod_title(""),
+ BaseGameInfo () : type(NONE), cfgname(""), mod_title(""), path_prefix(""),
menustring(""), expansion(false), found(false)
{ }
- BaseGameInfo (const Exult_Game ty, const char *ti, const char *mt,
- const char *ms, bool exp, bool f)
- : type(ty), title(ti), mod_title(mt), menustring(ms), expansion(exp),
- found(f)
+ BaseGameInfo (const Exult_Game ty, const char *cf, const char *mt,
+ const char *pt, const char *ms, bool exp, bool f)
+ : type(ty), cfgname(cf), mod_title(mt), path_prefix(pt),
+ menustring(ms), expansion(exp), found(f)
{ }
BaseGameInfo (const BaseGameInfo& other)
- : type(other.type), title(other.title), mod_title(other.mod_title),
- menustring(other.menustring), expansion(other.expansion),
- found(other.found)
+ : type(other.type), cfgname(other.cfgname), mod_title(other.mod_title),
+ path_prefix(other.path_prefix), menustring(other.menustring),
+ expansion(other.expansion), found(other.found)
{ }
~BaseGameInfo () { }
- string get_title () const { return title; }
+ string get_cfgname () const { return cfgname; }
+ string get_path_prefix () const { return path_prefix; }
string get_mod_title () const { return mod_title; }
string get_menu_string () const { return menustring; }
Exult_Game get_game_type () const { return type; }
// For FoV/SS ONLY.
bool have_expansion () const { return expansion; }
bool is_there () const { return found; }
- void set_title (const string& name) { title = name; }
+ void set_cfgname (const string& name) { cfgname = name; }
+ void set_path_prefix (const string& pt) { path_prefix = pt; }
void set_mod_title (const string& mod) { mod_title = mod; }
void set_menu_string (const string& menu) { menustring = menu; }
void set_game_type (Exult_Game game) { type = game; }
@@ -77,12 +80,13 @@
protected:
bool compatible;
public:
- ModInfo (Exult_Game game, const string& name, const string& mod, bool exp,
- const Configuration& modconfig);
+ ModInfo (Exult_Game game, const string& name, const string& mod,
+ const string& path, bool exp, const Configuration& modconfig);
ModInfo (const ModInfo& other)
- : BaseGameInfo(other.type, other.title.c_str(),
- other.mod_title.c_str(), other.menustring.c_str(),
- other.expansion, other.found), compatible(other.compatible)
+ : BaseGameInfo(other.type, other.cfgname.c_str(),
+ other.mod_title.c_str(), other.path_prefix.c_str(),
+ other.menustring.c_str(), other.expansion, other.found),
+ compatible(other.compatible)
{ }
~ModInfo () {}
@@ -94,12 +98,12 @@
protected:
std::vector<ModInfo> modlist;
public:
- ModManager (const string& name, const string& menu);
+ ModManager (const string& name, const string& menu, bool needtitle);
ModManager () { }
ModManager (const ModManager& other)
- : BaseGameInfo(other.type, other.title.c_str(),
- other.mod_title.c_str(), other.menustring.c_str(),
- other.expansion, other.found)
+ : BaseGameInfo(other.type, other.cfgname.c_str(),
+ other.mod_title.c_str(), other.path_prefix.c_str(),
+ other.menustring.c_str(), other.expansion, other.found)
{
for (std::vector<ModInfo>::const_iterator it = other.modlist.begin();
it != other.modlist.end(); ++it)
@@ -122,6 +126,7 @@
BaseGameInfo *get_mod(const string& name, bool checkversion=true);
void add_mod (const string& mod, Configuration& modconfig);
+ void get_game_paths();
void gather_mods();
};
Modified: exult/trunk/mapedit/studio.cc
===================================================================
--- exult/trunk/mapedit/studio.cc 2008-08-12 14:34:25 UTC (rev 5969)
+++ exult/trunk/mapedit/studio.cc 2008-08-14 15:12:29 UTC (rev 5970)
@@ -952,7 +952,7 @@
if (modmenustr == "")
return;
// Ensure <MODS> dir exists
- string pathname("<" + game->get_title() + "_MODS>");
+ string pathname("<" + game->get_path_prefix() + "_MODS>");
to_uppercase(pathname);
if (!U7exists(pathname))
U7mkdir(pathname.c_str(), 0755);
@@ -992,7 +992,7 @@
modtitle = mod?mod->get_mod_title():"";
}
- studio->set_game_path(game->get_title(), modtitle);
+ studio->set_game_path(game->get_cfgname(), modtitle);
GtkWidget *win = glade_xml_get_widget(app_xml, "game_selection");
gtk_widget_hide(win);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|