Only coal can be placed in the editor

Bug #998828 reported by wl-zocker on 2012-05-13
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
High
Gabriel Margiani

Bug Description

I think this bug results from the fix of bug 979937.

In the editor, only coal can be placed via the in-/decrease tool, the other resources (including fish and water) cannot be changed.

All resources can be changed by the "set" tool.

My theory is (please correct me if I am wrong):
Both coal and "nothing" have the resource-ID 0 (Gabriel Margiani already reckoned that). Before the fix of the said bug, resources with the ID 0 were replaced (which means that coal can disappear). Now, before changing the amount of a ressource, the tool checks whether the ID is the same (of the resource being on the mountain and the one from the tool). If yes, the amount is changed. If not, nothing happens. This means that coal is not overwritten any more, but "nothing" (which has the ID 0, too) is also not overwritten.

The only possibility to solve the problem definitely is to give different IDs to coal and "nothing". I guess the easiest thing would be to change the "nothing"-ID to -1 (or 6). To not break the existing maps, all fields with amount=0 would have to be replaced by ID=-1 (or 6).

Nasenbaer (nasenbaer) wrote :

As far as I can see, you are right in all points.

And I agree, that we should keep the id of coal as 0, to ensure that existing maps are kept as they are. The new number for "nothing" should be something like std::numeric_limits<uint8_t>::max() (or what ever data type the resource number is

Changed in widelands:
status: New → Confirmed
importance: Undecided → High
milestone: none → build18-rc1
Gabriel Margiani (gamag) on 2012-05-18
Changed in widelands:
assignee: nobody → Gabriel Margiani (gamag)
Gabriel Margiani (gamag) wrote :

fixed in rev6383.
I didn't change any ID, instead I fixed it like it's done in map.cc: Resources can be placed if res == selectedRes or resource amount == 0.

If you think we should set a new "nothing" ID make a new bug report or reopen this one.

Changed in widelands:
status: Confirmed → Fix Committed
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers