Pass objects by (const) ref instead of value; only set game description in the config file if one has been specified

svn-id: r25243
This commit is contained in:
Max Horn 2007-01-28 10:38:23 +00:00
parent d32b1b1b7a
commit aae330b4c1
2 changed files with 5 additions and 3 deletions

View File

@ -690,11 +690,12 @@ void LauncherDialog::addGame() {
}
void LauncherDialog::addGameToConf(FilesystemNode dir, GameDescriptor result, bool suppressEditDialog) {
void LauncherDialog::addGameToConf(const FilesystemNode &dir, const GameDescriptor &result, bool suppressEditDialog) {
// The auto detector or the user made a choice.
// Pick a domain name which does not yet exist (after all, we
// are *adding* a game to the config, not replacing).
String domain(result.gameid());
assert(!domain.empty());
if (ConfMan.hasGameDomain(domain)) {
int suffixN = 1;
char suffix[16];
@ -718,7 +719,8 @@ void LauncherDialog::addGameToConf(FilesystemNode dir, GameDescriptor result, bo
// game target, we can change this (currently, you can only query
// for the generic gameid description; it's not possible to obtain
// a description which contains extended information like language, etc.).
ConfMan.set("description", result.description(), domain);
if (!result.description().empty())
ConfMan.set("description", result.description(), domain);
ConfMan.set("gameid", result.gameid(), domain);
ConfMan.set("path", dir.path(), domain);

View File

@ -68,7 +68,7 @@ protected:
void selectGame(const String &name);
void addGameToConf(FilesystemNode dir, GameDescriptor result, bool suppressEditDialog);
void addGameToConf(const FilesystemNode &dir, const GameDescriptor &result, bool suppressEditDialog);
void addGameRecursive(FilesystemNode dir);
};