From cba9387c361c3d33dcf1b21ff0e5beb4b0a81ade Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 16 May 2023 22:12:57 +0100 Subject: Do some pedantic spring cleaning - Use const in more places where it makes sense - not absolutely everywhere because it can get a bit annoying - Make all the instruction search loops a bit more readable by casting the function pointer into a temporary variable to loop over - Add a few more doc comments and fix a typo or two - Make that RTTI thing flexibly-sized, finally - Don't include gamedata.h in vcall.h for no reason; consequently include gamedata.h in a bunch of places where it was implictly pulled in before - Fix dbg_toghidra() and ent_getedict() having mismatched return types between their headers and respective source files - Remove that one broken, hacky, secret Portal non-feature that probably nobody even ended up using; it can be implemented properly later if required --- src/alias.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/alias.c') diff --git a/src/alias.c b/src/alias.c index c281a37..e390cd1 100644 --- a/src/alias.c +++ b/src/alias.c @@ -71,8 +71,9 @@ DEF_CCMD_HERE_UNREG(sst_alias_remove, "Remove a command alias", 0) { } static bool find_alias_head(con_cmdcb alias_cb) { + const uchar *insns = (const uchar *)alias_cb; #ifdef _WIN32 - for (uchar *p = (uchar *)alias_cb; p - (uchar *)alias_cb < 64;) { + for (const uchar *p = insns; p - insns < 64;) { // alias command with no args calls ConMsg() then loads the head pointer // that asm looks like: call ; mov , dword ptr [x] // (we don't care about the exact registers) -- cgit v1.2.3