summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-21 08:09:20 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-21 08:09:20 +0000
commite3f656e1115d731c6b3fb0a6f5a645e93e588bc3 (patch)
treec185649e8ea974e5eb4525560633d0167f9e671c
parentca715304f24e1177ab2fd17a761d5f9581ac08e5 (diff)
downloadhercules-e3f656e1115d731c6b3fb0a6f5a645e93e588bc3.tar.gz
hercules-e3f656e1115d731c6b3fb0a6f5a645e93e588bc3.tar.bz2
hercules-e3f656e1115d731c6b3fb0a6f5a645e93e588bc3.tar.xz
hercules-e3f656e1115d731c6b3fb0a6f5a645e93e588bc3.zip
* Speed up array size calculation and deletion.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6676 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--Dev/bugs.txt13
-rw-r--r--src/map/script.c27
3 files changed, 19 insertions, 22 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ad93c091b..498cd3163 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/19
+ * Speed up array size calculation and deletion. [Lance]
* Player must learn the skill before doing auto-spell [Lance]
* Exploit prevention in clif_parse_NpcStringInput [Lance]
* grfio_final moved back if any of GRF overriding is enabled so servers
diff --git a/Dev/bugs.txt b/Dev/bugs.txt
index 435d0d4cd..d03062c12 100644
--- a/Dev/bugs.txt
+++ b/Dev/bugs.txt
@@ -4,19 +4,6 @@
"reminder" of big bugs that have not been fixed yet. An good example would
be "the matrix bug" from the good old days.
-BUG: grf loading is broken.
-DESC: Specifying multiple grfs is badly broken, as the 'checksum' applied to
- files usually returns the wrong index, thus looking the file up on the wrong
- grf file. Users have also reported that reading from the data/ dir is messed
- up. See link for all details.
-LINKS:
- - http://www.eathena.ws/board/index.php?showtopic=78372
-
-BUG: @reloadscript causes a crash
-DESC: Do a @reloadscript, and it will inmediately crash on the
- skill_unit_timer function. Apparently the global objects array gets messed up
- when cleaning the npcs. Valgrind doesn't seems to point at any particular
- cause. I suspect it may have to do with NPC shops.
BUG: mob won't stop moving while casting spell
DESC: When mob start casting spell, he still moves some cells (2-3). Also if
diff --git a/src/map/script.c b/src/map/script.c
index 318ac4345..4e184f322 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3424,12 +3424,17 @@ int buildin_copyarray(struct script_state *st)
*/
static int getarraysize(struct script_state *st,int num,int postfix)
{
- int i=(num>>24),c=-1; // Moded to -1 because even if the first element is 0, it will still report as 1 [Lance]
- for(;i<128;i++){
- // num must be the first elements of array [Eoe / jA 1127]
- void *v=get_val2(st,(num & 0x00FFFFFF)+(i<<24));
- if(postfix=='$' && *((char*)v) ) c=i;
- if(postfix!='$' && (int)v )c=i;
+ int i=(num>>24),c=(i==0? -1:i); // Moded to -1 because even if the first element is 0, it will still report as 1 [Lance]
+ if(postfix == '$'){
+ for(;i<128;i++){
+ void *v=get_val2(st,(num & 0x00FFFFFF)+(i<<24));
+ if(*((char*)v)) c=i;
+ }
+ }else{
+ for(;i<128;i++){
+ void *v=get_val2(st,(num & 0x00FFFFFF)+(i<<24));
+ if((int)v) c=i;
+ }
}
return c+1;
}
@@ -3476,9 +3481,13 @@ int buildin_deletearray(struct script_state *st)
for(i=0;i<sz;i++){
set_reg(sd,num+(i<<24),name, get_val2(st,num+((i+count)<<24) ) );
}
- for(;i<(128-(num>>24));i++){
- if( postfix!='$' ) set_reg(sd,num+(i<<24),name, 0);
- if( postfix=='$' ) set_reg(sd,num+(i<<24),name, (void *) "");
+
+ if(postfix != '$'){
+ for(;i<(128-(num>>24));i++)
+ set_reg(sd,num+(i<<24),name, 0);
+ } else {
+ for(;i<(128-(num>>24));i++)
+ set_reg(sd,num+(i<<24),name, (void *) "");
}
return 0;
}