From 7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Sun, 23 Sep 2007 03:14:57 +0000 Subject: * map_addflooritem and struct item_drop_list using id's instead of struct map_session_data's (fixes bugreport:36). * Fixed buildin_escape_sql not properly escaping in sql servers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11279 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 37dd99229..1aeff2e2e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6038,7 +6038,7 @@ BUILDIN_FUNC(getitem) else if( (flag=pc_additem(sd,&it,amount)) ){ clif_additem(sd,0,0,flag); if( pc_candrop(sd,&it) ) - map_addflooritem(&it,amount,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&it,amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } //Logs items, got from (N)PC scripts [Lupus] @@ -6122,7 +6122,7 @@ BUILDIN_FUNC(getitem2) item_tmp.card[3]=c4; if((flag = pc_additem(sd,&item_tmp,amount))) { clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,amount,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } //Logs items, got from (N)PC scripts [Lupus] @@ -6269,7 +6269,7 @@ BUILDIN_FUNC(makeitem) else item_tmp.identify=itemdb_isidentified(nameid); - map_addflooritem(&item_tmp,amount,m,x,y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,0); } return 0; @@ -9806,7 +9806,7 @@ BUILDIN_FUNC(successremovecards) if((flag=pc_additem(sd,&item_tmp,1))){ // 持てないならドロップ clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } }while(c--); @@ -9831,7 +9831,7 @@ BUILDIN_FUNC(successremovecards) if((flag=pc_additem(sd,&item_tmp,1))){ // もてないならドロップ clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } clif_misceffect(&sd->bl,3); return 0; @@ -9883,7 +9883,7 @@ BUILDIN_FUNC(failedremovecards) if((flag=pc_additem(sd,&item_tmp,1))){ clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } } @@ -9920,7 +9920,7 @@ BUILDIN_FUNC(failedremovecards) if((flag=pc_additem(sd,&item_tmp,1))){ clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } clif_misceffect(&sd->bl,2); @@ -12219,13 +12219,19 @@ BUILDIN_FUNC(query_sql) //Allows escaping of a given string. BUILDIN_FUNC(escape_sql) { - const char *query; - char *t_query; - query = script_getstr(st,2); - - t_query = aMallocA((strlen(query)*2+1)*sizeof(char)); - jstrescapecpy(t_query,query); - script_pushstr(st,t_query); + const char *str; + char *esc_str; + size_t len; + + str = script_getstr(st,2); + len = strlen(str); + esc_str = aMallocA(len*2+1); +#if defined(TXT_ONLY) + jstrescapecpy(esc_str, str); +#else + Sql_EscapeStringLen(mmysql_handle, esc_str, str, len); +#endif + script_pushstr(st, esc_str); return 0; } -- cgit v1.2.3-70-g09d2