diff options
author | Haruna <haru@dotalux.com> | 2014-12-06 18:25:14 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-12-06 18:25:14 +0100 |
commit | 738e39d33186a4ff1a620509a7c13d986ff43ecb (patch) | |
tree | e5176f3de9e227a8d76aee17c07165b1b7deccde /src | |
parent | 04d981077de4bc5d6d0cf69a946091add1dc9309 (diff) | |
parent | 2f9c0cc0c00339d2098907ad5542226b12e0f9f4 (diff) | |
download | hercules-738e39d33186a4ff1a620509a7c13d986ff43ecb.tar.gz hercules-738e39d33186a4ff1a620509a7c13d986ff43ecb.tar.bz2 hercules-738e39d33186a4ff1a620509a7c13d986ff43ecb.tar.xz hercules-738e39d33186a4ff1a620509a7c13d986ff43ecb.zip |
Merge pull request #403 from 4144/mapext
into mapindex add variable with default map and position.
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 13 | ||||
-rw-r--r-- | src/common/mapindex.c | 7 | ||||
-rw-r--r-- | src/common/mapindex.h | 6 | ||||
-rw-r--r-- | src/map/map.c | 6 |
4 files changed, 21 insertions, 11 deletions
diff --git a/src/char/char.c b/src/char/char.c index d3b18cfa6..b18beed60 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1216,15 +1216,15 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every p->save_point.map = mapindex->name2id(save_map); if( p->last_point.map == 0 ) { - p->last_point.map = (unsigned short)strdb_iget(mapindex->db, MAP_DEFAULT); - p->last_point.x = MAP_DEFAULT_X; - p->last_point.y = MAP_DEFAULT_Y; + p->last_point.map = (unsigned short)strdb_iget(mapindex->db, mapindex->default_map); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; } if( p->save_point.map == 0 ) { - p->save_point.map = (unsigned short)strdb_iget(mapindex->db, MAP_DEFAULT); - p->save_point.x = MAP_DEFAULT_X; - p->save_point.y = MAP_DEFAULT_Y; + p->save_point.map = (unsigned short)strdb_iget(mapindex->db, mapindex->default_map); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; } strcat(t_msg, " status"); @@ -5718,6 +5718,7 @@ void do_shutdown(void) } void char_hp_symbols(void) { + HPM->share(mapindex,"mapindex"); HPM->share(chr, "chr"); HPM->share(geoip, "geoip"); HPM->share(inter_auction, "inter_auction"); diff --git a/src/common/mapindex.c b/src/common/mapindex.c index e00fc107d..0d8a69726 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -172,8 +172,8 @@ int mapindex_init(void) { bool mapindex_check_default(void) { - if (!strdb_iget(mapindex->db, MAP_DEFAULT)) { - ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n",MAP_DEFAULT); + if (!strdb_iget(mapindex->db, mapindex->default_map)) { + ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n", mapindex->default_map); return false; } return true; @@ -196,6 +196,9 @@ void mapindex_defaults(void) { /* */ mapindex->db = NULL; mapindex->num = 0; + mapindex->default_map = MAP_DEFAULT; + mapindex->default_x = MAP_DEFAULT_X; + mapindex->default_y = MAP_DEFAULT_Y; memset (&mapindex->list, 0, sizeof (mapindex->list)); /* */ diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 53d08f8e6..91bf4562e 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -67,6 +67,12 @@ struct mapindex_interface { DBMap *db; /* number of entries in the index table */ int num; + /* default map name */ + char *default_map; + /* default x on map */ + int default_x; + /* default y on map */ + int default_y; /* index list -- since map server map count is *unlimited* this should be too */ struct { char name[MAP_NAME_LENGTH]; diff --git a/src/map/map.c b/src/map/map.c index c379911d3..3cb4de5c8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5581,9 +5581,9 @@ void map_cp_defaults(void) { /* default HCP data */ map->cpsd = pc->get_dummy_sd(); strcpy(map->cpsd->status.name, "Hercules Console"); - map->cpsd->bl.x = MAP_DEFAULT_X; - map->cpsd->bl.y = MAP_DEFAULT_Y; - map->cpsd->bl.m = map->mapname2mapid(MAP_DEFAULT); + map->cpsd->bl.x = mapindex->default_x; + map->cpsd->bl.y = mapindex->default_y; + map->cpsd->bl.m = map->mapname2mapid(mapindex->default_map); console->input->addCommand("gm:info",CPCMD_A(gm_position)); console->input->addCommand("gm:use",CPCMD_A(gm_use)); |