summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-14 21:12:18 -0200
committershennetsind <ind@henn.et>2013-02-14 21:12:18 -0200
commit7d33212f95653edd621961487f5622611d62ae88 (patch)
treeb992a814eeefc27de512231c5bf5eaf0c2efa111 /src/map/map.c
parent82005a99f5b1cca68e9fb1ac6b1614c815e4bd45 (diff)
downloadhercules-7d33212f95653edd621961487f5622611d62ae88.tar.gz
hercules-7d33212f95653edd621961487f5622611d62ae88.tar.bz2
hercules-7d33212f95653edd621961487f5622611d62ae88.tar.xz
hercules-7d33212f95653edd621961487f5622611d62ae88.zip
New Mapflag adjust_unit_duration
Made as a improvement of the original ADJUST_TRAP_DURATION -- special thanks to Muad_Dib! . This mapflag allows you to control the duration of unit skills in any map, for example. "prontera mapflag adjust_unit_duration PR_SANCTUARY 50" halves the duration of sanctuary in prontera Another Example: "prontera mapflag adjust_unit_duration WZ_QUAGMIRE 250" Increases duration of quagmire by 2.5 times in prontera map. Be aware that some skill units have their visual effect durations not controlled by the server (e.g. storm gust). Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/src/map/map.c b/src/map/map.c
index a42d7abca..1ffffdf59 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2894,13 +2894,41 @@ int map_delmap(char* mapname)
return 0;
}
+void map_data_clean(void) {
+ int i;
+
+ for( i = 0; i < map_num; i++ ) {
+
+ if(map[i].cell) aFree(map[i].cell);
+ if(map[i].block) aFree(map[i].block);
+ if(map[i].block_mob) aFree(map[i].block_mob);
+
+ if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
+ int j;
+ if(map[i].mob_delete_timer != INVALID_TIMER)
+ delete_timer(map[i].mob_delete_timer, map_removemobs_timer);
+ for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
+ if (map[i].moblist[j]) aFree(map[i].moblist[j]);
+ }
+
+ if( map[i].unit_count ) {
+ int v;
+ for(v = 0; v < map[i].unit_count; v++) {
+ aFree(map[i].units[v]);
+ }
+ aFree(map[i].units);
+ map[i].unit_count = 0;
+ }
+
+ }
+
+}
+
/// Initializes map flags and adjusts them depending on configuration.
-void map_flags_init(void)
-{
+void map_flags_init(void) {
int i;
- for( i = 0; i < map_num; i++ )
- {
+ for( i = 0; i < map_num; i++ ) {
// mapflags
memset(&map[i].flag, 0, sizeof(map[i].flag));
@@ -2911,6 +2939,15 @@ void map_flags_init(void)
map[i].jexp = 100; // per map job exp multiplicator
memset(map[i].drop_list, 0, sizeof(map[i].drop_list)); // pvp nightmare drop list
+ if( map[i].unit_count ) {
+ int v;
+ for(v = 0; v < map[i].unit_count; v++) {
+ aFree(map[i].units[v]);
+ }
+ aFree(map[i].units);
+ map[i].unit_count = 0;
+ }
+
// adjustments
if( battle_config.pk_mode )
map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
@@ -3552,7 +3589,7 @@ static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
*------------------------------------------*/
void do_final(void)
{
- int i, j;
+ int i;
struct map_session_data* sd;
struct s_mapiterator* iter;
@@ -3603,18 +3640,8 @@ void do_final(void)
map_db->destroy(map_db, map_db_final);
- for (i=0; i<map_num; i++) {
- if(map[i].cell) aFree(map[i].cell);
- if(map[i].block) aFree(map[i].block);
- if(map[i].block_mob) aFree(map[i].block_mob);
- if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
- if(map[i].mob_delete_timer != INVALID_TIMER)
- delete_timer(map[i].mob_delete_timer, map_removemobs_timer);
- for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
- if (map[i].moblist[j]) aFree(map[i].moblist[j]);
- }
- }
-
+ map_data_clean();
+
mapindex_final();
if(enable_grf)
grfio_final();