Merge lp:~widelands-dev/widelands/bug-1428315 into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 7516
Proposed branch: lp:~widelands-dev/widelands/bug-1428315
Merge into: lp:widelands
Diff against target: 59 lines (+16/-2)
2 files modified
src/logic/ship.cc (+2/-1)
src/logic/trainingsite.cc (+14/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1428315
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+269673@code.launchpad.net

Description of the change

For unknown reasons, a trainingsite sometimes does not drop fully upgraded soldiers and all upgrading can be therefore stuck, f.e. if there is only one slot for soldiers.
Might be a problem of save/load.
Attached savegames does not show an instant when problem happened, so I cannot properly debug it.

Now checking for fully upgraded soldiers are done everytime training cycle ends. Overhead is negligible...

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

little hackish, but works.

review: Approve
Revision history for this message
TiborB (tiborb95) wrote :

that it is :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/ship.cc'
2--- src/logic/ship.cc 2015-07-29 20:06:11 +0000
3+++ src/logic/ship.cc 2015-08-31 19:59:25 +0000
4@@ -719,7 +719,8 @@
5 * @note This is supposed to be called only from the scheduling code of @ref Fleet.
6 */
7 void Ship::set_destination(Game& game, PortDock& pd) {
8- molog("set_destination / sending to portdock %u (carrying %" PRIuS " items)\n", pd.serial(), m_items.size());
9+ molog("set_destination / sending to portdock %u (carrying %" PRIuS " items)\n",
10+ pd.serial(), m_items.size());
11 m_destination = &pd;
12 send_signal(game, "wakeup");
13 }
14
15=== modified file 'src/logic/trainingsite.cc'
16--- src/logic/trainingsite.cc 2015-05-20 19:17:56 +0000
17+++ src/logic/trainingsite.cc 2015-08-31 19:59:25 +0000
18@@ -553,19 +553,31 @@
19 {
20 m_result = result;
21 ProductionSite::program_end(game, result);
22+ // For unknown reasons sometimes there is a fully upgraded soldier
23+ // that failed to be send away, so at the end of this function
24+ // we test for such soldiers, unless another drop_soldiers
25+ // function were run
26+ bool leftover_soldiers_check = true;
27
28 if (m_current_upgrade) {
29 if (m_result == Completed) {
30 drop_unupgradable_soldiers(game);
31+ leftover_soldiers_check = false;
32 m_current_upgrade->lastsuccess = true;
33 m_current_upgrade->failures = 0;
34 }
35 else {
36 m_current_upgrade->failures++;
37 drop_stalled_soldiers(game);
38+ leftover_soldiers_check = false;
39 }
40 m_current_upgrade = nullptr;
41 }
42+
43+ if (leftover_soldiers_check) {
44+ drop_unupgradable_soldiers(game);
45+ }
46+
47 training_done();
48 }
49
50@@ -595,8 +607,9 @@
51 maxcredit = upgrade.credit;
52 }
53
54- if (maxprio == 0)
55+ if (maxprio == 0) {
56 return program_start(game, "sleep");
57+ }
58
59 uint32_t const multiplier = 1 + (10 - maxcredit) / maxprio;
60

Subscribers

People subscribed via source and target branches

to status/vote changes: