summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 36efd6614..87b4377ef 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -525,6 +525,7 @@ short mob_barricade_build(short m, short x, short y, short count, short dir, boo
barricade->m = m;
safestrncpy(barricade->npc_event, event, sizeof(barricade->npc_event));
barricade->amount = 0;
+ barricade->killable = killable;
ShowInfo("New Barricade: %s.\n", barricade->npc_event);
@@ -544,8 +545,8 @@ short mob_barricade_build(short m, short x, short y, short count, short dir, boo
md->barricade = barricade;
}
- map_setgatcell(m, x1, y1, 5);
- clif_changemapcell(0, m, x1, y1, 5, ALL_SAMEMAP);
+ map_setgatcell(m, x1, y1, (killable ? 5 : 1));
+ clif_changemapcell(0, m, x1, y1, (killable ? 5 : 1), ALL_SAMEMAP);
}
barricade->count = i;
@@ -557,7 +558,7 @@ short mob_barricade_build(short m, short x, short y, short count, short dir, boo
}
void mob_barricade_get(struct map_session_data *sd)
-{
+{ // Update Barricade cell in client - Required only on changemap
struct barricade_data *barricade;
DBIterator* iter;
DBKey key;
@@ -577,7 +578,7 @@ void mob_barricade_get(struct map_session_data *sd)
{
x1 = barricade->dir ? barricade->x + i : barricade->x;
y1 = barricade->dir ? barricade->y : barricade->y + i;
- clif_changemapcell(sd->fd, barricade->m, x1, y1, 5, SELF);
+ clif_changemapcell(sd->fd, barricade->m, x1, y1, (barricade->killable ? 5 : 1), SELF);
}
}
iter->destroy(iter);
@@ -631,6 +632,31 @@ void mob_barricade_destroy(short m, const char *event)
map_foreachinmap(mob_barricade_destroy_sub, m, BL_MOB, event, 0);
}
+void mod_barricade_clearall(void)
+{
+ struct barricade_data *barricade;
+ DBIterator* iter;
+ DBKey key;
+ short x1, y1;
+ int i;
+
+ iter = barricade_db->iterator(barricade_db);
+ for( barricade = iter->first(iter,&key); iter->exists(iter); barricade = iter->next(iter,&key) )
+ {
+ for( i = 0; i < barricade->count; i++ )
+ {
+ x1 = barricade->dir ? barricade->x + i : barricade->x;
+ y1 = barricade->dir ? barricade->y : barricade->y + i;
+
+ map_setgatcell(barricade->m, x1, y1, 0);
+ clif_changemapcell(0, barricade->m, x1, y1, 0, ALL_SAMEMAP);
+ }
+ }
+ iter->destroy(iter);
+
+ barricade_db->clear(barricade_db, NULL);
+}
+
/*==========================================
* Set a Guardian's guild data [Skotlex]
*------------------------------------------*/