Clean up the way the game_config::svnrev string is computed...

...(now game_config::revsion).  As a result, user will never see
"unknown" when the SVN revision is not available.
This commit is contained in:
Eric S. Raymond 2008-03-19 05:15:30 +00:00
parent 9cf6ee02e5
commit 4b2f5eecc7
6 changed files with 11 additions and 22 deletions

View file

@ -79,6 +79,8 @@ editor_bindings:
# For performing test lifts of mainline
lift:
./wmllint --oldversion 1.3.1 --verbose $(MAINLINE) $(UMC)
trylift:
./wmllint --oldversion 1.3.1 --dryrun --verbose $(MAINLINE) $(UMC)
diffs:
./wmllint --diffs $(MAINLINE) $(UMC)
revert:

View file

@ -464,9 +464,7 @@ bool game_controller::init_language()
if(!no_gui_) {
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::version
+ (game_config::svnrev.empty() ? "" :
" (" + game_config::svnrev + ")");
wm_title_string += " - " + game_config::revision;
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
}
@ -1605,9 +1603,7 @@ bool game_controller::change_language()
if(!no_gui_) {
std::string wm_title_string = _("The Battle for Wesnoth");
wm_title_string += " - " + game_config::version
+ (game_config::svnrev.empty() ? "" :
" (" + game_config::svnrev + ")");
wm_title_string += " - " + game_config::revision;
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
}
@ -2352,10 +2348,7 @@ int main(int argc, char** argv)
#endif
try {
const std::string rev = game_config::svnrev.empty() ? "" :
" (" + game_config::svnrev + ")";
std::cerr << "Battle for Wesnoth v" << VERSION << rev << '\n';
std::cerr << "Battle for Wesnoth v" << game_config::revision << '\n';
time_t t = time(NULL);
std::cerr << "Started on " << ctime(&t) << "\n";

View file

@ -41,9 +41,9 @@ namespace game_config
const bool gold_carryover_add = false;
const std::string version = VERSION;
#ifdef SVNREV
const std::string svnrev = SVNREV;
const std::string revision = VERSION " (" SVNREV ")";
#else
const std::string svnrev = "unknown";
const std::string revision = VERSION;
#endif
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false, exit_at_end = false, no_delay = false, disable_autosave = false;

View file

@ -34,7 +34,7 @@ namespace game_config
extern int kill_experience;
extern unsigned lobby_refresh;
extern const std::string version;
extern const std::string svnrev;
extern const std::string revision;
//! Default percentage gold carried over to the next scenario.
extern const int gold_carryover_percentage;

View file

@ -2320,10 +2320,7 @@ private:
game_events::fire(data);
gui_->redraw_everything();
} else if(cmd == "version") {
add_chat_message(time(NULL), "", 0,
game_config::version
+ (game_config::svnrev.empty() ? "" :
" (" + game_config::svnrev + ")"));
add_chat_message(time(NULL), "", 0, game_config::revision);
}
}

View file

@ -322,12 +322,9 @@ TITLE_RESULT show_title(game_display& screen, config& tips_of_day)
} while (fade_failed);
LOG_DP << "faded logo\n";
// Display Wesnoth version and (if configured with --enable-display-revision) the svn-revision
const std::string rev = game_config::svnrev.empty() ? "" :
" (" + game_config::svnrev + ")";
// Display Wesnoth version and (if possible) revision
const std::string& version_str = _("Version") +
std::string(" ") + game_config::version + rev;
std::string(" ") + game_config::revision;
const SDL_Rect version_area = font::draw_text(NULL, screen_area(),
font::SIZE_TINY, font::NORMAL_COLOUR,