Skip to content

Commit cc12506

Browse files
committed
Fixed the toggle command
1 parent 94c116b commit cc12506

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/g_game.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,21 @@ static CMD(ListMaps) {
651651
//
652652

653653
static CMD(Toggle) {
654+
cvar_t *cvar;
655+
654656
if (!param[0]) {
655657
I_Printf(" toggle <cvar>\n");
656658
return;
657659
}
658660

659-
cvar_t *cvar = CON_CvarGet(param[0]);
660-
cvar->value = !cvar->value;
661+
cvar = CON_CvarGet(param[0]);
662+
663+
if (cvar == NULL) {
664+
CON_Warnf("\"%s\" doesn't exist\n", param[0]);
665+
return;
666+
}
667+
668+
M_SetCvar(cvar, (float)(!(int)cvar->value)); /* StevenSYS: These casts look really stupid */
661669
return;
662670
}
663671

src/i_audio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ static int registerSounds() {
115115
if (audio == NULL) {
116116
failCount++;
117117
} else {
118-
I_Printf("------%d\n", sfxCount);
119118
sound.sounds[sfxCount] = audio;
120119
sfxLumpIndex[i] = sfxCount;
121120
successCount++;

0 commit comments

Comments
 (0)