From 7ecd9238246e91a7a63caf2a1161275ceb115423 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Thu, 14 Aug 2025 03:56:18 -0400 Subject: [PATCH] Fixes for m_npc, m_notice --- src/game/m_notice.c | 2 +- src/game/m_npc.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/game/m_notice.c b/src/game/m_notice.c index d3dd50a5..86c63134 100644 --- a/src/game/m_notice.c +++ b/src/game/m_notice.c @@ -52,7 +52,7 @@ typedef struct notice_date_data_s { /* 0x02 */ u16 date; } mNtc_date_data_c; -static mNtc_date_data_c mNtc_auto_nwrite_data[48]; +static mNtc_date_data_c mNtc_auto_nwrite_data[mNtc_DATA_LIST_NUM]; static void mNtc_copy_data_list() { static mNtc_date_data_c auto_nwrite_date_data[mNtc_DATA_LIST_NUM] = { diff --git a/src/game/m_npc.c b/src/game/m_npc.c index 71d9c666..bc00e398 100644 --- a/src/game/m_npc.c +++ b/src/game/m_npc.c @@ -2323,23 +2323,18 @@ extern void mNpc_SetDefAnimal(Animal_c* animal, mActor_name_t npc_id, mNpc_Defau } static void mNpc_SetHaveAppeared(mActor_name_t npc_id) { - u8 v; - int idx; - int bit; u8* used_tbl = Save_Get(npc_used_tbl); + int idx; int i; if (ITEM_NAME_GET_TYPE(npc_id) == NAME_TYPE_NPC) { idx = npc_id & 0xFFF; i = idx / 8; - + if (i < ARRAY_COUNT(Save_Get(npc_used_tbl))) { - /* what in the fuck */ - v = used_tbl[i]; - bit = idx & 7; - bit = 1 << bit; - v |= bit; - used_tbl[i] = v; + used_tbl += i; + idx = idx & 7u; + *used_tbl |= 1 << idx; } } } @@ -2350,7 +2345,8 @@ static int mNpc_GetHaveAppeared_idx(int idx) { int res = TRUE; if (i < ARRAY_COUNT(Save_Get(npc_used_tbl))) { - res = (used_tbl[i] >> (idx & 7)) & 1; + used_tbl += i; + res = (*used_tbl >> (idx & 7u)) & 1; } return res;