summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/battle.c5
-rw-r--r--src/map/chrif.c7
-rw-r--r--src/map/clif.c15
-rw-r--r--src/map/guild.c4
-rw-r--r--src/map/itemdb.c21
-rw-r--r--src/map/magic-interpreter-parser.c2
-rw-r--r--src/map/magic-interpreter.h1
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/mob.c16
-rw-r--r--src/map/npc.c5
-rw-r--r--src/map/pc.c40
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/skill.c17
14 files changed, 92 insertions, 77 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 6536e00..eb37561 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -574,9 +574,9 @@ void log_atcommand(struct map_session_data *sd, const char *fmt, ...)
sprintf(fullname, "%s.%04d-%02d", gm_logfile_name, year, month);
if (gm_logfile)
- fclose(gm_logfile);
+ fclose_(gm_logfile);
- gm_logfile = fopen(fullname, "a");
+ gm_logfile = fopen_(fullname, "a");
free(fullname);
if (!gm_logfile) {
@@ -729,7 +729,7 @@ int msg_config_read(const char *cfgName) {
char line[1024], w1[1024], w2[1024];
FILE *fp;
- if ((fp = fopen(cfgName, "r")) == NULL) {
+ if ((fp = fopen_(cfgName, "r")) == NULL) {
printf("Messages file not found: %s\n", cfgName);
return 1;
}
@@ -748,7 +748,7 @@ int msg_config_read(const char *cfgName) {
}
}
}
- fclose(fp);
+ fclose_(fp);
return 0;
}
@@ -776,7 +776,7 @@ int atcommand_config_read(const char *cfgName) {
AtCommandInfo* p;
FILE* fp;
- if ((fp = fopen(cfgName, "r")) == NULL) {
+ if ((fp = fopen_(cfgName, "r")) == NULL) {
printf("At commands configuration file not found: %s\n", cfgName);
return 1;
}
@@ -803,7 +803,7 @@ int atcommand_config_read(const char *cfgName) {
w2[0] != '%') // symbol of party chat speaking
command_symbol = w2[0];
}
- fclose(fp);
+ fclose_(fp);
return 0;
}
@@ -1934,7 +1934,7 @@ int atcommand_help(
memset(buf, '\0', sizeof(buf));
- if ((fp = fopen(help_txt, "r")) != NULL) {
+ if ((fp = fopen_(help_txt, "r")) != NULL) {
clif_displaymessage(fd, msg_table[26]); // Help commands:
gm_level = pc_isGM(sd);
while(fgets(buf, sizeof(buf) - 1, fp) != NULL) {
@@ -1951,7 +1951,7 @@ int atcommand_help(
else if (gm_level >= atoi(w1))
clif_displaymessage(fd, w2);
}
- fclose(fp);
+ fclose_(fp);
} else {
clif_displaymessage(fd, msg_table[27]); // File help.txt not found.
return -1;
diff --git a/src/map/battle.c b/src/map/battle.c
index 94d64de..c9f1b59 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -17,6 +17,7 @@
#include "mob.h"
#include "pc.h"
#include "skill.h"
+#include "../common/socket.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -4527,7 +4528,7 @@ int battle_config_read(const char *cfgName)
battle_config.trade_spam_warn = 8;
}
- fp = fopen(cfgName,"r");
+ fp = fopen_(cfgName,"r");
if (fp == NULL) {
printf("file not found: %s\n", cfgName);
return 1;
@@ -4750,7 +4751,7 @@ int battle_config_read(const char *cfgName)
if (strcmpi(w1, "import") == 0)
battle_config_read(w2);
}
- fclose(fp);
+ fclose_(fp);
if (--count == 0) {
if(battle_config.flooritem_lifetime < 1000)
diff --git a/src/map/chrif.c b/src/map/chrif.c
index cc9437a..4318d1a 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -864,7 +864,7 @@ int chrif_reloadGMdb(void)
WFIFOW(char_fd,4) = job_rate;
WFIFOW(char_fd,6) = drop_rate;
- if ((fp = fopen(motd_txt, "r")) != NULL) {
+ if ((fp = fopen_(motd_txt, "r")) != NULL) {
if (fgets(buf, 250, fp) != NULL) {
for(i = 0; buf[i]; i++) {
if (buf[i] == '\r' || buf[i] == '\n') {
@@ -875,7 +875,7 @@ int chrif_reloadGMdb(void)
WFIFOW(char_fd,8) = sizeof(buf) + 10;
memcpy(WFIFOP(char_fd,10), buf, sizeof(buf));
}
- fclose(fp);
+ fclose_(fp);
} else {
WFIFOW(char_fd,8) = sizeof(buf) + 10;
memcpy(WFIFOP(char_fd,10), buf, sizeof(buf));
@@ -1113,7 +1113,8 @@ int check_connect_char_server(int tid, unsigned int tick, int id, int data) {
if (char_fd <= 0 || session[char_fd] == NULL) {
printf("Attempt to connect to char-server...\n");
chrif_state = 0;
- char_fd = make_connection(char_ip, char_port);
+ if ((char_fd = make_connection(char_ip, char_port)) < 0)
+ return 0;
session[char_fd]->func_parse = chrif_parse;
realloc_fifo(char_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
diff --git a/src/map/clif.c b/src/map/clif.c
index 1f88ed8..9357084 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8339,9 +8339,18 @@ static void (*clif_parse_func_table[0x220])() = {
static int clif_parse(int fd) {
int packet_len = 0, cmd=0;
struct map_session_data *sd=NULL;
-
+
sd = session[fd]->session_data;
+ if (!sd || (sd && !sd->state.auth)) {
+ if (RFIFOREST(fd) < 2) { // too small a packet disconnect
+ session[fd]->eof = 1;
+ }
+ if (RFIFOW(fd,0) != 0x72) { // first packet not auth, disconnect
+ session[fd]->eof = 1;
+ }
+ }
+
// �ڑ����؂��Ă��̂Ō��n��
if (!chrif_isconnect() || session[fd]->eof) { // char�I�Ɍq����ĂȂ��Ԃ͐ڑ��֎~ (!chrif_isconnect())
if (sd && sd->state.auth) {
@@ -8433,7 +8442,7 @@ static int clif_parse(int fd) {
} else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
printf("\nAccount ID %d.\n", sd->bl.id);
- if ((fp = fopen(packet_txt, "a")) == NULL) {
+ if ((fp = fopen_(packet_txt, "a")) == NULL) {
printf("clif.c: cant write [%s] !!! data is lost !!!\n", packet_txt);
return 1;
} else {
@@ -8454,7 +8463,7 @@ static int clif_parse(int fd) {
fprintf(fp, "%02X ", RFIFOB(fd,i));
}
fprintf(fp, "\n\n");
- fclose(fp);
+ fclose_(fp);
}
}
#endif
diff --git a/src/map/guild.c b/src/map/guild.c
index 9e65c33..1509a37 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -64,7 +64,7 @@ static int guild_read_castledb(void)
char *str[32],*p;
struct guild_castle *gc;
- if( (fp=fopen("db/castle_db.txt","r"))==NULL){
+ if( (fp=fopen_("db/castle_db.txt","r"))==NULL){
printf("can't read db/castle_db.txt\n");
return -1;
}
@@ -97,7 +97,7 @@ static int guild_read_castledb(void)
ln++;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/castle_db.txt done (count=%d)\n",ln);
return 0;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 44b45ad..d9cb429 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -12,6 +12,7 @@
#include "itemdb.h"
#include "script.h"
#include "pc.h"
+#include "../common/socket.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -280,7 +281,7 @@ static int itemdb_readdb(void)
for(i=0;i<2;i++){
- fp=fopen(filename[i],"r");
+ fp=fopen_(filename[i],"r");
if(fp==NULL){
if(i>0)
continue;
@@ -348,7 +349,7 @@ static int itemdb_readdb(void)
continue;
id->equip_script = parse_script(p,lines);
}
- fclose(fp);
+ fclose_(fp);
printf("read %s done (count=%d)\n",filename[i],ln);
}
return 0;
@@ -388,7 +389,7 @@ static int itemdb_read_randomitem()
*pdefault = 0;
- if( (fp=fopen(fn,"r"))==NULL ){
+ if( (fp=fopen_(fn,"r"))==NULL ){
printf("can't read %s\n",fn);
continue;
}
@@ -424,7 +425,7 @@ static int itemdb_read_randomitem()
break;
ln++;
}
- fclose(fp);
+ fclose_(fp);
printf("read %s done (count=%d)\n",fn,*pc);
}
@@ -442,7 +443,7 @@ static int itemdb_read_itemavail(void)
int nameid,j,k;
char *str[10],*p;
- if( (fp=fopen("db/item_avail.txt","r"))==NULL ){
+ if( (fp=fopen_("db/item_avail.txt","r"))==NULL ){
printf("can't read db/item_avail.txt\n");
return -1;
}
@@ -473,7 +474,7 @@ static int itemdb_read_itemavail(void)
id->flag.available = 0;
ln++;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/item_avail.txt done (count=%d)\n",ln);
return 0;
}
@@ -568,7 +569,7 @@ static int itemdb_read_noequip(void)
char *str[32],*p;
struct item_data *id;
- if( (fp=fopen("db/item_noequip.txt","r"))==NULL ){
+ if( (fp=fopen_("db/item_noequip.txt","r"))==NULL ){
printf("can't read db/item_noequip.txt\n");
return -1;
}
@@ -593,7 +594,7 @@ static int itemdb_read_noequip(void)
ln++;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/item_noequip.txt done (count=%d)\n",ln);
return 0;
}
@@ -650,9 +651,9 @@ static int itemdebug(void *key,void *data,va_list ap){
}
void itemdebugtxt()
{
- dfp=fopen("itemdebug.txt","wt");
+ dfp=fopen_("itemdebug.txt","wt");
numdb_foreach(item_db,itemdebug);
- fclose(dfp);
+ fclose_(dfp);
}
*/
diff --git a/src/map/magic-interpreter-parser.c b/src/map/magic-interpreter-parser.c
index 8cf2312..7ff9fb4 100644
--- a/src/map/magic-interpreter-parser.c
+++ b/src/map/magic-interpreter-parser.c
@@ -3224,7 +3224,7 @@ magic_init(char *conffile) // must be called after itemdb initialisation
INTERN_ASSERT("script_target", VAR_SCRIPTTARGET);
INTERN_ASSERT("location", VAR_LOCATION);
- magic_frontend_in = fopen(conffile, "r");
+ magic_frontend_in = fopen_(conffile, "r");
if (!magic_frontend_in) {
fprintf(stderr, "[magic-conf] Magic configuration file `%s' not found -> no magic.\n", conffile);
return 0;
diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h
index 515b120..4324e53 100644
--- a/src/map/magic-interpreter.h
+++ b/src/map/magic-interpreter.h
@@ -29,6 +29,7 @@
#include "trade.h"
#include "../common/timer.h"
+#include "../common/socket.h"
#define SPELLARG_NONE 0 /* No spell parameter */
#define SPELLARG_PC 1 /* Spell parameter describes pc (defaults to self) */
diff --git a/src/map/map.c b/src/map/map.c
index ee42d3d..86acb62 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1454,7 +1454,7 @@ static void map_readwater(char *watertxt) {
FILE *fp=NULL;
int n=0;
- fp=fopen(watertxt,"r");
+ fp=fopen_(watertxt,"r");
if(fp==NULL){
printf("file not found: %s\n",watertxt);
return;
@@ -1475,7 +1475,7 @@ static void map_readwater(char *watertxt) {
waterlist[n].waterheight = 3;
n++;
}
- fclose(fp);
+ fclose_(fp);
}
/*==========================================
@@ -1665,7 +1665,7 @@ int map_config_read(char *cfgName) {
FILE *fp;
struct hostent *h = NULL;
- fp = fopen(cfgName,"r");
+ fp = fopen_(cfgName,"r");
if (fp == NULL) {
printf("Map configuration file not found at: %s\n", cfgName);
exit(1);
@@ -1730,7 +1730,7 @@ int map_config_read(char *cfgName) {
}
}
}
- fclose(fp);
+ fclose_(fp);
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index 51a83d2..09395f6 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3833,7 +3833,7 @@ static int mob_readdb(void)
for(i=0;i<2;i++){
- fp=fopen(filename[i],"r");
+ fp=fopen_(filename[i],"r");
if(fp==NULL){
if(i>0)
continue;
@@ -3966,7 +3966,7 @@ static int mob_readdb(void)
if (mob_db[class].base_exp == 0) mob_db[class].base_exp = mob_gen_exp(&mob_db[class]);
}
- fclose(fp);
+ fclose_(fp);
printf("read %s done\n",filename[i]);
}
return 0;
@@ -3984,7 +3984,7 @@ static int mob_readdb_mobavail(void)
int class,j,k;
char *str[20],*p,*np;
- if( (fp=fopen("db/mob_avail.txt","r"))==NULL ){
+ if( (fp=fopen_("db/mob_avail.txt","r"))==NULL ){
printf("can't read db/mob_avail.txt\n");
return -1;
}
@@ -4031,7 +4031,7 @@ static int mob_readdb_mobavail(void)
ln++;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/mob_avail.txt done (count=%d)\n",ln);
return 0;
}
@@ -4054,7 +4054,7 @@ static int mob_read_randommonster(void)
for(i=0;i<MAX_RANDOMMONSTER;i++){
mob_db[0].summonper[i] = 1002; // ݒ肵Yꂽꍇ̓|o悤ɂĂ
- fp=fopen(mobfile[i],"r");
+ fp=fopen_(mobfile[i],"r");
if(fp==NULL){
printf("can't read %s\n",mobfile[i]);
return -1;
@@ -4078,7 +4078,7 @@ static int mob_read_randommonster(void)
if((class>1000 && class<=2000) || class==0)
mob_db[class].summonper[i]=per;
}
- fclose(fp);
+ fclose_(fp);
printf("read %s done\n",mobfile[i]);
}
return 0;
@@ -4153,7 +4153,7 @@ static int mob_readskilldb(void)
for(x=0;x<2;x++){
- fp=fopen(filename[x],"r");
+ fp=fopen_(filename[x],"r");
if(fp==NULL){
if(x==0)
printf("can't read %s\n",filename[x]);
@@ -4231,7 +4231,7 @@ static int mob_readskilldb(void)
ms->emotion=-1;
mob_db[mob_id].maxskill=i+1;
}
- fclose(fp);
+ fclose_(fp);
printf("read %s done\n",filename[x]);
}
return 0;
diff --git a/src/map/npc.c b/src/map/npc.c
index 11725b3..5fe190b 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -21,6 +21,7 @@
#include "pc.h"
#include "script.h"
#include "skill.h"
+#include "../common/socket.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -2008,7 +2009,7 @@ int do_init_npc(void)
free(nsl->prev);
nsl->prev = NULL;
}
- fp=fopen(nsl->name,"r");
+ fp=fopen_(nsl->name,"r");
if (fp==NULL) {
printf("file not found : %s\n",nsl->name);
exit(1);
@@ -2065,7 +2066,7 @@ int do_init_npc(void)
npc_parse_mapflag(w1,w2,w3,w4);
}
}
- fclose(fp);
+ fclose_(fp);
printf("\rLoading NPCs [%d]: %-54s",npc_id-START_NPC_NUM,nsl->name);
fflush(stdout);
}
diff --git a/src/map/pc.c b/src/map/pc.c
index b3626df..2e75294 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -798,7 +798,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
{
char buf[256];
FILE *fp;
- if ((fp = fopen(motd_txt, "r")) != NULL) {
+ if ((fp = fopen_(motd_txt, "r")) != NULL) {
while (fgets(buf, sizeof(buf)-1, fp) != NULL) {
int i;
for(i=0; buf[i]; i++) {
@@ -809,7 +809,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio
}
clif_displaymessage(sd->fd, buf);
}
- fclose(fp);
+ fclose_(fp);
}
}
@@ -7330,7 +7330,7 @@ int pc_readdb(void)
// �K�v�o���l�ǂݍ���
- fp=fopen("db/exp.txt","r");
+ fp=fopen_("db/exp.txt","r");
if(fp==NULL){
printf("can't read db/exp.txt\n");
return 1;
@@ -7360,11 +7360,11 @@ int pc_readdb(void)
if(i >= battle_config.maximum_level)
break;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/exp.txt done\n");
// JOB�␳���l�P
- fp=fopen("db/job_db1.txt","r");
+ fp=fopen_("db/job_db1.txt","r");
if(fp==NULL){
printf("can't read db/job_db1.txt\n");
return 1;
@@ -7394,11 +7394,11 @@ int pc_readdb(void)
if(i==MAX_PC_CLASS)
break;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/job_db1.txt done\n");
// JOB�{�[�i�X
- fp=fopen("db/job_db2.txt","r");
+ fp=fopen_("db/job_db2.txt","r");
if(fp==NULL){
printf("can't read db/job_db2.txt\n");
return 1;
@@ -7422,11 +7422,11 @@ int pc_readdb(void)
if(i==MAX_PC_CLASS)
break;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/job_db2.txt done\n");
// JOB�{�[�i�X2 �]���E�p
- fp=fopen("db/job_db2-2.txt","r");
+ fp=fopen_("db/job_db2-2.txt","r");
if(fp==NULL){
printf("can't read db/job_db2-2.txt\n");
return 1;
@@ -7446,12 +7446,12 @@ int pc_readdb(void)
if(i==MAX_PC_CLASS)
break;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/job_db2-2.txt done\n");
// �X�L���c���[
memset(skill_tree,0,sizeof(skill_tree));
- fp=fopen("db/skill_tree.txt","r");
+ fp=fopen_("db/skill_tree.txt","r");
if(fp==NULL){
printf("can't read db/skill_tree.txt\n");
return 1;
@@ -7480,7 +7480,7 @@ int pc_readdb(void)
skill_tree[2][i][j].need[k].lv=atoi(split[k*2+4]); //�{�q�E�͗ǂ��������Ȃ��̂Ŏb��
}
}
- fclose(fp);
+ fclose_(fp);
printf("read db/skill_tree.txt done\n");
// �����C���e�[�u��
@@ -7488,7 +7488,7 @@ int pc_readdb(void)
for(j=0;j<10;j++)
for(k=0;k<10;k++)
attr_fix_table[i][j][k]=100;
- fp=fopen("db/attr_fix.txt","r");
+ fp=fopen_("db/attr_fix.txt","r");
if(fp==NULL){
printf("can't read db/attr_fix.txt\n");
return 1;
@@ -7526,14 +7526,14 @@ int pc_readdb(void)
i++;
}
}
- fclose(fp);
+ fclose_(fp);
printf("read db/attr_fix.txt done\n");
// �T�C�Y�␳�e�[�u��
for(i=0;i<3;i++)
for(j=0;j<20;j++)
atkmods[i][j]=100;
- fp=fopen("db/size_fix.txt","r");
+ fp=fopen_("db/size_fix.txt","r");
if(fp==NULL){
printf("can't read db/size_fix.txt\n");
return 1;
@@ -7555,7 +7555,7 @@ int pc_readdb(void)
atkmods[i][j]=atoi(split[j]);
i++;
}
- fclose(fp);
+ fclose_(fp);
printf("read db/size_fix.txt done\n");
// ���B�f�[�^�e�[�u��
@@ -7566,7 +7566,7 @@ int pc_readdb(void)
refinebonus[i][1]=0;
refinebonus[i][2]=10;
}
- fp=fopen("db/refine_db.txt","r");
+ fp=fopen_("db/refine_db.txt","r");
if(fp==NULL){
printf("can't read db/refine_db.txt\n");
return 1;
@@ -7591,7 +7591,7 @@ int pc_readdb(void)
percentrefinery[i][j]=atoi(split[j+3]);
i++;
}
- fclose(fp); //Lupus. close this file!!!
+ fclose_(fp); //Lupus. close this file!!!
printf("read db/refine_db.txt done\n");
return 0;
@@ -7619,7 +7619,7 @@ static void pc_statpointdb(void)
FILE *stp;
- stp=fopen("db/statpoint.txt","r");
+ stp=fopen_("db/statpoint.txt","r");
if(stp==NULL){
printf("can't read db/statpoint.txt\n");
@@ -7632,7 +7632,7 @@ static void pc_statpointdb(void)
buf_stat = (char *) malloc (end + 1);
l = fread(buf_stat,1,end,stp);
- fclose(stp);
+ fclose_(stp);
printf("read db/statpoint.txt done (size=%d)\n",l);
for(i=0;i<255;i++) {
diff --git a/src/map/script.c b/src/map/script.c
index 94f03f7..218c3f3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1090,7 +1090,7 @@ static void read_constdb(void)
char line[1024],name[1024];
int val,n,i,type;
- fp=fopen("db/const.txt","r");
+ fp=fopen_("db/const.txt","r");
if(fp==NULL){
printf("can't read db/const.txt\n");
return ;
@@ -1111,7 +1111,7 @@ static void read_constdb(void)
str_data[n].val=val;
}
}
- fclose(fp);
+ fclose_(fp);
}
/*==========================================
@@ -6549,7 +6549,7 @@ static int script_load_mapreg()
FILE *fp;
char line[1024];
- if( (fp=fopen(mapreg_txt,"rt"))==NULL )
+ if( (fp=fopen_(mapreg_txt,"rt"))==NULL )
return -1;
while(fgets(line,sizeof(line),fp)){
@@ -6576,7 +6576,7 @@ static int script_load_mapreg()
numdb_insert(mapreg_db,(i<<24)|s,v);
}
}
- fclose(fp);
+ fclose_(fp);
mapreg_dirty=0;
return 0;
}
@@ -6666,7 +6666,7 @@ int script_config_read(char *cfgName)
script_config.check_cmdcount=8192;
script_config.check_gotocount=512;
- fp=fopen(cfgName,"r");
+ fp=fopen_(cfgName,"r");
if(fp==NULL){
printf("file not found: %s\n",cfgName);
return 1;
@@ -6684,7 +6684,7 @@ int script_config_read(char *cfgName)
script_config_read(w2);
}
}
- fclose(fp);
+ fclose_(fp);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 3a777ac..c661dc2 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -21,6 +21,7 @@
#include "pc.h"
#include "script.h"
#include "skill.h"
+#include "../common/socket.h"
#ifdef MEMWATCH
#include "memwatch.h"
@@ -9890,7 +9891,7 @@ int skill_readdb(void)
/* The main skill database */
memset(skill_db,0,sizeof(skill_db));
- fp=fopen("db/skill_db.txt","r");
+ fp=fopen_("db/skill_db.txt","r");
if(fp==NULL){
printf("can't read db/skill_db.txt\n");
return 1;
@@ -9959,10 +9960,10 @@ int skill_readdb(void)
for(k=0;k<MAX_SKILL_LEVEL;k++)
skill_db[i].blewcount[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
}
- fclose(fp);
+ fclose_(fp);
printf("read db/skill_db.txt done\n");
- fp=fopen("db/skill_require_db.txt","r");
+ fp=fopen_("db/skill_require_db.txt","r");
if(fp==NULL){
printf("can't read db/skill_require_db.txt\n");
return 1;
@@ -10097,11 +10098,11 @@ int skill_readdb(void)
skill_db[i].itemid[9]=atoi(split[28]);
skill_db[i].amount[9]=atoi(split[29]);
}
- fclose(fp);
+ fclose_(fp);
printf("read db/skill_require_db.txt done\n");
/* ? */
- fp=fopen("db/skill_cast_db.txt","r");
+ fp=fopen_("db/skill_cast_db.txt","r");
if(fp==NULL){
printf("can't read db/skill_cast_db.txt\n");
return 1;
@@ -10160,10 +10161,10 @@ int skill_readdb(void)
for(k=0;k<MAX_SKILL_LEVEL;k++)
skill_db[i].upkeep_time2[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
}
- fclose(fp);
+ fclose_(fp);
printf("read db/skill_cast_db.txt done\n");
- fp=fopen("db/skill_castnodex_db.txt","r");
+ fp=fopen_("db/skill_castnodex_db.txt","r");
if(fp==NULL){
printf("can't read db/skill_castnodex_db.txt\n");
return 1;
@@ -10193,7 +10194,7 @@ int skill_readdb(void)
for(k=0;k<MAX_SKILL_LEVEL;k++)
skill_db[i].castnodex[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
}
- fclose(fp);
+ fclose_(fp);
printf("read db/skill_castnodex_db.txt done\n");
return 0;