Skip to content

Commit 429ecec

Browse files
AJenbomewmew
authored andcommitted
Fix debug build as C (#566)
* Clean up todo * Fix debug build
1 parent 3812287 commit 429ecec

4 files changed

Lines changed: 18 additions & 23 deletions

File tree

Source/debug.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ void __cdecl TakeGoldCheat()
9595

9696
void __cdecl MaxSpellsCheat()
9797
{
98-
for (int i = 1; i < MAX_SPELLS; i++) {
98+
int i;
99+
100+
for (i = 1; i < MAX_SPELLS; i++) {
99101
if (spelldata[i].sBookLvl != -1) {
100102
plr[myplr]._pMemSpells |= (__int64)1 << (i - 1);
101103
plr[myplr]._pSplLvl[i] = 10;

Source/sound.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,15 @@ void __cdecl music_stop()
449449

450450
void __fastcall music_start(int nTrack)
451451
{
452+
BOOL success;
453+
452454
/// ASSERT: assert((DWORD) nTrack < NUM_MUSIC);
453455
music_stop();
454456
if (sglpDS && gbMusicOn) {
455457
#ifdef _DEBUG
456458
SFileEnableDirectAccess(FALSE);
457459
#endif
458-
BOOL success = SFileOpenFile(sgszMusicTracks[nTrack], &sgpMusicTrack);
460+
success = SFileOpenFile(sgszMusicTracks[nTrack], &sgpMusicTrack);
459461
#ifdef _DEBUG
460462
SFileEnableDirectAccess(TRUE);
461463
#endif

Source/spells.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,14 @@ void __fastcall UseMana(int id, int sn)
127127

128128
BOOL __fastcall CheckSpell(int id, int sn, BYTE st, BOOL manaonly)
129129
{
130+
BOOL result;
131+
130132
#ifdef _DEBUG
131133
if (debug_mode_key_inverted_v)
132134
return TRUE;
133135
#endif
134136

135-
BOOL result = TRUE;
137+
result = TRUE;
136138
if (!manaonly && pcurs != 1) {
137139
result = FALSE;
138140
} else {

docs/TODO.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
### Comments
2-
- `BUGFIX` known bugs in original (vanilla) code
3-
- `/* */` block comments are things to be fixed/checked
4-
- `FIX_ME` bad data
5-
6-
### Known Bugs
7-
Serious bugs (crash/fault)
8-
- TBA
9-
10-
Minor bugs (noticeable but can be avoided)
11-
- Server commands are broken and have been disabled `msgcmd.cpp`
12-
13-
Code issues (incorrect code that still works)
14-
- Critical sections should be constructors using `CCritSect`
15-
- Some code uses macros such as `__ROL4__`
16-
- Some functions/structures have incorrect signing (signed/unsigned BYTE)
17-
- Function `GetLevelMTypes`, decompile and check `monster.cpp`
18-
- Function `SetAutomapView`, decompile and check `automap.cpp`
19-
- Function `engine_draw_automap_pixels`, decompile and check `engine.cpp`
20-
- Double check `LOBYTE` of function `random(int, int)`
1+
### Comments
2+
- `BUGFIX` known bugs in original (vanilla) code
3+
- `/* */` block comments are things to be fixed/checked
4+
- `FIX_ME` bad data
5+
6+
Code issues (incorrect code that still works)
7+
- Critical sections should be constructors using `CCritSect`
8+
- Some code uses macros such as `__ROL2__`
9+
- Some functions/structures have incorrect signing (signed/unsigned BYTE)

0 commit comments

Comments
 (0)