summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-10 20:45:18 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-10 20:45:18 +0000
commit2552c703729fb2b01123da59fa22f40b82e9282a (patch)
tree33998c21bfe85215db8b9a5cdc36b5650140c57e
parentd15534494a74146f690237596ecf7982d3690fe3 (diff)
downloadhercules-2552c703729fb2b01123da59fa22f40b82e9282a.tar.gz
hercules-2552c703729fb2b01123da59fa22f40b82e9282a.tar.bz2
hercules-2552c703729fb2b01123da59fa22f40b82e9282a.tar.xz
hercules-2552c703729fb2b01123da59fa22f40b82e9282a.zip
* Fixed script command 'cleararray' setting 1 element more, than it is told to (bugreport:2047, since r12253).
- Fixed 'inaccessible element 127' issue in 'cleararray', 'setarray' (since r10813) and 'copyarray' (since r14608) script commands (bugreport:864, related r12253, follow up to r14608). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14663 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/script.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index c225906c2..b9938d03b 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,8 @@
Date Added
2011/01/10
+ * Fixed script command 'cleararray' setting 1 element more, than it is told to (bugreport:2047, since r12253). [Ai4rei]
+ - Fixed 'inaccessible element 127' issue in 'cleararray', 'setarray' (since r10813) and 'copyarray' (since r14608) script commands (bugreport:864, related r12253, follow up to r14608).
* Fixed monster level not getting updated in monster name (option 'show_mob_info'), when a monster levels up (option 'mobs_level_up') (follow up to r8644, related r187). [Ai4rei]
* Made script command 'charisalpha' always return 1 when 'isaplha' is true, rather than to return the return value of 'isalpha' which is only defined as zero/non-zero and can be different from 1 (bugreport:2024, related r2003). [Ai4rei]
2011/01/09
diff --git a/src/map/script.c b/src/map/script.c
index 5dd129091..520fbfdd4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4908,8 +4908,8 @@ BUILDIN_FUNC(setarray)
}
end = start + script_lastdata(st) - 2;
- if( end >= SCRIPT_MAX_ARRAYSIZE )
- end = SCRIPT_MAX_ARRAYSIZE-1;
+ if( end > SCRIPT_MAX_ARRAYSIZE )
+ end = SCRIPT_MAX_ARRAYSIZE;
if( is_string_variable(name) )
{// string array
@@ -4971,10 +4971,10 @@ BUILDIN_FUNC(cleararray)
v = (void*)script_getnum(st, 3);
end = start + script_getnum(st, 4);
- if( end >= SCRIPT_MAX_ARRAYSIZE )
- end = SCRIPT_MAX_ARRAYSIZE-1;
+ if( end > SCRIPT_MAX_ARRAYSIZE )
+ end = SCRIPT_MAX_ARRAYSIZE;
- for( ; start <= end; ++start )
+ for( ; start < end; ++start )
set_reg(st, sd, reference_uid(id, start), name, v, script_getref(st,2));
return 0;
}
@@ -5041,8 +5041,8 @@ BUILDIN_FUNC(copyarray)
}
count = script_getnum(st, 4);
- if( count >= SCRIPT_MAX_ARRAYSIZE - idx1 )
- count = (SCRIPT_MAX_ARRAYSIZE-1) - idx1;
+ if( count > SCRIPT_MAX_ARRAYSIZE - idx1 )
+ count = SCRIPT_MAX_ARRAYSIZE - idx1;
if( count <= 0 || (id1 == id2 && idx1 == idx2) )
return 0;// nothing to copy