From 80f42460955407d1492a03dfbffa18266ae0c471 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 9 Aug 2025 09:48:40 +0900 Subject: [PATCH 1/2] DrawDungeon.LoadWalkData should return true when data is not found Returning false causes system.Error() in Rance 6. --- src/dungeon/dungeon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dungeon/dungeon.c b/src/dungeon/dungeon.c index 5a10c5e..e692cc3 100644 --- a/src/dungeon/dungeon.c +++ b/src/dungeon/dungeon.c @@ -411,7 +411,7 @@ enum { static int dd1_find_walk_data(struct page *array, int map_no, struct dgn *dgn) { if (!array) - return WALK_DATA_BROKEN; + return WALK_DATA_NOT_FOUND; if (array->type != ARRAY_PAGE || array->a_type != AIN_ARRAY_INT || array->array.rank != 1) VM_ERROR("Not a flat integer array"); @@ -446,7 +446,7 @@ static bool dd1_load_walk_data(struct dungeon_context *ctx, int map, struct page int offset = dd1_find_walk_data(array, map, ctx->dgn); if (offset < 0) - return false; + return offset != WALK_DATA_BROKEN; offset += 4; int nr_cells = dgn_nr_cells(ctx->dgn); From f0a54b337d9ec9a5049b9fea37f96fb01f842e22 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 9 Aug 2025 13:08:08 +0900 Subject: [PATCH 2/2] DrawDungeon14: Fix LoadWalkData and SaveWalkData They were broken by commit 5ed05ba. --- src/dungeon/dungeon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dungeon/dungeon.c b/src/dungeon/dungeon.c index e692cc3..aada10f 100644 --- a/src/dungeon/dungeon.c +++ b/src/dungeon/dungeon.c @@ -494,12 +494,12 @@ bool dungeon_load_walk_data(int surface, int map, struct page **page) return false; switch (ctx->version) { case DRAW_DUNGEON_1: + case DRAW_DUNGEON_14: return dd1_load_walk_data(ctx, map, page); case DRAW_DUNGEON_2: return dd2_load_walk_data(ctx, page); - default: - return false; } + return false; } static bool dd1_save_walk_data(struct dungeon_context *ctx, int map, struct page **page) @@ -559,12 +559,12 @@ bool dungeon_save_walk_data(int surface, int map, struct page **page) return false; switch (ctx->version) { case DRAW_DUNGEON_1: + case DRAW_DUNGEON_14: return dd1_save_walk_data(ctx, map, page); case DRAW_DUNGEON_2: return dd2_save_walk_data(ctx, page); - default: - return false; } + return false; } void dungeon_paint_step(int surface, int x, int y, int z)