diff options
author | Stefan Beller <stefanbeller@googlemail.com> | 2010-10-26 21:16:40 +0200 |
---|---|---|
committer | Stefan Beller <stefanbeller@googlemail.com> | 2010-11-07 14:52:31 +0100 |
commit | 0eb8928d17583cf5b5892efa5bce6c2a414b582e (patch) | |
tree | bcd44ef6d679430998409701e88fdbb5f22b58b5 /npc/009-4/barriers.txt | |
parent | b22e05f982b19cc0ebca1e3ccf7d085beb5f7226 (diff) | |
download | serverdata-0eb8928d17583cf5b5892efa5bce6c2a414b582e.tar.gz serverdata-0eb8928d17583cf5b5892efa5bce6c2a414b582e.tar.bz2 serverdata-0eb8928d17583cf5b5892efa5bce6c2a414b582e.tar.xz serverdata-0eb8928d17583cf5b5892efa5bce6c2a414b582e.zip |
better bounds checking + comments in orum
Diffstat (limited to 'npc/009-4/barriers.txt')
-rw-r--r-- | npc/009-4/barriers.txt | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/npc/009-4/barriers.txt b/npc/009-4/barriers.txt index 7dcb0b34..0185a2fd 100644 --- a/npc/009-4/barriers.txt +++ b/npc/009-4/barriers.txt @@ -1,3 +1,4 @@ +//# see detailed description at orum.txt
function script GetBarrierColor {
if (@Barrier < 0 || @Barrier > 2) goto L_Error;
@@ -154,26 +155,26 @@ L_Advance_Quest: set @secondary, @BarrierColor + 1;
// Make sure it's in bounds
- if (@secondary > 12) set @secondary, 1;
- if (@secondary < 1) set @secondary, 12;
+ if (@secondary > 12) set @secondary, @secondary - 12;
+ if (@secondary < 1) set @secondary, @secondary + 12;
// Extract first 2 required colors
set @firstColor, @secondary - 2;
set @secondColor, @secondary + 2;
- if (@firstColor > 12) set @firstColor, 1;
- if (@firstColor < 1) set @firstColor, 12;
- if (@secondColor > 12) set @secondColor, 1;
- if (@secondColor < 1) set @secondColor, 12;
+ if (@firstColor > 12) set @firstColor, @firstColor - 12;
+ if (@firstColor < 1) set @firstColor, @firstColor + 12;
+ if (@secondColor > 12) set @secondColor, @secondColor - 12;
+ if (@secondColor < 1) set @secondColor, @secondColor + 12;
set @thirdColor, 12;
set @offsetOne, @BarrierColor + 1;
set @offsetTwo, @BarrierColor - 1;
// Make sure they in bounds
- if (@offsetOne > 12) set @offsetOne, 1;
- if (@offsetOne < 1) set @offsetOne, 12;
- if (@offsetTwo > 12) set @offsetTwo, 1;
- if (@offsetTwo < 1) set @offsetTwo, 12;
+ if (@offsetOne > 12) set @offsetOne, @offsetOne - 12;
+ if (@offsetOne < 1) set @offsetOne, @offsetOne + 12;
+ if (@offsetTwo > 12) set @offsetTwo, @offsetTwo - 12;
+ if (@offsetTwo < 1) set @offsetTwo, @offsetTwo + 12;
// Extract third needed color
if (@secondary == @offsetOne)
|