Setting resources via LUA API broken in Editor

Bug #1281823 reported by TiborB
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
TiborB

Bug Description

When setting resources on new map with field.resource='x' and field.resource_amount=y the result is not consistent.

The resource is set, when playing a geologist can identify it properly (I have resource like coal in mind now), but a newly built mine reports "no resources left".

When looking on the field with DBG, resource type is properly set, but resource amount is shown like 10/0. I noticed when looking at other maps, that second number is usually non-zero.

Similar problem I noticed with fishes.

To reproduce the error, you need debug compilation of widelands. I enclosed a lua script test_resources.lua, it should be placed in share/widelands/scripting directory (on linux). Now start widelands, go to editor, create new (empty) map and hit F6 and type&run
use("aux","test_resources")
and now place one headquarters (required to be able to play the game), save, start new single player game and test it. Build a mine f.e. on created fields and see that it doesnt work.

Regards

Tags: lua

Related branches

Revision history for this message
TiborB (tiborb95) wrote :
Revision history for this message
SirVer (sirver) wrote :

Quick grabbing through the source code shows that Field.*_starting_res_amount() is never called in src/scripting/ . The implications of using this during the game are not clear to me and must be tested carefully, but in the editor, a call to set_resources() should definitively also change the starting resources.

Changed in widelands:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → build19-rc1
summary: - Setting resources via LUA API broken
+ Setting resources via LUA API broken in Editor
tags: added: lua
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
TiborB (tiborb95)
Changed in widelands:
assignee: nobody → TiborB (tiborb95)
Revision history for this message
SirVer (sirver) wrote :

Fixed in r 7301

Changed in widelands:
status: Incomplete → 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.