summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-21 19:19:15 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-21 19:19:15 +0300
commitec431e54185f525e7006cae9f7e1a6fe9ced39b5 (patch)
treee5bd4f5cfd3207b628a3bb1d8d53579db470bacd /src/map/unit.c
parent5931a58658c9c5a486dacaf4d1515d4f736da19f (diff)
downloadevol-hercules-ec431e54185f525e7006cae9f7e1a6fe9ced39b5.tar.gz
evol-hercules-ec431e54185f525e7006cae9f7e1a6fe9ced39b5.tar.bz2
evol-hercules-ec431e54185f525e7006cae9f7e1a6fe9ced39b5.tar.xz
evol-hercules-ec431e54185f525e7006cae9f7e1a6fe9ced39b5.zip
Fix heavy CPU usage while walking.
After this commit and some changes in configuration it allow spawn more than 7k mobs in small area with small CPU usage.
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 2e6276e..0c6445b 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -145,3 +145,14 @@ int eunit_can_move(struct block_list *bl)
hookStop();
return 1;
}
+
+int eunit_walktoxy(struct block_list *bl __attribute__ ((unused)),
+ short *x __attribute__ ((unused)),
+ short *y __attribute__ ((unused)),
+ int *flagPtr)
+{
+ // reset flag "Search for an unoccupied cell and cancel if none available"
+ // this reduce CPU usage and allow mobs to walk on each other.
+ if ((*flagPtr)&8)
+ *flagPtr = ((*flagPtr) | 8) ^ 8;
+}