Merge lp:~widelands-dev/widelands/bug-1806903-worker-default-quantities into lp:widelands

Proposed by Notabilis
Status: Merged
Merged at revision: 8952
Proposed branch: lp:~widelands-dev/widelands/bug-1806903-worker-default-quantities
Merge into: lp:widelands
Diff against target: 14 lines (+2/-2)
1 file modified
src/logic/playercommand.cc (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1806903-worker-default-quantities
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+361155@code.launchpad.net

Commit message

Fixing copy&paste bug with worker quantity defaults.

Description of the change

Resetting the economy targets of workers (i.e., recruits and secondary carriers) resulted in strange amounts. The problem was a copy&paste bug when creating the relevant reset code. The code assigned the default economy amounts of the respective wares with the same description index, resulting in either small strange amounts (taken from some "random" ware) or the value 254 if no ware with the respective description index exists.
Fixed by calling the correct functions for workers instead of the ones for wares.

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

Continuous integration builds have changed state:

Travis build 4349. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/470216451.
Appveyor build 4143. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1806903_worker_default_quantities-4143.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Good catch :)

@bunnybot merge

review: Approve
Revision history for this message
bunnybot (widelandsofficial) wrote :

Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.

Travis build 4349. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/470216451.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4364. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/472186151.
Appveyor build 4157. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1806903_worker_default_quantities-4157.

Revision history for this message
Toni Förster (stonerl) 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/playercommand.cc'
2--- src/logic/playercommand.cc 2018-12-13 07:24:01 +0000
3+++ src/logic/playercommand.cc 2018-12-25 21:16:35 +0000
4@@ -1375,8 +1375,8 @@
5 void CmdResetWorkerTargetQuantity::execute(Game& game) {
6 Player* player = game.get_player(sender());
7 const TribeDescr& tribe = player->tribe();
8- if (player->has_economy(economy()) && game.tribes().ware_exists(ware_type())) {
9- const int count = tribe.get_ware_descr(ware_type())->default_target_quantity(tribe.name());
10+ if (player->has_economy(economy()) && game.tribes().worker_exists(ware_type())) {
11+ const int count = tribe.get_worker_descr(ware_type())->default_target_quantity();
12 player->get_economy(economy())->set_worker_target_quantity(ware_type(), count, duetime());
13 }
14 }

Subscribers

People subscribed via source and target branches

to status/vote changes: