Opened 4 years ago

Last modified 4 years ago

#10897 new defect

ZVISION: Assertion fails on locales with decimal comma

Reported by: angstsmurf Owned by:
Priority: normal Component: Engine: ZVision
Version: Keywords:
Cc: Game: Zork Grand Inquisitor


See and

When compiled on recent macOS and Xcode 10, Zvision games will fail with "Assertion failed: (scale > 0.0f), function setPanoramaScale, file engines/zvision/graphics/render_table.cpp, line 219" when trying to display the panorama screen. This is not the case when compiling on earlier systems, perhaps because libc++ is used instead of libstdc++.

This is likely to cause issues in other engines that use atof, sscanf("%f") and similar.

Change History (4)

comment:1 by angstsmurf, 4 years ago

I forgot to mention in the ticket description that this only happens when the system is set to Swedish, German or other languages that use decimal comma.

comment:2 by eriktorbjorn, 4 years ago

I thought ScummVM was supposed to set the locale to something language neutral. The SDL backend has this in OSystem_SDL::getSystemLanguage():

// Restore default C locale to prevent issues with
// portability of sscanf(), atof(), etc.
// See bug #3615148
setlocale(LC_ALL, "C");

Though maybe that's not used in the Mac version? I don't know...

comment:3 by criezy, 4 years ago

Thank you for creating this bug report. I saw the post on the forum but I can’t currently look at this as I am travelling for my work. Hopefully this will act as a reminder for me to look at this when I get back home (if nobody else finds the root of the issue in the meantime).

This seems indeed related to bug #6434 (3615148 in the old tracker) and the fix applied then was working. I have no idea why it breaks again on Mojave/ xcode 10 so this will need to be investigated. The switch to libc++ is indeed a possible reason for the change in behaviour.

comment:4 by angstsmurf, 4 years ago

I should also mention that I haven't seen anyone else reproduce this yet, so it might very well be something that is broken just on my system.

Note: See TracTickets for help on using tickets.