diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-26 00:12:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-06 16:22:40 +0300 |
commit | 0147ed8a48a7f01d0619dec3eb2813b879f1dee7 (patch) | |
tree | af90f12ec9e9c64070fb8eae9d5b2fc35ed2912a /src | |
parent | 867ca32885a67fa69a00a3814ba33208274e81ba (diff) | |
download | hercules-0147ed8a48a7f01d0619dec3eb2813b879f1dee7.tar.gz hercules-0147ed8a48a7f01d0619dec3eb2813b879f1dee7.tar.bz2 hercules-0147ed8a48a7f01d0619dec3eb2813b879f1dee7.tar.xz hercules-0147ed8a48a7f01d0619dec3eb2813b879f1dee7.zip |
into mapindex add variable with default map and position.
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 12 | ||||
-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, 20 insertions, 11 deletions
diff --git a/src/char/char.c b/src/char/char.c index d3b18cfa6..fec953a7a 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"); 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)); |