Merge lp:~widelands-dev/widelands/bug-1629691-make-empty-ai-empty into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8753
Proposed branch: lp:~widelands-dev/widelands/bug-1629691-make-empty-ai-empty
Merge into: lp:widelands
Diff against target: 17 lines (+7/-0)
1 file modified
src/logic/game.cc (+7/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1629691-make-empty-ai-empty
Reviewer Review Type Date Requested Status
Notabilis diff, test Approve
Review via email: mp+349389@code.launchpad.net

Commit message

Set AI from selection in UI when saveloading

Description of the change

The bug is that when loading a savegame, the AI selected in the interface by the user was completely ignored. This overwrites the AI setting from the savegame when starting a savegame.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3662. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/402968399.
Appveyor build 3461. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1629691_make_empty_ai_empty-3461.

Revision history for this message
Notabilis (notabilis27) wrote :

Change is looking good and seems to be working as expected.
Am I right that this is only relevant for loading multiplayer games, since in single player you are unable to change positions?

Independent of your change, I am a bit puzzled about this part:

} catch (...) {
  throw;
}

Isn't it completely useless and couldn't the whole try{} block be removed? Or am I missing something?

review: Approve (diff, test)
Revision history for this message
GunChleoc (gunchleoc) wrote :

It does look like it's completely useless, because it's sitting at the bottom end of the function. I am on the road again though and can't test if it makes a difference, so I'll leave it in for now.

Thanks for the review :)

Revision history for this message
GunChleoc (gunchleoc) wrote :

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/game.cc'
2--- src/logic/game.cc 2018-05-27 06:02:18 +0000
3+++ src/logic/game.cc 2018-07-17 13:37:22 +0000
4@@ -337,6 +337,13 @@
5 loader_ui->set_background(background);
6 loader_ui->step(_("Loading…"));
7 gl.load_game(settings.multiplayer);
8+ // Players might have selected a different AI type
9+ for (uint8_t i = 0; i < settings.players.size(); ++i) {
10+ const PlayerSettings& playersettings = settings.players[i];
11+ if (playersettings.state == PlayerSettings::State::kComputer) {
12+ get_player(i + 1)->set_ai(playersettings.ai);
13+ }
14+ }
15 } catch (...) {
16 throw;
17 }

Subscribers

People subscribed via source and target branches

to status/vote changes: