summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-27 18:17:24 +0100
committerHaru <haru@dotalux.com>2016-01-06 15:14:49 +0100
commitb3c722ecf777aeeea6317755a6adfc0216b7a2bd (patch)
treec3692ea61faa21307265d7b3e4a09d38854a8d71 /src/map/npc.c
parentaa574e36fea903b9aea31ea6f52855498d9476a9 (diff)
downloadhercules-b3c722ecf777aeeea6317755a6adfc0216b7a2bd.tar.gz
hercules-b3c722ecf777aeeea6317755a6adfc0216b7a2bd.tar.bz2
hercules-b3c722ecf777aeeea6317755a6adfc0216b7a2bd.tar.xz
hercules-b3c722ecf777aeeea6317755a6adfc0216b7a2bd.zip
Replaced some explicit casts with BL_UCAST/BL_UCCAST
- Replaced the map-iterator related casts. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 8dd27389f..fc4abb5fa 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1630,7 +1630,7 @@ void npc_trader_update(int master) {
CREATE(master_nd->u.scr.shop,struct npc_shop_data,1);
iter = db_iterator(map->id_db);
- for( bl = (struct block_list*)dbi_first(iter); dbi_exists(iter); bl = (struct block_list*)dbi_next(iter) ) {
+ for (bl = dbi_first(iter); dbi_exists(iter); bl = dbi_next(iter)) {
if( bl->type == BL_NPC ) {
struct npc_data* nd = (struct npc_data*)bl;
@@ -2286,7 +2286,7 @@ int npc_unload(struct npc_data* nd, bool single)
aFree(nd->u.shop.shop_item);
else if( nd->subtype == SCRIPT ) {
struct s_mapiterator* iter;
- struct block_list* bl;
+ struct map_session_data *sd = NULL;
if( single ) {
npc->ev_db->foreach(npc->ev_db,npc->unload_ev,nd->exname); //Clean up all events related
@@ -2294,8 +2294,7 @@ int npc_unload(struct npc_data* nd, bool single)
}
iter = mapit_geteachpc();
- for( bl = (struct block_list*)mapit->first(iter); mapit->exists(iter); bl = (struct block_list*)mapit->next(iter) ) {
- struct map_session_data *sd = (struct map_session_data *)bl;
+ for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
if( sd && sd->npc_timer_id != INVALID_TIMER ) {
const struct TimerData *td = timer->get(sd->npc_timer_id);
@@ -4662,7 +4661,7 @@ int npc_reload(void) {
//Remove all npcs/mobs. [Skotlex]
iter = mapit_geteachiddb();
- for( bl = (struct block_list*)mapit->first(iter); mapit->exists(iter); bl = (struct block_list*)mapit->next(iter) ) {
+ for (bl = mapit->first(iter); mapit->exists(iter); bl = mapit->next(iter)) {
switch(bl->type) {
case BL_NPC:
if( bl->id != npc->fake_nd->bl.id )// don't remove fake_nd