Buildings produce more than set in "configure economy"

Bug #1480961 reported by Kyromaster
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

I noticed that buildings which produce wares with no prerequisites like:
-well
-reed yard
-farm
-lumberjacks hut
-quarry

produce more than is set in the "configure economy" dialog. The values set there aren't respected at all.

Tags: economy ui

Related branches

Revision history for this message
wl-zocker (wl-zocker) wrote :

Since all these buildings consume no wares, there is no reason to stop them from working. It is always good to have some more wheat on stock. If road congestion is a problem, you can either improve your road network or stop individual buildings.

The best way IMHO would be to remove the entries from the GUI. I am not sure whether there is a bug report for this.

Revision history for this message
Kyromaster (kyromaster) wrote :

I also think this would be the best idea.

GunChleoc (gunchleoc)
tags: added: ui
Changed in widelands:
status: New → Confirmed
tags: added: economy
Revision history for this message
Jens Beyer (qcumber-some) wrote :

From what I see in the code (esp. transport_ui.cc, production_program.cc) I would come to the conclusion that the idea in the code is exactly what is suggested here - if a production program declares a "needs" for a ware, it is flagged as having demand management, and any ware not having demand management should be hidden.

It does not seem to work though. Someone probably needs to debug this.

Revision history for this message
Kyromaster (kyromaster) wrote :

Can I help you with debugging this issue?

Revision history for this message
GunChleoc (gunchleoc) wrote :

The debugging needed here isn't just a matter of getting a backtrace of of testing at this stage - what we need is a C++ programmer to take this on. If you can program, you are welcome to try your hand at this bug though :)

Changed in widelands:
importance: Undecided → Medium
Revision history for this message
Kyromaster (kyromaster) wrote :

I can program C++ but never got into games programming. So I guess I can't help here :(
Anyway, could this bug be targeted for build19?
It took a while for me to understand "demand management" because of this bug.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I couldn't program C++ at all when I started contributing, so if you have the time and feel like it, you are welcome to have a look. I'd be happy to help you get started.

The gui class for this is simewhere is in src/wui, and wares have a property has_demand_check that you could test for - you won't need to understand the economy code itself.

Changed in widelands:
milestone: none → build19-rc1
Revision history for this message
kaputtnik (franku) wrote :

As i understand the code right the ui for "configure economy" is in transport_ui.cc and the code to hide some entries is always there. Here it is checked for has_demand_check() which itself returns a property depending on default_target_quantity (defined in init.lua of the ware. The function default_target_quantity(tribename) checks the init.lua and returns the amount of wares (=initial value for the entry in "configure economy"). If there is no tribename the return value is kInvalidWare. See

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/logic/map_objects/tribes/ware_descr.cc#L66

Because all wares have entries for the tribes in the table "default_target_quantity", the retu8rn value is never kInvalidWare and so all ware are displayed in "configure economy".

So it would be enough to remove the tribenames and the coresponding values in the init.lua files, so that the function default_target_quantity() returns kInvalidWare.

The result looks a bit wired, because there are some wholes in the menu for wares, but i think this is intended (in the workers tab the second carrier is also on the same place like in the wares menu) See attached screenshot.

kaputtnik (franku)
Changed in widelands:
status: Confirmed → Fix Committed
GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.