* Added display script filename when a script error is found while parsing

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1244 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
celest 2005-03-17 10:46:37 +00:00
parent f4b515d055
commit 4d4414fbbc
5 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,8 @@
Date Added
03/17
* Added display script filename when a script error is found while parsing
[celest]
* Added 2 char-server packets to support Freya's login server [celest]
* Rewrite on Full Strip [celest]
* Fixed heap corrupion in map.c caused while loading maps

View File

@ -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");

View File

@ -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

View File

@ -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);

View File

@ -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]);