summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-04-06 16:32:18 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-04-06 16:32:18 -0700
commit5396ef766afd827c1717143db95956e9e327f4b6 (patch)
tree4088d7991c4fb8304e87c0925cc35a1e62b1ba4b
parent6dd812ef9d8ab93a6825a31f62e75f1f58811bdc (diff)
downloadtmwa-5396ef766afd827c1717143db95956e9e327f4b6.tar.gz
tmwa-5396ef766afd827c1717143db95956e9e327f4b6.tar.bz2
tmwa-5396ef766afd827c1717143db95956e9e327f4b6.tar.xz
tmwa-5396ef766afd827c1717143db95956e9e327f4b6.zip
Figure out what that code was supposed to do
I talked with the eathena people about this. It was probably never executed anyway - it indicates mob_db errors.
-rw-r--r--src/map/mob.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 709df2b..ba2528c 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -2033,25 +2033,20 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick)
if (mobskill_use(md, tick, MobSkillCondition::ANY))
return;
- // 歩行処理
+ // mobs that are not slaves can random-walk
if (bool(mode & MobMode::CAN_MOVE)
&& mob_can_move(md)
&& (md->master_id == 0 || md->state.special_mob_ai
|| md->master_dist > 10))
{
- //取り巻きMOBじゃない
+ // if walktime is more than 7 seconds in the future,
+ // set it to somewhere between 3 and 5 seconds
if (md->next_walktime > tick + std::chrono::seconds(7)
&& (md->walkpath.path_len == 0
|| md->walkpath.path_pos >= md->walkpath.path_len))
{
- // Original: (3000 * rand()) % 2000
- // yields ({0 3000 6000 9000 12000 15000 ...} * 3000) % 2000
- // = {0 1000 0 1000 0 1000 ...}
- // Recent: 3000 * MRAND(2000)
- // yields 3000 * {0 3000 6000 9000 ... 5991000 5994000 5997000}
- // I have reverted to the original logic, but I don't understand.
-#warning "I don't understand this code! It is either wrong now or was wrong before."
- md->next_walktime = tick + std::chrono::seconds(random_::to(2));
+ md->next_walktime = tick + std::chrono::seconds(3)
+ + std::chrono::milliseconds(random_::to(2000));
}
// Random movement