From 77b5031fc9f41079c772c429c8bff69706fac16b Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 17 Mar 2005 10:46:37 +0000 Subject: * Added display script filename when a script error is found while parsing git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1244 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 8 +++++--- src/map/npc.h | 2 +- src/map/pet.c | 5 ++++- src/map/script.c | 18 +++++++++++------- 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index 6adbe7e9c..409695996 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -35,7 +35,7 @@ struct npc_src_list { struct npc_src_list * next; // struct npc_src_list * prev; //[Shinomori] char name[4]; -} ; +}; static struct npc_src_list *npc_src_first=NULL; static struct npc_src_list *npc_src_last=NULL; @@ -44,7 +44,7 @@ static int npc_warp=0; static int npc_shop=0; static int npc_script=0; static int npc_mob=0; - +char *current_file = NULL; int npc_get_new_npc_id(void){ return npc_id++; } static struct dbt *ev_db; @@ -2435,6 +2435,7 @@ int do_init_npc(void) printf("file not found : %s\n",nsl->name); exit(1); } + current_file=nsl->name; lines=0; while(fgets(line,1020,fp)) { char w1[1024],w2[1024],w3[1024],w4[1024],mapname[1024]; @@ -2488,6 +2489,7 @@ int do_init_npc(void) } } fclose(fp); + current_file = NULL; printf("\r"); ShowStatus("Loading NPCs... Working: "); if (last_time != time(0)) { @@ -2511,7 +2513,7 @@ int do_init_npc(void) CL_WHITE"%d"CL_RESET"' Scripts\n\t-'" CL_WHITE"%d"CL_RESET"' Mobs\n", npc_id-START_NPC_NUM,"",npc_warp,npc_shop,npc_script,npc_mob); - ShowInfo(tmp_output); + ShowInfo(tmp_output); add_timer_func_list(npc_walktimer,"npc_walktimer"); // [Valaris] add_timer_func_list(npc_event_timer,"npc_event_timer"); diff --git a/src/map/npc.h b/src/map/npc.h index 5c9c8b900..5a680f22a 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -53,7 +53,7 @@ int npc_gettimerevent_tick(struct npc_data *nd); int npc_settimerevent_tick(struct npc_data *nd,int newtimer); int npc_delete(struct npc_data *nd); -char current_file[1024]; +extern char *current_file; #endif diff --git a/src/map/pet.c b/src/map/pet.c index 6ec18422c..a8e99df6c 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1588,6 +1588,7 @@ int read_petdb() char line[1024]; int i; int j=0; + int lines; char *filename[]={"db/pet_db.txt","db/pet_db2.txt"}; memset(pet_db,0,sizeof(pet_db)); @@ -1599,7 +1600,9 @@ int read_petdb() printf("can't read %s\n",filename[i]); return -1; } + lines = 0; while(fgets(line,1020,fp)){ + lines++; int nameid,i; char *str[32],*p,*np; @@ -1647,7 +1650,7 @@ int read_petdb() pet_db[j].script = NULL; if((np=strchr(p,'{'))==NULL) continue; - pet_db[j].script = parse_script(np,0); + pet_db[j].script = parse_script(np,lines); j++; } fclose(fp); diff --git a/src/map/script.c b/src/map/script.c index 961c4b5e5..c032fe401 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14,10 +14,11 @@ #include -#include "socket.h" -#include "timer.h" -#include "malloc.h" -#include "lock.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/lock.h" +#include "../common/db.h" #include "map.h" #include "clif.h" @@ -31,15 +32,14 @@ #include "npc.h" #include "pet.h" #include "intif.h" -#include "db.h" #include "skill.h" #include "chat.h" #include "battle.h" #include "party.h" #include "guild.h" -#include "lock.h" #include "atcommand.h" #include "log.h" +#include "showmsg.h" #ifdef MEMWATCH #include "memwatch.h" @@ -847,7 +847,11 @@ static void disp_error_message(const char *mes,const unsigned char *pos) *lineend=0; } if(lineend==NULL || pos