Fixed Scavenging overview: can't unlock options

DeletedUser

Guest
In the scavenging overview, it's not possible to unlock options for any village except the currently active one.

Preconditions:
* Have multiple villages
* Have at least one village with a locked scavenging option

Steps to reproduce:
1) Switch to a village that's not the one with the locked scavenging option.
2) Go to the scavenging overview
3) Click on the dot for the locked scavenging option
4) Observe that the fader overlay appears, but the popup fails to open. The browser debugger reports an error involving ResourcesForecast.
 

DeletedUser

Guest
Now it seems to be the opposite (Crashes when I click the dot for the currently active village).

Reproducible on en109 with my village#23479

edit: it just started working. I had a resource delivery arrive. Previously, the current village didn't have enough res to unlock the option. Will see if I can narrow down the cause.

edit #2: Tried clicking the dot for option#4. Didn't have enough res and warehouse was too small. Popup opened with no problem.
Then I upgraded the warehouse to be big enough. Didn't have enough resources at this point, and tried clicking the dot for option#4. It crashed.

edit #3: Switched to a different village and sent all the wood away (so the current village didn't have enough res). Tried clicking the dot for option#4 of the original village. It crashed.
 
Last edited by a moderator:

DeletedUser

Guest
Two problems.

1) VillagePlace/ScavengeScreen/DialogLauncher constructor expects resource schedules passed in. ScavengingOverview.handleClick constructs it with null refs instead. This should be easy to fix (see comments at the page linked below).

2) Scavenging/Widgets/UnlockOptionDialog/UnlockOptionStateReducer newStateFromModels calls ResourcesForecaster.getForecast using game_data.village, which is incorrect. (referencing the currently active village instead of the village the popup is supposed to be for). Using globals here kind of ruins the whole deterministic aspect of a state reducer too.

https://github.com/cheesasaurus/che...iles/bd42e6480247a185661bed06402181a3f53106b9
 
Top