Auzzy / 1846-routes-web

4 stars 2 forks source link

Don't allow calculation until the map has loaded #55

Closed Auzzy closed 5 years ago

Auzzy commented 5 years ago

If a user attempts to calculate a railroad's route before the map has loaded, it will often result in an unexpected error: "An error occurred during route calculation: Indianapolis (G9) cannot hold any more stations." (or some other city).

This is due to the railroad info being loaded at the time of calculation, but not the map info (see #54). As such, any city tile upgrades aren't included in the calculation. If that upgraded city had multiple stations, it will this be marked invalid.

The solution is simple: prevent calculation until the map has been loaded.

Auzzy commented 5 years ago

Deployed in https://github.com/Auzzy/1846-routes-web/commit/8e850ed4a99f0841b10a042a918a9906de9c980b

I went a little further with this. Making changes to the game state at all is prevented until the game state is loaded. This is done through disabling inputs, and indicated to the user by graying out the app and displaying a loading spinner.