diff options
author | Simon Howard | 2010-04-18 21:28:26 +0000 |
---|---|---|
committer | Simon Howard | 2010-04-18 21:28:26 +0000 |
commit | d29437d459167d40bac2d0c2c7881f3e3b8f2e8f (patch) | |
tree | b5b625c07ca831814fdb2855439c0bebd9fc2033 /src/heretic/deh_frame.c | |
parent | 72afdec76ec4ab7c84379223eb1179e18cf1367c (diff) | |
download | chocolate-doom-d29437d459167d40bac2d0c2c7881f3e3b8f2e8f.tar.gz chocolate-doom-d29437d459167d40bac2d0c2c7881f3e3b8f2e8f.tar.bz2 chocolate-doom-d29437d459167d40bac2d0c2c7881f3e3b8f2e8f.zip |
Suggest a different Heretic version when an invalid string or code
offset is encountered.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1909
Diffstat (limited to 'src/heretic/deh_frame.c')
-rw-r--r-- | src/heretic/deh_frame.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/heretic/deh_frame.c b/src/heretic/deh_frame.c index c576d490..8623ab0c 100644 --- a/src/heretic/deh_frame.c +++ b/src/heretic/deh_frame.c @@ -229,6 +229,14 @@ static boolean GetActionPointerForOffset(int offset, void **result) { int i; + // Special case. + + if (offset == 0) + { + *result = NULL; + return true; + } + for (i=0; i<arrlen(action_pointers); ++i) { if (action_pointers[i].offsets[deh_hhe_version] == offset) @@ -241,6 +249,26 @@ static boolean GetActionPointerForOffset(int offset, void **result) return false; } +// If an invalid action pointer is specified, the patch may be for a +// different version from the version we are currently set to. Try to +// suggest a different version to use. + +static void SuggestOtherVersions(unsigned int offset) +{ + unsigned int i, v; + + for (i=0; i<arrlen(action_pointers); ++i) + { + for (v=0; v<deh_hhe_num_versions; ++v) + { + if (action_pointers[i].offsets[v] == offset) + { + DEH_SuggestHereticVersion(v); + } + } + } +} + static void DEH_FrameParseLine(deh_context_t *context, char *line, void *tag) { state_t *state; @@ -274,7 +302,8 @@ static void DEH_FrameParseLine(deh_context_t *context, char *line, void *tag) if (!GetActionPointerForOffset(ivalue, &func)) { - DEH_Warning(context, "Unknown action pointer: %i", ivalue); + SuggestOtherVersions(ivalue); + DEH_Error(context, "Unknown action pointer: %i", ivalue); return; } |