Commit Graph
5 Commits
Author SHA1 Message Date
Marco Antonio J. Costaandmajcosta b147e47856 let the text drawing path take a string it will not write to
DrawTextToScreen takes STR16, a mutable wchar_t*, for a string it only
measures and prints. Quest Debug System.cpp picks its text with a conditional:

  DrawTextToScreen( gubFact[ usLoop1 ] ? L"True" : L"False", ... );

which has type const wchar_t*. clang-cl's MSVC compatibility lets a bare
string literal decay to wchar_t*, but not a const wchar_t* expression, so it
reports

  error: no matching function for call to 'DrawTextToScreen'
  note: candidate function not viable: 1st argument ('const wchar_t *')
  would lose const qualifier

The parameter is const-correct in every function DrawTextToScreen hands the
string on to, so the change follows the string down the call chain rather
than stopping at the top:

  DrawTextToScreen, ShadowText          Utils/WordWrap.h
  WFStringPixLength                     Utils/Font Control.h
  mprintf, StringPixLength,             sgp/Font.h
  VarFindFontCenterCoordinates,
  VarFindFontRightCoordinates
  WinFontStringPixLength                sgp/WinFont.h
  gprintfdirty                          TileEngine/Render Dirty.h

The varargs members of that list copy the format string into a local buffer
before doing anything with it, and the measuring ones walk it and return a
width; none of the nine assigns through the parameter. Where StringPixLength
casts the string to UINT16* to walk it, the cast and the local now carry the
const rather than dropping it.

Callers are unaffected: every one already passes something that converts to
const CHAR16*. Both configurations build with no new diagnostics, and the
parse sweep drops from 9 error sites in 7 files to 5 in 3.

To check the claim that nothing writes through these parameters, read the
nine bodies; each is short.
2026-07-23 19:29:55 -03:00
BeatAroundTheBuscherandGitHub ed00830202 Fixes Upper/Lower Casing for include paths (#487)
* Fixing upper/lower case for includes

types.h, zconf.h and zlib.h were renamed so that global includes like Types.h
are not used.
2025-08-16 22:01:12 -03:00
Marco Antonio J. Costa d008d10b31 Replace a ton of trivial #ifdefs with runtime checks
This one is big, but unless I missed something, should be all be
trivial.

scripted-diff with the following, then manually tweaked whatever needed:
```

if [ $# -ne 3 ]; then
    echo "Usage: $0 '<pattern>' '<replacement>' '<filename>'"
    exit 1
fi

pattern="$1"
replacement="$2"
filename="$3"

if [ ! -f "$filename" ]; then
    echo "Error: File $filename does not exist."
    exit 1
fi

sed -i '/'"$pattern"'/ {
    :loop
    $ !{
        N
        /'"$pattern"'.*\n.*#endif/ {
            s/'"$pattern"'/'"$replacement"'/
            s/#else/} else {/
            s/#endif/}/
            P
            D
        }
        /'"$pattern"'/ b loop
    }
}' "$filename"

echo "Replacement complete in $filename"
```

h/t to Grok2 for the sed command
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4624fe92f0 leave CHINESE struct member UINT8 Width[0x80]
this might cause a horrifying alignment bug, but I doubt it
2024-12-31 16:28:44 -03:00
majcostaandGitHub 381ab936eb Rename 'Standard Gaming Platform' to 'sgp' (#246)
* rename 'Standard Gaming Platform' to 'sgp'

* Adapt CMakeLists.txt files to renamed SGP directory

* Lowercase it
2023-10-23 10:18:20 -03:00