made it so observers do not get a victory/defeat message at the end of the game
This commit is contained in:
parent
869ad71985
commit
60bf3675aa
5 changed files with 22 additions and 3 deletions
|
@ -368,6 +368,8 @@ defeat_heading="Defeat"
|
|||
defeat_message="You have been defeated!"
|
||||
victory_heading="Victory"
|
||||
victory_message="You have emerged victorious!"
|
||||
observer_endgame_heading="Game Over"
|
||||
observer_endgame="The game is over."
|
||||
remaining_gold="Remaining gold"
|
||||
early_finish_bonus="Early finish bonus"
|
||||
per_turn="per turn"
|
||||
|
|
|
@ -87,6 +87,7 @@ multiplayer_game_setup_dialog::multiplayer_game_setup_dialog(
|
|||
|
||||
//create the scenarios menu
|
||||
maps_menu_.assign(new gui::menu(disp_,options));
|
||||
maps_menu_->set_numeric_keypress_selection(false);
|
||||
|
||||
SDL_Rect rect = {0,0,0,0};
|
||||
|
||||
|
@ -303,7 +304,7 @@ lobby::RESULT multiplayer_game_setup_dialog::process()
|
|||
if(cancel_game_->process(mousex,mousey,left_button) || key[SDLK_ESCAPE])
|
||||
return lobby::QUIT;
|
||||
|
||||
if(launch_game_->process(mousex,mousey,left_button)) {
|
||||
if(launch_game_->process(mousex,mousey,left_button) || maps_menu_->double_clicked()) {
|
||||
if(name_entry_->text() != "") {
|
||||
return lobby::CREATE;
|
||||
} else {
|
||||
|
|
|
@ -568,6 +568,11 @@ redo_turn:
|
|||
|
||||
} catch(end_level_exception& end_level) {
|
||||
|
||||
if((end_level.result == DEFEAT || end_level.result == VICTORY) && is_observer(teams)) {
|
||||
gui::show_dialog(gui,NULL,string_table["observer_endgame_heading"],
|
||||
string_table["observer_endgame"], gui::OK_ONLY);
|
||||
}
|
||||
|
||||
if(end_level.result == QUIT || end_level.result == REPLAY) {
|
||||
return end_level.result;
|
||||
} else if(end_level.result == DEFEAT) {
|
||||
|
|
|
@ -25,7 +25,7 @@ menu::menu(display& disp, const std::vector<std::string>& items,
|
|||
uparrow_(disp,"",gui::button::TYPE_PRESS,"uparrow-button"),
|
||||
downarrow_(disp,"",gui::button::TYPE_PRESS,"downarrow-button"),
|
||||
scrollbar_(disp), scrollbar_height_(0),
|
||||
double_clicked_(false)
|
||||
double_clicked_(false), num_selects_(true)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator item = items.begin();
|
||||
item != items.end(); ++item) {
|
||||
|
@ -253,7 +253,7 @@ void menu::key_press(SDLKey key)
|
|||
break;
|
||||
}
|
||||
|
||||
if(key >= SDLK_1 && key <= SDLK_9) {
|
||||
if(key >= SDLK_1 && key <= SDLK_9 && num_selects_) {
|
||||
const int pos = key - SDLK_1;
|
||||
if(size_t(pos) < items_.size()) {
|
||||
selected_ = pos;
|
||||
|
@ -414,6 +414,11 @@ bool menu::double_clicked() const
|
|||
return double_clicked_;
|
||||
}
|
||||
|
||||
void menu::set_numeric_keypress_selection(bool value)
|
||||
{
|
||||
num_selects_ = value;
|
||||
}
|
||||
|
||||
namespace {
|
||||
const char ImagePrefix = '&';
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
|
||||
bool double_clicked() const;
|
||||
|
||||
void set_numeric_keypress_selection(bool value);
|
||||
|
||||
private:
|
||||
size_t max_items_onscreen() const;
|
||||
|
||||
|
@ -100,6 +102,10 @@ private:
|
|||
gui::scrollbar scrollbar_;
|
||||
int scrollbar_width_;
|
||||
int scrollbar_height_;
|
||||
|
||||
///variable which determines whether a numeric keypress should
|
||||
///select an item on the dialog
|
||||
bool num_selects_;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue