fix uninit team_num_ in events::mouse_handler

change wassert to replay::throw_error for invalid message option
This commit is contained in:
Patrick Parker 2006-10-08 00:47:10 +00:00
parent cafaea8335
commit 12af90d981
2 changed files with 8 additions and 1 deletions

View File

@ -1503,7 +1503,13 @@ bool event_handler::handle_event_command(const queued_event& event_info,
//implement the consequences of the choice
if(options.empty() == false) {
wassert(size_t(option_chosen) < menu_items.size());
if(size_t(option_chosen) >= menu_items.size()) {
std::stringstream errbuf;
errbuf << "invalid choice (" << option_chosen
<< ") was specified, choice 0 to " << (menu_items.size() - 1)
<< " was expected.\n";
replay::throw_error(errbuf.str());
}
vconfig::child_list events = option_events[option_chosen];
for(vconfig::child_list::const_iterator itor = events.begin();

View File

@ -678,6 +678,7 @@ undo_stack_(undo_stack), redo_stack_(redo_stack)
undo_ = false;
show_menu_ = false;
over_route_ = false;
team_num_ = 1;
}
void mouse_handler::set_team(const int team_number)