Operating System
Windows 10 x64
OpenRCT2 build
OpenRCT2, v0.4.11 (18d2b5e) provided by GitHub
Base game
RollerCoaster Tycoon 2, RollerCoaster Tycoon Classic
Area(s) with this issue?
This is a development issue
Describe the issue
Scenery objects with a negative removalPrice seem to return a wrong value when accessed through the plugin API, specifically they return positive values some power of two larger than the true value, almost like there is a signedness bug somewhere. For most objects this is 256, for other things like the most expensive thing I could find in a hurry (Mythological theming golden fleece) the error is 4096.
There's every chance that this is somehow user error as well, I'm very new to JS/TS.
Steps to reproduce
The code in question:
export function removalPriceBug(): void
{
for (let y = 0; y < map.size.y; y++) {
for (let x = 0; x < map.size.x; x++) {
let tile = map.getTile(x, y);
for (let i = 0; i < tile.numElements; i++) {
let element = tile.getElement(i);
if (element.type === 'small_scenery') {
let scenery = objectManager.getObject("small_scenery", element.object);
if (scenery.removalPrice != 0)
{
park.postMessage("item " + scenery.identifier + " has removal price: " + scenery.removalPrice);
}
}
}
}
}
}
This works fine for things with a positive removal cost.
Attachments
No response
Operating System
Windows 10 x64
OpenRCT2 build
OpenRCT2, v0.4.11 (18d2b5e) provided by GitHub
Base game
RollerCoaster Tycoon 2, RollerCoaster Tycoon Classic
Area(s) with this issue?
This is a development issue
Describe the issue
Scenery objects with a negative removalPrice seem to return a wrong value when accessed through the plugin API, specifically they return positive values some power of two larger than the true value, almost like there is a signedness bug somewhere. For most objects this is 256, for other things like the most expensive thing I could find in a hurry (Mythological theming golden fleece) the error is 4096.
There's every chance that this is somehow user error as well, I'm very new to JS/TS.
Steps to reproduce
The code in question:
This works fine for things with a positive removal cost.
Attachments
No response