viewing paste Unknown #5790 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
Index: src/map/script.c
===================================================================
--- src/map/script.c    (revision 17307)
+++ src/map/script.c    (working copy)
@@ -15359,7 +15359,6 @@
 }
 // <--- [zBuffer] List of player cont commands
 // [zBuffer] List of mob control commands --->
-//## TODO always return if the request/whatever was successfull [FlavioJS]
 
 /// Makes the unit walk to target position or map
 /// Returns if it was successfull
@@ -15372,17 +15371,16 @@
 
    bl = map_id2bl(script_getnum(st,2));
    if( bl == NULL )
-   {
        script_pushint(st, 0);
-   }
-   else if( script_hasdata(st,4) )
-   {
+
+   if( script_hasdata(st,4) ) {
        int x = script_getnum(st,3);
        int y = script_getnum(st,4);
-       script_pushint(st, unit_walktoxy(bl,x,y,0));// We'll use harder calculations.
-   }
-   else
-   {
+       if( unit_can_reach_pos(bl,x,y,0) ) {
+           add_timer(gettick()+50, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF)); // Need timer to avoid mismatches
+           return 1;
+       }
+   } else {
        int map_id = script_getnum(st,3);
        script_pushint(st, unit_walktobl(bl,map_id2bl(map_id),65025,1));
    }
Index: src/map/unit.c
===================================================================
--- src/map/unit.c  (revision 17307)
+++ src/map/unit.c  (working copy)
@@ -298,7 +298,7 @@
    return 0;
 }
 
-static int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
+int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
 {
    struct block_list *bl = map_id2bl(id);
 
Index: src/map/unit.h
===================================================================
--- src/map/unit.h  (revision 17307)
+++ src/map/unit.h  (working copy)
@@ -68,61 +68,56 @@
    unsigned dead_sit : 2;
 };
 
-// PC, MOB, PET ‚É‹€’Ê‚·‚鏈—‚ð‚P‚‚ɂ܂Ƃ߂éŒv‰æ
+// PC, MOB, PET
 
-// •àsŠJŽn
-//     –ß‚è’l‚́A0 ( ¬Œ÷ ), 1 ( Žž”s )
+// Does walk action for unit
 int unit_walktoxy( struct block_list *bl, short x, short y, int easy);
 int unit_walktobl( struct block_list *bl, struct block_list *target, int range, int easy);
 int unit_run(struct block_list *bl);
 int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir);
 
-// •às’âŽ~
-// type‚͈ȉº‚Ì‘g‚ݍ‡‚킹 :
-//     1: ˆÊ’uî•ñ‚Ì‘—M( ‚±‚̊֐”‚ÌŒã‚Ɉʒuî•ñ‚𑗐M‚·‚éê‡‚Í•s—v )
-//     2: ƒ_ƒ[ƒWƒfƒBƒŒƒC—L‚è
-//     4: •s–Ÿ(MOB‚̂݁H)
+// Causes the target object to stop moving.
 int unit_stop_walking(struct block_list *bl,int type);
 int unit_can_move(struct block_list *bl);
 int unit_is_walking(struct block_list *bl);
 int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type);
+int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data);
 
 int unit_escape(struct block_list *bl, struct block_list *target, short dist);
-// ˆÊ’u‚Ì‹­§ˆÚ“®(‚«”ò‚΂µ‚È‚Ç)
+
+// Instant unit changes
 int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath);
 int unit_warp(struct block_list *bl, short map, short x, short y, clr_type type);
 int unit_setdir(struct block_list *bl,unsigned char dir);
 uint8 unit_getdir(struct block_list *bl);
 int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag);
 
-// ‚»‚±‚Ü‚Å•às‚Å‚œ‚Ç‚è’…‚¯‚é‚©‚Ì”»’è
+// Can-reach checks
 bool unit_can_reach_pos(struct block_list *bl,int x,int y,int easy);
 bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y);
 
-// UŒ‚ŠÖ˜A
+// Unit attack functions
 int unit_stop_attack(struct block_list *bl);
 int unit_attack(struct block_list *src,int target_id,int continuous);
 int unit_cancel_combo(struct block_list *bl);
 
-// ƒXƒLƒ‹Žg—p
+// Cast on a unit
 int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv);
 int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv);
-
-// ƒXƒLƒ‹Žg—p( •â³Ï‚݃LƒƒƒXƒgŽžŠÔAƒLƒƒƒ“ƒZƒ‹•s‰ÂÝ’è•t‚« )
 int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel);
 int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel);
 
-// ‰r¥ƒLƒƒƒ“ƒZƒ‹
+// Cancel unit cast
 int unit_skillcastcancel(struct block_list *bl,int type);
 
 int unit_counttargeted(struct block_list *bl);
 int unit_set_target(struct unit_data* ud, int target_id);
 
-// unit_data ‚̏‰Šú‰»ˆ—
+// unit_data
 void unit_dataset(struct block_list *bl);
 
 int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2);
-// ‚»‚Ì‘Œ
+// Remove unit
 struct unit_data* unit_bl2ud(struct block_list *bl);
 void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype);
 void unit_free_pc(struct map_session_data *sd);
@@ -131,12 +126,10 @@
 int unit_free(struct block_list *bl, clr_type clrtype);
 int unit_changeviewsize(struct block_list *bl,short size);
 
-// ‰Šú‰»ƒ‹[ƒ`ƒ“
 int do_init_unit(void);
 int do_final_unit(void);
-/**
- * Ranger
- **/
+
+// Ranger
 int unit_wugdash(struct block_list *bl, struct map_session_data *sd);
 
 extern const short dirx[8];
Viewed 718 times, submitted by Guest.