diff options
author | skyleo <skyleo@skyleo.de> | 2019-10-03 18:47:06 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-03-08 20:56:27 +0100 |
commit | 0ca593266e3d7f78eb4648ffe7bad7a7db9b6490 (patch) | |
tree | c0cd9023f35f5056e1255b88679b5cbed3d1a81f | |
parent | d4a40467c5fb99b34b235a7fa8cde423fbdf24c0 (diff) | |
download | hercules-0ca593266e3d7f78eb4648ffe7bad7a7db9b6490.tar.gz hercules-0ca593266e3d7f78eb4648ffe7bad7a7db9b6490.tar.bz2 hercules-0ca593266e3d7f78eb4648ffe7bad7a7db9b6490.tar.xz hercules-0ca593266e3d7f78eb4648ffe7bad7a7db9b6490.zip |
Move declarations to initializations in unit->walktoxy_sub
-rw-r--r-- | src/map/unit.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index db4fc47e7..12d53df13 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -124,14 +124,12 @@ static struct unit_data *unit_bl2ud2(struct block_list *bl) static int unit_walktoxy_sub(struct block_list *bl) { int i; - struct walkpath_data wpd; - struct unit_data *ud = NULL; - - nullpo_retr(1, bl); - ud = unit->bl2ud(bl); - if(ud == NULL) return 0; + nullpo_retr(2, bl); + struct unit_data *ud = unit->bl2ud(bl); + if (ud == NULL) + return 2; - memset(&wpd, 0, sizeof(wpd)); + struct walkpath_data wpd = {0}; if( !path->search(&wpd,bl,bl->m,bl->x,bl->y,ud->to_x,ud->to_y,ud->state.walk_easy,CELL_CHKNOPASS) ) return 0; @@ -143,7 +141,7 @@ static int unit_walktoxy_sub(struct block_list *bl) return 0; #endif - memcpy(&ud->walkpath,&wpd,sizeof(wpd)); + ud->walkpath = wpd; if (ud->target_to && ud->chaserange>1) { //Generally speaking, the walk path is already to an adjacent tile |