summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 10:46:37 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 10:46:37 +0000
commit77b5031fc9f41079c772c429c8bff69706fac16b (patch)
tree45a68e3ef4f65e44d5bf67c8ba2018701fc57857 /src
parent26ab8da349bfd32e8bcd632f94bd33beff9fc4a9 (diff)
downloadhercules-77b5031fc9f41079c772c429c8bff69706fac16b.tar.gz
hercules-77b5031fc9f41079c772c429c8bff69706fac16b.tar.bz2
hercules-77b5031fc9f41079c772c429c8bff69706fac16b.tar.xz
hercules-77b5031fc9f41079c772c429c8bff69706fac16b.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c8
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/pet.c5
-rw-r--r--src/map/script.c18
4 files changed, 21 insertions, 12 deletions
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 <time.h>
-#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<lineend){
- printf("%s line %d : ",mes,line);
+ if (current_file) {
+ printf("%s in "CL_WHITE"\'%s\'"CL_RESET" line "CL_WHITE"\'%d\'"CL_RESET" : ", mes, current_file, line);
+ } else {
+ printf("%s line "CL_WHITE"\'%d\'"CL_RESET" : ", mes, line);
+ }
for(i=0;(linestart[i]!='\r') && (linestart[i]!='\n') && linestart[i];i++){
if(linestart+i!=pos)
printf("%c",linestart[i]);