From: Holger Schemel Date: Sat, 11 May 2024 08:27:43 +0000 (+0200) Subject: added UTF-8 support for cave names in BDCFF files X-Git-Tag: 4.4.0.0-test-2~30 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d190c812194b3407ba9c23d25bca90e6499089fc;p=rocksndiamonds.git added UTF-8 support for cave names in BDCFF files --- diff --git a/src/files.c b/src/files.c index c620a531..7d0194f2 100644 --- a/src/files.c +++ b/src/files.c @@ -4644,9 +4644,10 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) SetDefaultLevelColors_BD(); // level name - char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1); + char *cave_name_latin1 = getLatin1FromUTF8(cave->name); + char *cave_name_final = getStringPrint("%s / %d", cave_name_latin1, bd_level_nr + 1); - strncpy(level->name, cave_name, MAX_LEVEL_NAME_LEN); + strncpy(level->name, cave_name_final, MAX_LEVEL_NAME_LEN); level->name[MAX_LEVEL_NAME_LEN] = '\0'; // playfield elements @@ -4654,7 +4655,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) for (y = 0; y < level->fieldy; y++) level->field[x][y] = CAVE_TO_LEVEL(cave->map[y][x]); - checked_free(cave_name); + checked_free(cave_name_latin1); + checked_free(cave_name_final); } static void setTapeInfoToDefaults(void);