From 073a15b41b2f959341392f988287097fdf14cb78 Mon Sep 17 00:00:00 2001 From: Gabriel Ravier Date: Tue, 5 Nov 2019 17:06:06 +0100 Subject: [PATCH] Documentation : Comment implicit truncation --- src/NpcAct080.cpp | 2 ++ src/NpcAct260.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/NpcAct080.cpp b/src/NpcAct080.cpp index 8a3d0008..0b1f57b2 100644 --- a/src/NpcAct080.cpp +++ b/src/NpcAct080.cpp @@ -1081,6 +1081,8 @@ void ActNpc088(NPCHAR *npc) case 10: if (++npc->act_wait > 100 && npc->act_wait % 6 == 1) { + // The range of unsigned char is [0, 255] so these two values are implicitly truncated (Might be UB ?) + // TODO : Investigate on whether this is erroneous if (npc->direct == 0) deg = 0x88; else diff --git a/src/NpcAct260.cpp b/src/NpcAct260.cpp index 2460aa4f..db398856 100644 --- a/src/NpcAct260.cpp +++ b/src/NpcAct260.cpp @@ -1291,6 +1291,8 @@ void ActNpc268(NPCHAR *npc) case 51: if (++npc->act_wait > 30 && npc->act_wait % 4 == 1) { + // The range of unsigned char is [0, 255] so these two values are implicitly truncated (Might be UB ?) + // TODO : Investigate on whether this is erroneous if (npc->direct == 0) deg = 0x88; else