Merge lp:~widelands-dev/widelands/productionsite-inactivity-bug into lp:widelands

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 9183
Proposed branch: lp:~widelands-dev/widelands/productionsite-inactivity-bug
Merge into: lp:widelands
Diff against target: 39 lines (+10/-10)
1 file modified
src/logic/map_objects/tribes/productionsite.cc (+10/-10)
To merge this branch: bzr merge lp:~widelands-dev/widelands/productionsite-inactivity-bug
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+371423@code.launchpad.net

Commit message

Fix a bug where a building remains inactive after kicking a worker

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

Continuous integration builds have changed state:

Travis build 5333. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/573087985.
Appveyor build 5105. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_productionsite_inactivity_bug-5105.

Revision history for this message
GunChleoc (gunchleoc) wrote :

LGTM :)

@bunnybot merge

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
2--- src/logic/map_objects/tribes/productionsite.cc 2019-08-13 11:12:56 +0000
3+++ src/logic/map_objects/tribes/productionsite.cc 2019-08-17 11:14:10 +0000
4@@ -776,6 +776,7 @@
5 Building::log_general_info(egbase);
6
7 molog("is_stopped: %u\n", is_stopped_);
8+ molog("main_worker: %i\n", main_worker_);
9 }
10
11 void ProductionSite::set_stopped(bool const stopped) {
12@@ -796,18 +797,17 @@
13 }
14
15 void ProductionSite::try_start_working(Game& game) {
16- if (main_worker_ >= 0) {
17- return;
18- }
19 const size_t nr_workers = descr().working_positions().size();
20 for (uint32_t i = 0; i < nr_workers; ++i) {
21- if (Worker* worker = working_positions_[i].worker) {
22- // We may start even if can_start_working() returns false, because basic actions
23- // like unloading extra wares should take place anyway
24- main_worker_ = i;
25- worker->reset_tasks(game);
26- worker->start_task_buildingwork(game);
27- return;
28+ if (main_worker_ == static_cast<int>(i) || main_worker_ < 0) {
29+ if (Worker* worker = working_positions_[i].worker) {
30+ // We may start even if can_start_working() returns false, because basic actions
31+ // like unloading extra wares should take place anyway
32+ main_worker_ = i;
33+ worker->reset_tasks(game);
34+ worker->start_task_buildingwork(game);
35+ return;
36+ }
37 }
38 }
39 }

Subscribers

People subscribed via source and target branches

to status/vote changes: