summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c93
1 files changed, 14 insertions, 79 deletions
diff --git a/src/map/map.c b/src/map/map.c
index fe0922063..cd2ba17c2 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -48,7 +48,7 @@
#include "common/core.h"
#include "common/ers.h"
#include "common/grfio.h"
-#include "common/malloc.h"
+#include "common/memmgr.h"
#include "common/nullpo.h"
#include "common/random.h"
#include "common/showmsg.h"
@@ -3239,16 +3239,7 @@ void do_final_maps(void) {
if( map->list[i].qi_data )
aFree(map->list[i].qi_data);
- if( map->list[i].hdata )
- {
- for( v = 0; v < map->list[i].hdatac; v++ ) {
- if( map->list[i].hdata[v]->flag.free ) {
- aFree(map->list[i].hdata[v]->data);
- }
- aFree(map->list[i].hdata[v]);
- }
- aFree(map->list[i].hdata);
- }
+ HPM->data_store_destroy(&map->list[i].hdata);
}
map->zone_db_clear();
@@ -3711,21 +3702,8 @@ int inter_config_read(char *cfgName) {
if (sscanf(line,"%1023[^:]: %1023[^\r\n]", w1, w2) < 2)
continue;
- /* table names */
- if(strcmpi(w1,"item_db_db")==0)
- safestrncpy(map->item_db_db, w2, sizeof(map->item_db_db));
- else if(strcmpi(w1,"mob_db_db")==0)
- safestrncpy(map->mob_db_db, w2, sizeof(map->mob_db_db));
- else if(strcmpi(w1,"item_db2_db")==0)
- safestrncpy(map->item_db2_db, w2, sizeof(map->item_db2_db));
- else if(strcmpi(w1,"mob_db2_db")==0)
- safestrncpy(map->mob_db2_db, w2, sizeof(map->mob_db2_db));
- else if(strcmpi(w1, "mob_skill_db_db") == 0)
- safestrncpy(map->mob_skill_db_db, w2, sizeof(map->mob_skill_db_db));
- else if(strcmpi(w1,"mob_skill_db2_db")==0)
- safestrncpy(map->mob_skill_db2_db, w2, sizeof(map->mob_skill_db2_db));
/* map sql stuff */
- else if(strcmpi(w1,"map_server_ip")==0)
+ if(strcmpi(w1,"map_server_ip")==0)
safestrncpy(map->server_ip, w2, sizeof(map->server_ip));
else if(strcmpi(w1,"map_server_port")==0)
map->server_port=atoi(w2);
@@ -3737,42 +3715,6 @@ int inter_config_read(char *cfgName) {
safestrncpy(map->server_db, w2, sizeof(map->server_db));
else if(strcmpi(w1,"default_codepage")==0)
safestrncpy(map->default_codepage, w2, sizeof(map->default_codepage));
- else if(strcmpi(w1,"use_sql_item_db")==0) {
- map->db_use_sql_item_db = config_switch(w2);
- ShowStatus ("Using item database as SQL: '%s'\n", w2);
- if (map->db_use_sql_item_db) {
- // Deprecated 2015-08-09 [Haru]
- ShowWarning("Support for the SQL item database is deprecated and it will removed in future versions. "
- "Please upgrade to the non-sql version as soon as possible. "
- "Bug reports or pull requests concerning the SQL item database are no longer accepted.\n");
- ShowInfo("Resuming in 10 seconds...\n");
- HSleep(10);
- }
- }
- else if(strcmpi(w1,"use_sql_mob_db")==0) {
- map->db_use_sql_mob_db = config_switch(w2);
- ShowStatus ("Using monster database as SQL: '%s'\n", w2);
- if (map->db_use_sql_mob_db) {
- // Deprecated 2015-08-09 [Haru]
- ShowWarning("Support for the SQL monster database is deprecated and it will removed in future versions. "
- "Please upgrade to the non-sql version as soon as possible. "
- "Bug reports or pull requests concerning the SQL monster database are no longer accepted.\n");
- ShowInfo("Resuming in 10 seconds...\n");
- HSleep(10);
- }
- }
- else if(strcmpi(w1,"use_sql_mob_skill_db")==0) {
- map->db_use_sql_mob_skill_db = config_switch(w2);
- ShowStatus ("Using monster skill database as SQL: '%s'\n", w2);
- if (map->db_use_sql_mob_skill_db) {
- // Deprecated 2015-08-09 [Haru]
- ShowWarning("Support for the SQL monster skill database is deprecated and it will removed in future versions. "
- "Please upgrade to the non-sql version as soon as possible. "
- "Bug reports or pull requests concerning the SQL monster skill database are no longer accepted.\n");
- ShowInfo("Resuming in 10 seconds...\n");
- HSleep(10);
- }
- }
else if(strcmpi(w1,"autotrade_merchants_db")==0)
safestrncpy(map->autotrade_merchants_db, w2, sizeof(map->autotrade_merchants_db));
else if(strcmpi(w1,"autotrade_data_db")==0)
@@ -3854,6 +3796,7 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone
CREATE(zone, struct map_zone_data, 1);
safestrncpy(zone->name, newzone, MAP_ZONE_NAME_LENGTH);
+ zone->merge_type = MZMT_NEVERMERGE;
zone->disabled_skills_count = main->disabled_skills_count + other->disabled_skills_count;
zone->disabled_items_count = main->disabled_items_count + other->disabled_items_count;
zone->mapflags_count = main->mapflags_count + other->mapflags_count;
@@ -3930,7 +3873,7 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone
memcpy(zone->capped_skills[cursor], other->capped_skills[i], sizeof(struct map_zone_skill_damage_cap_entry));
}
- zone->info.special = 2;
+ zone->info.merged = 1;
strdb_put(map->zone_db, newzone, zone);
return zone;
}
@@ -3941,13 +3884,13 @@ void map_zone_change2(int m, struct map_zone_data *zone) {
if( map->list[m].zone == zone )
return;
- if( map->list[m].zone->info.special != 2 ) /* we don't update it for merged zones! */
+ if( !map->list[m].zone->info.merged ) /* we don't update it for merged zones! */
map->list[m].prev_zone = map->list[m].zone;
if( map->list[m].zone_mf_count )
map->zone_remove(m);
- if( zone->info.special ) {
+ if( zone->merge_type == MZMT_MERGEABLE && map->list[m].prev_zone->merge_type != MZMT_NEVERMERGE ) {
zone = map->merge_zone(zone,map->list[m].prev_zone);
}
@@ -4899,12 +4842,15 @@ void read_map_zone_db(void) {
/* is this the global template? */
if( strncmpi(zonename,MAP_ZONE_NORMAL_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map->zone_all;
+ zone->merge_type = MZMT_NEVERMERGE;
is_all = true;
} else if( strncmpi(zonename,MAP_ZONE_PK_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map->zone_pk;
+ zone->merge_type = MZMT_NEVERMERGE;
is_all = true;
} else {
CREATE( zone, struct map_zone_data, 1 );
+ zone->merge_type = MZMT_NORMAL;
zone->disabled_skills_count = 0;
zone->disabled_items_count = 0;
}
@@ -5257,11 +5203,11 @@ void read_map_zone_db(void) {
/* post-load processing */
if( (zone = strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)) )
- zone->info.special = 1;
+ zone->merge_type = MZMT_MERGEABLE;
if( (zone = strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)) )
- zone->info.special = 1;
+ zone->merge_type = MZMT_MERGEABLE;
if( (zone = strdb_get(map->zone_db, MAP_ZONE_BG_NAME)) )
- zone->info.special = 1;
+ zone->merge_type = MZMT_MERGEABLE;
}
/* not supposed to go in here but in skill_final whatever */
libconfig->destroy(&map_zone_db);
@@ -5879,7 +5825,7 @@ int do_init(int argc, char *argv[])
map->nick_db = idb_alloc(DB_OPT_BASE);
map->charid_db = idb_alloc(DB_OPT_BASE);
map->regen_db = idb_alloc(DB_OPT_BASE); // efficient status_natural_heal processing
- map->iwall_db = strdb_alloc(DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1); // [Zephyrus] Invisible Walls
+ map->iwall_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, 2*NAME_LENGTH+2+1); // [Zephyrus] Invisible Walls
map->zone_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAP_ZONE_NAME_LENGTH);
map->iterator_ers = ers_new(sizeof(struct s_mapiterator),"map.c::map_iterator_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK);
@@ -6024,17 +5970,6 @@ void map_defaults(void) {
map->night_flag = 0; // 0=day, 1=night [Yor]
map->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex]
- map->db_use_sql_item_db = 0;
- map->db_use_sql_mob_db = 0;
- map->db_use_sql_mob_skill_db = 0;
-
- sprintf(map->item_db_db, "item_db");
- sprintf(map->item_db2_db, "item_db2");
- sprintf(map->mob_db_db, "mob_db");
- sprintf(map->mob_db2_db, "mob_db2");
- sprintf(map->mob_skill_db_db, "mob_skill_db");
- sprintf(map->mob_skill_db2_db, "mob_skill_db2");
-
map->INTER_CONF_NAME="conf/inter-server.conf";
map->LOG_CONF_NAME="conf/logs.conf";
map->MAP_CONF_NAME = "conf/map-server.conf";