diff --git a/changelog b/changelog index 128c7ea3ef1..02537c207e3 100644 --- a/changelog +++ b/changelog @@ -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 diff --git a/src/ai.cpp b/src/ai.cpp index 7ba31313d33..ae967934ca1 100644 --- a/src/ai.cpp +++ b/src/ai.cpp @@ -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); diff --git a/src/multiplayer.cpp b/src/multiplayer.cpp index a66dd64e61a..c1fb0daffbb 100644 --- a/src/multiplayer.cpp +++ b/src/multiplayer.cpp @@ -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: diff --git a/src/multiplayer_connect.cpp b/src/multiplayer_connect.cpp index 0c4dcf24630..2229660e364 100644 --- a/src/multiplayer_connect.cpp +++ b/src/multiplayer_connect.cpp @@ -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; } }