Fixed network game creation...

... to return back to create dialog after failed savegame loading

Fixed AI handling of unit without attacking weapons (bug #10886)
This commit is contained in:
Pauli Nieminen 2008-02-04 22:17:58 +00:00
parent 22e57cfd6a
commit 5ebdb36e6b
4 changed files with 19 additions and 8 deletions

View file

@ -22,6 +22,8 @@ Version 1.3.15+svn:
* During ai moves the source hex is no longer highlighted.
* show unit standing animations and idle animations are now separate options
* Removed broken "Host network game" option from multiplayer menu (bug #10800)
* Fixed network game creation return back to create dialog after failed
savegame loading
* miscellaneous and bug fixes:
* Fixed networking not to timeout with slow connections but timeout faster
with lost connection (partialy fix bug #10967)
@ -35,6 +37,7 @@ Version 1.3.15+svn:
* Added some toys&whisles to unit tests
* Added networking unit tests
* Hide race sections having only units with "hide_help=true"
* Fixed ai handling of unit without attacking weapons (bug #10886)
* Optimize roads placing of random map
* when a unit miss an animation, the engine will base the replacement on
the standing animation instead of the standing frame

View file

@ -1115,8 +1115,10 @@ void ai_interface::attack_enemy(const location u,
LOG_STREAM(err, ai) << "attempt to attack twice with the same unit\n";
return;
}
recorder.add_attack(u,target,weapon,def_weapon);
if(weapon >= 0)
{
recorder.add_attack(u,target,weapon,def_weapon);
}
try {
attack(info_.disp, info_.map, info_.teams, u, target, weapon, def_weapon,
info_.units, info_.state, info_.gameinfo);

View file

@ -322,6 +322,8 @@ static void enter_wait_mode(game_display& disp, const config& game_config, game_
}
}
static void enter_create_mode(game_display& disp, const config& game_config, game_data& data, mp::chat& chat, config& gamelist, mp::controller default_controller, bool is_server);
static void enter_connect_mode(game_display& disp, const config& game_config, game_data& data,
mp::chat& chat, config& gamelist, const mp::create::parameters& params,
mp::controller default_controller, bool is_server)
@ -357,6 +359,9 @@ static void enter_connect_mode(game_display& disp, const config& game_config, ga
play_game(disp, state, game_config, data, nolog, IO_SERVER);
recorder.clear();
break;
case mp::ui::CREATE:
enter_create_mode(disp, game_config, data, chat, gamelist, default_controller, is_server);
break;
case mp::ui::QUIT:
default:

View file

@ -928,7 +928,8 @@ connect::connect(game_display& disp, const config& game_config, const game_data&
{
load_game();
if(get_result() == QUIT)
if(get_result() == QUIT
|| get_result() == CREATE)
return;
lists_init();
if(sides_.empty()) {
@ -1412,7 +1413,7 @@ void connect::load_game()
const std::string game = dialogs::load_game_dialog(disp(),
game_config(), game_data_, &show_replay);
if(game.empty()) {
set_result(QUIT);
set_result(CREATE);
return;
}
@ -1425,7 +1426,7 @@ void connect::load_game()
gui::show_error_message(disp(),
_("The file you have tried to load is corrupt: '") +
error_log);
set_result(QUIT);
set_result(CREATE);
return;
}
@ -1433,7 +1434,7 @@ void connect::load_game()
/* GCC-3.3 needs a temp var otherwise compilation fails */
gui::message_dialog dlg(disp(), "", _("This is not a multiplayer save"));
dlg.show();
set_result(QUIT);
set_result(CREATE);
return;
}
@ -1447,7 +1448,7 @@ void connect::load_game()
/* GCC-3.3 needs a temp var otherwise compilation fails */
gui::message_dialog dlg2(disp(), "", _("This save is from a version too old to be loaded."));
dlg2.show();
set_result(QUIT);
set_result(CREATE);
return;
}
@ -1455,7 +1456,7 @@ void connect::load_game()
_("This save is from a different version of the game. Do you want to try to load it?"),
gui::YES_NO).show();
if(res == 1) {
set_result(QUIT);
set_result(CREATE);
return;
}
}