summaryrefslogtreecommitdiff
path: root/src/common/mapindex.c
diff options
context:
space:
mode:
authorDracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-13 20:24:08 +0000
committerDracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-13 20:24:08 +0000
commited39bb7197c749c28f1de75a4219329465b0fa08 (patch)
treef0b59d7408c3725da780acc84f8e00e55311a786 /src/common/mapindex.c
parent6f11fef3afc1a235628ff21aa2f2348abab4a97f (diff)
downloadhercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.gz
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.bz2
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.tar.xz
hercules-ed39bb7197c749c28f1de75a4219329465b0fa08.zip
Mapcache update, should polish off remaining bugs
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10003 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/mapindex.c')
-rw-r--r--src/common/mapindex.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 01489ce93..439075b99 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -20,11 +20,11 @@ struct indexes {
static unsigned short max_index = 0;
-char mapindex_cfgfile[80] = "db/map_index.txt";
+char mapindex_cfgfile[80] = "db/map_list.txt";
/// Adds a map to the specified index
/// Returns 1 if successful, 0 oherwise
-static int mapindex_addmap(int index, const char *name)
+int mapindex_addmap(int index, const char *name)
{
char map_name[1024];
char *ext;
@@ -41,25 +41,13 @@ static int mapindex_addmap(int index, const char *name)
ShowError("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
return 0;
}
- if ((ext = strstr(map_name, ".gat")) != NULL) { //Gat map
+ if ((ext = strstr(map_name, ".")) != NULL) { // Remove extension
length = ext-map_name;
- } else if ((ext = strstr(map_name, ".afm")) != NULL || (ext = strstr(map_name, ".af2")) != NULL) { //afm map
- length = ext-map_name;
- sprintf(ext, ".gat"); //Change the extension to gat
- } else if ((ext = strstr(map_name, ".")) != NULL) { //Generic extension?
- length = ext-map_name;
- sprintf(ext, ".gat");
- } else { //No extension?
- length = strlen(map_name);
- strcat(map_name, ".gat");
- }
- if (length > MAP_NAME_LENGTH - 4) {
- ShowError("(mapindex_add) Adjusted Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
- return 0;
+ sprintf(ext, "\0");
}
if (indexes[index].length)
- ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", indexes[index].name, map_name);
+ ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);
strncpy(indexes[index].name, map_name, MAP_NAME_LENGTH);
indexes[index].length = length;
@@ -77,7 +65,7 @@ unsigned short mapindex_name2id(const char* name) {
length = ext-name; //Base map-name length without the extension.
for (i = 1; i < max_index; i++)
{
- if (indexes[i].length == length && strncmp(indexes[i].name,name,length)==0)
+ if (strncmp(indexes[i].name,name,length)==0)
return i;
}
#ifdef MAPINDEX_AUTOADD