fix crash

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@455 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
amber 2004-12-05 06:30:50 +00:00
parent 804fe60f9b
commit ba9ef1f2ca
3 changed files with 19 additions and 19 deletions

View File

@ -140,7 +140,7 @@ int chrif_sendmap(int fd)
WFIFOW(fd,0) = 0x2afa; WFIFOW(fd,0) = 0x2afa;
for(i = 0; i < map_num; i++) 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); memcpy(WFIFOP(fd,4+i*16), map[i].alias, 16);
else else
memcpy(WFIFOP(fd,4+i*16), map[i].name, 16); memcpy(WFIFOP(fd,4+i*16), map[i].name, 16);

View File

@ -1582,7 +1582,8 @@ static int map_readmap(int m,char *fn, char *alias) {
map[m].npc_num=0; map[m].npc_num=0;
map[m].users=0; map[m].users=0;
memset(&map[m].flag,0,sizeof(map[m].flag)); 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); wh=map_waterheight(map[m].name);
for(y=0;y<ys;y++){ for(y=0;y<ys;y++){
p=(struct gat_1cell*)(gat+y*xs*20+14); 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); size = map[m].bxs*map[m].bys*sizeof(int);
map[m].block_count = (int *)aCalloc(1,size); map[m].block_count = (int *)aCalloc(1,size);
map[m].block_mob_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]); strdb_insert(map_db,map[m].name,&map[m]);
// printf("%s read done\n",fn); // printf("%s read done\n",fn);
@ -1635,24 +1639,20 @@ int map_readallmap(void) {
fclose(afm_file); fclose(afm_file);
} }
else if(strstr(map[i].name,".gat")!=NULL) { 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) { if (p != NULL) {
char alias[64]; char buf[64];
*p = '\0'; *p++ = '\0';
strcpy(alias, map[i].name); sprintf(buf,"data\\%s", p);
strcpy(map[i].name, p + 1); map[i].alias = strdup(buf);
} else
map[i].alias = NULL;
sprintf(fn,"data\\%s",map[i].name); sprintf(fn,"data\\%s",map[i].name);
if(map_readmap(i,fn, alias) == -1) { if(map_readmap(i,fn, p) == -1) {
map_delmap(map[i].name); map_delmap(map[i].name);
maps_removed++; maps_removed++;
} }
} else {
sprintf(fn,"data\\%s",map[i].name);
if(map_readmap(i,fn, NULL) == -1) {
map_delmap(map[i].name);
maps_removed++;
}
}
} }
} }

View File

@ -482,7 +482,7 @@ enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; //
struct map_data { struct map_data {
char name[24]; char name[24];
char alias[24]; // [MouseJstr] char *alias; // [MouseJstr]
unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う
struct block_list **block; struct block_list **block;
struct block_list **block_mob; struct block_list **block_mob;