* Added auto reading leveluseskillspamount.txt and indoorrswtable.txt
* Added check in grfio.c to prevent crashing git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@667 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
dab08ea67a
commit
fd68849bec
@ -1,6 +1,10 @@
|
||||
Date Added
|
||||
|
||||
12/20
|
||||
* Added reading leveluseskillspamount.txt from the GRF to auto set sp used for each skill [celest]
|
||||
* Added reading indoorrswtable.txt from the GRF to auto set 'indoor' mapflags
|
||||
[celest]
|
||||
* Added check in grfio.c to prevent crashing if a file wasn't found [celest]
|
||||
* Rolling GUILDCACHE and FASTCHAR into main branches/stable
|
||||
tree [MouseJstr]
|
||||
* Changed max_paramter to an unsigned int so that you can have over 255 as your max stat [Codemaster]
|
||||
|
@ -444,13 +444,13 @@ int grfio_size(char *fname)
|
||||
entry = filelist_find(fname);
|
||||
|
||||
if (entry==NULL || entry->gentry<0) { // LocalFileCheck
|
||||
char lfname[256],rname[256],*p;
|
||||
char lfname[256],*rname,*p;
|
||||
FILELIST lentry;
|
||||
struct stat st;
|
||||
|
||||
if(strcmp(data_dir, "") != 0) {
|
||||
if(strcmp(data_dir, "") != 0 && (rname=grfio_resnametable(fname,lfname))!=NULL) {
|
||||
//printf("%s\t",fname);
|
||||
sprintf(rname,"%s",grfio_resnametable(fname,lfname));
|
||||
//sprintf(rname,"%s",grfio_resnametable(fname,lfname));
|
||||
//printf("%s\n",rname);
|
||||
sprintf(lfname,"%s%s",data_dir,rname);
|
||||
//printf("%s\n",lfname);
|
||||
@ -486,13 +486,16 @@ void* grfio_reads(char *fname, int *size)
|
||||
entry = filelist_find(fname);
|
||||
|
||||
if (entry==NULL || entry->gentry<=0) { // LocalFileCheck
|
||||
char lfname[256],rname[256],*p;
|
||||
char lfname[256],*rname,*p;
|
||||
FILELIST lentry;
|
||||
|
||||
strncpy(lfname,fname,255);
|
||||
sprintf(rname,"%s",grfio_resnametable(fname,lfname));
|
||||
sprintf(lfname,"%s%s",data_dir,rname);
|
||||
//printf("%s\n",lfname);
|
||||
// i hope this is the correct way =p [celest]
|
||||
if ((rname=grfio_resnametable(fname,lfname))!=NULL) {
|
||||
//sprintf(rname,"%s",grfio_resnametable(fname,lfname));
|
||||
sprintf(lfname,"%s%s",data_dir,rname);
|
||||
//printf("%s\n",lfname);
|
||||
}
|
||||
|
||||
for(p=&lfname[0];*p!=0;p++) if (*p=='\\') *p = '/'; // * At the time of Unix
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "pet.h"
|
||||
#include "battle.h"
|
||||
#include "skill.h"
|
||||
#include "grfio.h"
|
||||
#include "showmsg.h"
|
||||
|
||||
#ifdef MEMWATCH
|
||||
@ -2135,6 +2136,39 @@ static int npc_parse_mapflag(char *w1,char *w2,char *w3,char *w4)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int npc_read_indoors(void)
|
||||
{
|
||||
char *buf,*p;
|
||||
int s, m;
|
||||
|
||||
buf=grfio_reads("data\\indoorrswtable.txt",&s);
|
||||
|
||||
if(buf==NULL)
|
||||
return -1;
|
||||
|
||||
buf[s]=0;
|
||||
for(p=buf;p-buf<s;){
|
||||
char buf2[64];
|
||||
|
||||
if(sscanf(p,"%[^#]#",buf2) == 1){
|
||||
char map_name[64] = "";
|
||||
strncpy(map_name, buf2, strlen(buf2) - 4);
|
||||
strcat(map_name, ".gat");
|
||||
if ((m = map_mapname2mapid(map_name)) >= 0)
|
||||
map[m].flag.indoors=1;
|
||||
}
|
||||
|
||||
p=strchr(p,10);
|
||||
if(!p) break;
|
||||
p++;
|
||||
}
|
||||
free(buf);
|
||||
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\indoorrswtable.txt");
|
||||
ShowStatus(tmp_output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ev_db_final(void *key,void *data,va_list ap)
|
||||
{
|
||||
free(data);
|
||||
@ -2227,6 +2261,10 @@ int do_init_npc(void)
|
||||
int busy = 0;
|
||||
char c = '-';
|
||||
|
||||
// indoorrswtable.txt and etcinfo.txt [Celest]
|
||||
npc_read_indoors();
|
||||
//npc_read_weather();
|
||||
|
||||
ev_db=strdb_init(24);
|
||||
npcname_db=strdb_init(24);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "chrif.h"
|
||||
#include "guild.h"
|
||||
#include "showmsg.h"
|
||||
#include "grfio.h"
|
||||
|
||||
#ifdef MEMWATCH
|
||||
#include "memwatch.h"
|
||||
@ -11982,6 +11983,52 @@ int skill_readdb(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*===============================================
|
||||
* For reading leveluseskillspamount.txt [Celest]
|
||||
*-----------------------------------------------
|
||||
*/
|
||||
static int skill_read_skillspamount(void)
|
||||
{
|
||||
char *buf,*p;
|
||||
struct skill_db *skill = NULL;
|
||||
int s, idx, new_flag=1, level=1, sp=0;
|
||||
|
||||
buf=grfio_reads("data\\leveluseskillspamount.txt",&s);
|
||||
|
||||
if(buf==NULL)
|
||||
return -1;
|
||||
|
||||
buf[s]=0;
|
||||
for(p=buf;p-buf<s;){
|
||||
char buf2[64];
|
||||
|
||||
if (sscanf(p,"%[@]",buf2) == 1) {
|
||||
level = 1;
|
||||
new_flag = 1;
|
||||
} else if (new_flag && sscanf(p,"%[^#]#",buf2) == 1) {
|
||||
for (idx=0; skill_names[idx].id != 0; idx++) {
|
||||
if (strstr(buf2, skill_names[idx].name) != NULL) {
|
||||
skill = &skill_db[ skill_names[idx].id ];
|
||||
new_flag = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!new_flag && sscanf(p,"%d#",&sp) == 1) {
|
||||
skill->sp[level-1]=sp;
|
||||
level++;
|
||||
}
|
||||
|
||||
p=strchr(p,10);
|
||||
if(!p) break;
|
||||
p++;
|
||||
}
|
||||
free(buf);
|
||||
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\leveluseskillspamount.txt");
|
||||
ShowStatus(tmp_output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void skill_reload(void)
|
||||
{
|
||||
/*
|
||||
@ -12001,6 +12048,7 @@ void skill_reload(void)
|
||||
int do_init_skill(void)
|
||||
{
|
||||
skill_readdb();
|
||||
skill_read_skillspamount();
|
||||
|
||||
add_timer_func_list(skill_unit_timer,"skill_unit_timer");
|
||||
add_timer_func_list(skill_castend_id,"skill_castend_id");
|
||||
|
Loading…
x
Reference in New Issue
Block a user