graememcc / micropolisJS

A port of Micropolis to JS/HTML5
Other
644 stars 95 forks source link

Can't build railways #35

Closed mheerschap closed 2 years ago

mheerschap commented 2 years ago

When I attempt to place railways, I get the red outline and I can't place them, except over roads for some reason. Reproduced on the latest Chrome and Firefox.

wesleytodd commented 2 years ago

Looks like this is missing an argument if you compare it to the road handling. EDIT: or maybe it was just supposed to be a comma instead of a pipe.

AnnikaCodes commented 2 years ago

This is the precise error I get:

Uncaught Error: Tile constructor called with out-of-range value 12514
    at t.validateValue (micropolis.js?033fad982eaf9f97631d:1:11735)
    at t.validateArguments (micropolis.js?033fad982eaf9f97631d:1:11619)
    at new t (micropolis.js?033fad982eaf9f97631d:1:9439)
    at I.setTile (micropolis.js?033fad982eaf9f97631d:1:205056)
    at Object.PA.layRail (micropolis.js?033fad982eaf9f97631d:1:314496)
    at Object.PA.doTool (micropolis.js?033fad982eaf9f97631d:1:315927)
    at ys.handleTool (micropolis.js?033fad982eaf9f97631d:1:346942)
    at Object.n [as _emitEvent] (micropolis.js?033fad982eaf9f97631d:1:206870)
    at Object.yA (micropolis.js?033fad982eaf9f97631d:1:325170)
    at HTMLCanvasElement.dispatch (jquery-2.1.1.min.js:3:6404)

The "out-of-range" value 12514 is equal to 226 | 0x2000 | 0x1000 (and 226 seems to be a legitimate railroad value). I think the comma issue is spot-on; I'll look into it locally and open a PR if it gets things working.

Also, sorry for flooding your project with issues from HN folks.

graememcc commented 2 years ago

Thanks @mheerschap for the report, @wesleytodd for the debugging and @AnnikaCodes for the PR!

Don't know how I never spotted this. Thought it might have been more fallout from yesterday's ill-advised pushing of commits that have been sitting on my laptop for years, but no, this bug has been lurking since the beginning.

Went live around 7:20AM UTC.