From 0c1406c5703dfa5584b8128468a78692c3869cab Mon Sep 17 00:00:00 2001 From: ultramage Date: Mon, 12 Nov 2007 21:06:49 +0000 Subject: Added error reporting to buildin_warp when it fails. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11727 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 4 ---- src/map/script.c | 30 ++++++++++++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/map/pc.c b/src/map/pc.c index e50d6c57c..5ce0cae1f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3443,16 +3443,12 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target) return 0; } -// -// -// /*========================================== * Set's a player position. * Return values: * 0 - Success. * 1 - Invalid map index. * 2 - Map not in this map-server, and failed to locate alternate map-server. - * 3 - Failed to warp player because it was in transition between maps. *------------------------------------------*/ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype) { diff --git a/src/map/script.c b/src/map/script.c index 13352e192..374ed3d7b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4267,23 +4267,29 @@ BUILDIN_FUNC(rand) *------------------------------------------*/ BUILDIN_FUNC(warp) { + int ret; int x,y; - const char *str; - TBL_PC *sd=script_rid2sd(st); + const char* str; + TBL_PC* sd = script_rid2sd(st); nullpo_retr(0, sd); - str=script_getstr(st,2); - x=script_getnum(st,3); - y=script_getnum(st,4); + str = script_getstr(st,2); + x = script_getnum(st,3); + y = script_getnum(st,4); + if(strcmp(str,"Random")==0) - pc_randomwarp(sd,3); - else if(strcmp(str,"SavePoint")==0){ - pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3); - }else if(strcmp(str,"Save")==0){ - pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3); - }else - pc_setpos(sd,mapindex_name2id(str),x,y,0); + ret = pc_randomwarp(sd,3); + else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0) + ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3); + else + ret = pc_setpos(sd,mapindex_name2id(str),x,y,0); + + if( ret ) { + ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y); + script_reportsrc(st); + } + return 0; } /*========================================== -- cgit v1.2.3-70-g09d2