← Back to team overview

widelands-dev team mailing list archive

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


Notabilis has proposed merging lp:~widelands-dev/widelands/bug-1806903-worker-default-quantities into lp:widelands.

Commit message:
Fixing copy&paste bug with worker quantity defaults.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1806903 in widelands: "Default target number for soldiers/carriers too high/too low."

For more details, see:

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.
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1806903-worker-default-quantities into lp:widelands.
=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc	2018-12-13 07:24:01 +0000
+++ src/logic/playercommand.cc	2018-12-19 20:06:41 +0000
@@ -1375,8 +1375,8 @@
 void CmdResetWorkerTargetQuantity::execute(Game& game) {
 	Player* player = game.get_player(sender());
 	const TribeDescr& tribe = player->tribe();
-	if (player->has_economy(economy()) && game.tribes().ware_exists(ware_type())) {
-		const int count = tribe.get_ware_descr(ware_type())->default_target_quantity(tribe.name());
+	if (player->has_economy(economy()) && game.tribes().worker_exists(ware_type())) {
+		const int count = tribe.get_worker_descr(ware_type())->default_target_quantity();
 		player->get_economy(economy())->set_worker_target_quantity(ware_type(), count, duetime());

Follow ups