summaryrefslogtreecommitdiff
path: root/src/deh_cheat.c
diff options
context:
space:
mode:
authorSimon Howard2008-07-29 00:50:56 +0000
committerSimon Howard2008-07-29 00:50:56 +0000
commit4d0b888e577db400a2c8e87157ffa17257074856 (patch)
tree157ea46c3bb5edd6f94e9475156c0dd71a78f041 /src/deh_cheat.c
parent530888d2e243f27bd36aa71a68570195276c4173 (diff)
downloadchocolate-doom-4d0b888e577db400a2c8e87157ffa17257074856.tar.gz
chocolate-doom-4d0b888e577db400a2c8e87157ffa17257074856.tar.bz2
chocolate-doom-4d0b888e577db400a2c8e87157ffa17257074856.zip
Add magic dehacked comment to enable long cheat sequences (also for Chex
Quest support) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1160
Diffstat (limited to 'src/deh_cheat.c')
-rw-r--r--src/deh_cheat.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/deh_cheat.c b/src/deh_cheat.c
index 28f32572..f501adbf 100644
--- a/src/deh_cheat.c
+++ b/src/deh_cheat.c
@@ -108,10 +108,28 @@ static void DEH_CheatParseLine(deh_context_t *context, char *line, void *tag)
i = 0;
- while (i<cheat->seq->sequence_len && unsvalue[i] != 0 && unsvalue[i] != 0xff)
+ while (unsvalue[i] != 0 && unsvalue[i] != 0xff)
{
+ // If the cheat length exceeds the Vanilla limit, stop. This
+ // does not apply if we have the limit turned off.
+
+ if (!deh_allow_long_cheats && i >= cheat->seq->sequence_len)
+ {
+ DEH_Warning(context, "Cheat sequence longer than supported by "
+ "Vanilla dehacked");
+ break;
+ }
+
cheat->seq->sequence[i] = unsvalue[i];
++i;
+
+ // Absolute limit - don't exceed
+
+ if (i >= MAX_CHEAT_LEN - cheat->seq->parameter_chars)
+ {
+ DEH_Error(context, "Cheat sequence too long!");
+ return;
+ }
}
cheat->seq->sequence[i] = '\0';