summaryrefslogtreecommitdiff
path: root/src/common/grfio.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-02 00:20:51 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-02 00:20:51 +0000
commit35f6c6cfb89988885f6f2a647cc0fc8dac14f10e (patch)
tree424975be62443260380240ea9bbe97089c2b691f /src/common/grfio.c
parent68af20ce57ff53d16ba2e2a5cc93f03bf163d13e (diff)
downloadhercules-35f6c6cfb89988885f6f2a647cc0fc8dac14f10e.tar.gz
hercules-35f6c6cfb89988885f6f2a647cc0fc8dac14f10e.tar.bz2
hercules-35f6c6cfb89988885f6f2a647cc0fc8dac14f10e.tar.xz
hercules-35f6c6cfb89988885f6f2a647cc0fc8dac14f10e.zip
* Fixed local files could not be aliased with resnametable.txt in grfio (bugreport:2203, since r5152).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14648 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/grfio.c')
-rw-r--r--src/common/grfio.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 9f57f4e25..3c0960f30 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -13,6 +13,7 @@
#include "../common/showmsg.h"
#include "../common/malloc.h"
#include "../common/strlib.h"
+#include "../common/utils.h"
//----------------------------
@@ -458,7 +459,7 @@ void* grfio_reads(char* fname, int* size)
char lfname[256];
int declen;
- grfio_localpath_create(lfname, sizeof(lfname), fname);
+ grfio_localpath_create(lfname, sizeof(lfname), ( entry && entry->fnd ) ? entry->fnd : fname);
in = fopen(lfname, "rb");
if (in != NULL) {
@@ -708,9 +709,10 @@ static int grfio_entryread(char* grfname, int gentry)
*------------------------------------------*/
static void grfio_resourcecheck(void)
{
- char w1[256], w2[256], src[256], dst[256], restable[256], line[256];
+ char w1[256], w2[256], src[256], dst[256], restable[256], line[256], local[256];
char *ptr, *buf;
FILELIST* entry;
+ FILELIST fentry;
int size;
FILE* fp;
int i = 0;
@@ -732,13 +734,26 @@ static void grfio_resourcecheck(void)
// create new entries reusing the original's info
if (entry != NULL)
{// alias for GRF resource
- FILELIST fentry;
memcpy(&fentry, entry, sizeof(FILELIST));
safestrncpy(fentry.fn, src, sizeof(fentry.fn));
fentry.fnd = aStrdup(dst);
filelist_modify(&fentry);
i++;
}
+ else
+ {
+ grfio_localpath_create(local, sizeof(local), dst);
+
+ if( exists(local) )
+ {// alias for local resource
+ memset(&fentry, 0, sizeof(fentry));
+ //fentry.gentry = 0;
+ safestrncpy(fentry.fn, src, sizeof(fentry.fn));
+ fentry.fnd = aStrdup(dst);
+ filelist_modify(&fentry);
+ i++;
+ }
+ }
}
}
fclose(fp);
@@ -761,13 +776,26 @@ static void grfio_resourcecheck(void)
entry = filelist_find(dst);
if (entry != NULL)
{// alias for GRF resource
- FILELIST fentry;
memcpy(&fentry, entry, sizeof(FILELIST));
safestrncpy(fentry.fn, src, sizeof(fentry.fn));
fentry.fnd = aStrdup(dst);
filelist_modify(&fentry);
i++;
}
+ else
+ {
+ grfio_localpath_create(local, sizeof(local), dst);
+
+ if( exists(local) )
+ {// alias for local resource
+ memset(&fentry, 0, sizeof(fentry));
+ //fentry.gentry = 0;
+ safestrncpy(fentry.fn, src, sizeof(fentry.fn));
+ fentry.fnd = aStrdup(dst);
+ filelist_modify(&fentry);
+ i++;
+ }
+ }
}
ptr = strchr(ptr, '\n'); // Next line
if (!ptr) break;