[✓][BUG] Terrain piece index causes crash when incorrect

Started by WillLem, Today at 02:14:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

From ericderkovits, on Discord:

Quote from: ericderkovitsi just noticed in your snow tile set there are 46 terrain pieces (0 to 45), but in the snow.ini it says tiles = 37  so when playing a snow level it crashes. In the snow.ini, it should say tiles = 46

WillLem

My instinct here is to simply remove the need to manually index terrain pieces in the .ini.

Unlike objects, which need object-specific data to be present in the .ini on a per-object basis, terrain pieces can simply be counted. As long as the pieces are named correctly (i.e. 'nameofstyle_n' where n increases from 0 with each additional piece), the required index can be built from there.

WillLem

We now count (and cache) the terrain pieces for each style, guaranteeing that the index is always up to date.

Implemented in RLPlayer commit 08996a9.