added in some additional assertion checks

This commit is contained in:
Dave White 2003-11-05 21:07:55 +00:00
parent 21b16fc305
commit 4155c5eff5
2 changed files with 7 additions and 1 deletions

View file

@ -835,6 +835,8 @@ size_t move_unit(display* disp, const gamemap& map,
steps.pop_back();
}
assert(steps.size() <= route.size());
//if we can't get all the way there and have to set a go-to
if(steps.size() != route.size()) {
ui->second.set_goto(route.back());
@ -884,6 +886,8 @@ size_t move_unit(display* disp, const gamemap& map,
disp->draw();
}
assert(steps.size() <= route.size());
return steps.size();
}

View file

@ -443,12 +443,14 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
//otherwise we're trying to move to a hex
else if(!browse_ && selected_hex_.valid() && selected_hex_ != hex &&
units_.count(selected_hex_) &&
units_.count(selected_hex_) && !enemy_paths_ &&
enemy == units_.end() && !current_route_.steps.empty() &&
current_route_.steps.front() == selected_hex_) {
const size_t moves = move_unit(&gui_,map_,units_,teams_,
current_route_.steps,&recorder,&undo_stack_);
if(moves == 0)
return;
redo_stack_.clear();