diff options
-rw-r--r-- | src/map/chrif.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 34 | ||||
-rw-r--r-- | src/map/map.h | 2 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index d11604bc3..bc5392b22 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -140,7 +140,7 @@ int chrif_sendmap(int fd) WFIFOW(fd,0) = 0x2afa; for(i = 0; i < map_num; i++) - if (map[i].alias[0] != '\0') // [MouseJstr] map aliasing + if (map[i].alias != '\0') // [MouseJstr] map aliasing memcpy(WFIFOP(fd,4+i*16), map[i].alias, 16); else memcpy(WFIFOP(fd,4+i*16), map[i].name, 16); diff --git a/src/map/map.c b/src/map/map.c index ebdc2a8c5..fe949013c 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1582,7 +1582,8 @@ static int map_readmap(int m,char *fn, char *alias) { map[m].npc_num=0; map[m].users=0; memset(&map[m].flag,0,sizeof(map[m].flag)); - if(battle_config.pk_mode) map[m].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris] + if(battle_config.pk_mode) + map[m].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris] wh=map_waterheight(map[m].name); for(y=0;y<ys;y++){ p=(struct gat_1cell*)(gat+y*xs*20+14); @@ -1606,6 +1607,9 @@ static int map_readmap(int m,char *fn, char *alias) { size = map[m].bxs*map[m].bys*sizeof(int); map[m].block_count = (int *)aCalloc(1,size); map[m].block_mob_count=(int *)aCalloc(1,size); + if (alias) + strdb_insert(map_db,alias,&map[m]); + else strdb_insert(map_db,map[m].name,&map[m]); // printf("%s read done\n",fn); @@ -1635,23 +1639,19 @@ int map_readallmap(void) { fclose(afm_file); } else if(strstr(map[i].name,".gat")!=NULL) { - char *p = strstr(map[i].name, ">"); // [MouseJstr] + char *p = strstr(map[i].name, "<"); // [MouseJstr] if (p != NULL) { - char alias[64]; - *p = '\0'; - strcpy(alias, map[i].name); - strcpy(map[i].name, p + 1); - sprintf(fn,"data\\%s",map[i].name); - if(map_readmap(i,fn, alias) == -1) { - map_delmap(map[i].name); - maps_removed++; - } - } else { - sprintf(fn,"data\\%s",map[i].name); - if(map_readmap(i,fn, NULL) == -1) { - map_delmap(map[i].name); - maps_removed++; - } + char buf[64]; + *p++ = '\0'; + sprintf(buf,"data\\%s", p); + map[i].alias = strdup(buf); + } else + map[i].alias = NULL; + + sprintf(fn,"data\\%s",map[i].name); + if(map_readmap(i,fn, p) == -1) { + map_delmap(map[i].name); + maps_removed++; } } } diff --git a/src/map/map.h b/src/map/map.h index 60f4ce9d6..6684250e5 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -482,7 +482,7 @@ enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // 囲まれペナルティ計算用 struct map_data { char name[24]; - char alias[24]; // [MouseJstr] + char *alias; // [MouseJstr] unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う struct block_list **block; struct block_list **block_mob; |