Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map_properties: Error(Map(Layer(31, Tilemap(TooShortDdraceSwitch(19))))) #15

Open
def- opened this issue Jan 9, 2019 · 1 comment
Open

Comments

@def-
Copy link
Contributor

def- commented Jan 9, 2019

maps/blmapV5.map: Error(Map(Layer(31, Tilemap(TooShortDdraceSwitch(19)))))

http://maps.ddnet.tw/blmapV5_8fc90999_53167b61b3520be5d4cef976ab7bd2fc9b83c63157481b0985b0ed5b3eb0a6c5.map

@Fireball-Teeworlds
Copy link
Contributor

I've incorrectly posted that investigation into the wrong issue. But it is actually about this one:

This is due to m_Version of layer # 31 having a value of 322. Here's the struct in DDNet repo: https://github.com/ddnet/ddnet/blob/master/src/game/mapitems.h#L302.

We use version to decide whether the structure should contain m_aName field. DDNet does this by shifting the rest of the fields when m_Version <= 2: https://github.com/ddnet/ddnet/blob/master/src/game/layers.cpp#L69-L104.

libtw2 does something similar, but only distinguishes values of 2 and 3 (also possibly 0 and 1), failing for other values: https://github.com/heinrich5991/libtw2/blob/master/map/src/format.rs#L244-L246.

There isn't a separate error for this situation at the moment so it gets incorrectly attributed to the layer buffer being too short.

Since apparently we don't encounter this error often, most of the maps must have values up to 3. However, we could make libtw2 behavior consistent with DDNet and just treat all versions higher than 2 equally.

This would also remove the need to improve error reporting - we'd remove this error situation completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants