summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2015-12-26 11:17:14 +0200
committerHaru <haru@dotalux.com>2016-01-06 15:14:43 +0100
commit3007a376242f00d8127e39e9e6a89c7e0e5a8b20 (patch)
tree94250ac801d65c7fdc7b979b98e9c86955ff4f0e
parent1f71f41ee0fdf23680b40ba3d5bd63629e87c3e2 (diff)
downloadhercules-3007a376242f00d8127e39e9e6a89c7e0e5a8b20.tar.gz
hercules-3007a376242f00d8127e39e9e6a89c7e0e5a8b20.tar.bz2
hercules-3007a376242f00d8127e39e9e6a89c7e0e5a8b20.tar.xz
hercules-3007a376242f00d8127e39e9e6a89c7e0e5a8b20.zip
Change all TBL_NPC to struct npc_data as per style guidelines
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/clif.c78
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/script.c75
-rw-r--r--src/map/skill.c5
-rw-r--r--src/map/status.c36
-rw-r--r--src/map/unit.c4
8 files changed, 110 insertions, 106 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index a2fbca41e..b1f901386 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -947,7 +947,7 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1014,7 +1014,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1096,7 +1096,7 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) {
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
p.head = vd->hair_style;
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
@@ -1154,7 +1154,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1248,7 +1248,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1407,11 +1407,11 @@ bool clif_spawn(struct block_list *bl)
if( !vd )
return false;
- if( ( bl->type == BL_NPC
- && !((TBL_NPC*)bl)->chat_id
- && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE) ) // Hide NPC from maya purple card.
- || ( vd->class_ == INVISIBLE_CLASS )
- )
+ if ((bl->type == BL_NPC
+ && ((struct npc_data *)bl)->chat_id == 0
+ && (((struct npc_data *)bl)->option&OPTION_INVISIBLE)) // Hide NPC from maya purple card.
+ || vd->class_ == INVISIBLE_CLASS
+ )
return true; // Doesn't need to be spawned, so everything is alright
clif->spawn_unit(bl,AREA_WOS);
@@ -1453,13 +1453,13 @@ bool clif_spawn(struct block_list *bl)
}
break;
case BL_NPC:
- {
- TBL_NPC *nd = ((TBL_NPC*)bl);
- if( nd->size == SZ_BIG )
- clif->specialeffect(&nd->bl,423,AREA);
- else if( nd->size == SZ_MEDIUM )
- clif->specialeffect(&nd->bl,421,AREA);
- }
+ {
+ struct npc_data *nd = ((struct npc_data *)bl);
+ if (nd->size == SZ_BIG)
+ clif->specialeffect(&nd->bl,423,AREA);
+ else if (nd->size == SZ_MEDIUM)
+ clif->specialeffect(&nd->bl,421,AREA);
+ }
break;
case BL_PET:
if (vd->head_bottom)
@@ -1739,7 +1739,7 @@ void clif_move(struct unit_data *ud)
/**
* Hide NPC from maya purple card.
**/
- if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE))
+ if (bl->type == BL_NPC && ((struct npc_data *)bl)->chat_id == 0 && (((struct npc_data *)bl)->option&OPTION_INVISIBLE))
return;
if (ud->state.speed_changed) {
@@ -3492,7 +3492,7 @@ void clif_changeoption(struct block_list* bl)
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
- WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ WBUFL(buf,10) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
WBUFB(buf,14) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x229),bl,AREA_WOS);
@@ -3508,7 +3508,7 @@ void clif_changeoption(struct block_list* bl)
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
- WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ WBUFL(buf,10) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
WBUFB(buf,12) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x119),bl,AREA_WOS);
@@ -3533,7 +3533,7 @@ void clif_changeoption2(struct block_list* bl) {
WBUFW(buf,0) = 0x28a;
WBUFL(buf,2) = bl->id;
- WBUFL(buf,6) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ WBUFL(buf,6) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? ((struct npc_data *)bl)->option : 0);
WBUFL(buf,10) = clif_setlevel(bl);
WBUFL(buf,14) = (sc) ? sc->opt3 : 0;
if(disguised(bl)) {
@@ -4168,7 +4168,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
/**
* Hide NPC from maya purple card.
**/
- if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE))
+ if (bl->type == BL_NPC && ((struct npc_data *)bl)->chat_id == 0 && (((struct npc_data *)bl)->option&OPTION_INVISIBLE))
return;
if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != INVALID_TIMER )
@@ -4201,15 +4201,15 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
clif->devotion(bl, sd);
break;
case BL_NPC:
- {
- TBL_NPC* nd = (TBL_NPC*)bl;
- if( nd->chat_id )
- clif->dispchat((struct chat_data*)map->id2bl(nd->chat_id),sd->fd);
- if( nd->size == SZ_BIG )
- clif->specialeffect_single(bl,423,sd->fd);
- else if( nd->size == SZ_MEDIUM )
- clif->specialeffect_single(bl,421,sd->fd);
- }
+ {
+ struct npc_data *nd = (struct npc_data *)bl;
+ if (nd->chat_id != 0)
+ clif->dispchat((struct chat_data *)map->id2bl(nd->chat_id),sd->fd);
+ if (nd->size == SZ_BIG)
+ clif->specialeffect_single(bl,423,sd->fd);
+ else if (nd->size == SZ_MEDIUM)
+ clif->specialeffect_single(bl,421,sd->fd);
+ }
break;
case BL_MOB:
{
@@ -4635,7 +4635,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
clif->clearchar_skillunit((struct skill_unit *)bl,tsd->fd);
break;
case BL_NPC:
- if( !(((TBL_NPC*)bl)->option&OPTION_INVISIBLE) )
+ if (!(((struct npc_data *)bl)->option&OPTION_INVISIBLE))
clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
break;
default:
@@ -4646,10 +4646,10 @@ int clif_outsight(struct block_list *bl,va_list ap)
}
if (sd && sd->fd) { //sd is watching tbl go out of view.
nullpo_ret(tbl);
- if(tbl->type == BL_SKILL) //Trap knocked out of sight
+ if (tbl->type == BL_SKILL) //Trap knocked out of sight
clif->clearchar_skillunit((struct skill_unit *)tbl,sd->fd);
- else if (((vd=status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) &&
- !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->option&OPTION_INVISIBLE)))
+ else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS
+ && !(tbl->type == BL_NPC && (((struct npc_data *)tbl)->option&OPTION_INVISIBLE)))
clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd);
}
return 0;
@@ -8418,7 +8418,7 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), ((struct pet_data *)bl)->pet.name, NAME_LENGTH);
break;
case BL_NPC:
- memcpy(WBUFP(buf,6), ((TBL_NPC*)bl)->name, NAME_LENGTH);
+ memcpy(WBUFP(buf,6), ((struct npc_data *)bl)->name, NAME_LENGTH);
break;
case BL_MOB:
{
@@ -10001,7 +10001,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
case 0x00: // once attack
case 0x07: // continuous attack
if( (target = map->id2bl(target_id)) && target->type == BL_NPC ) {
- npc->click(sd,(TBL_NPC*)target);
+ npc->click(sd, (struct npc_data *)target);
return;
}
@@ -10488,7 +10488,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
break;
}
if( bl->m != -1 )// the user can't click floating npcs directly (hack attempt)
- npc->click(sd,(TBL_NPC*)bl);
+ npc->click(sd, (struct npc_data *)bl);
break;
}
}
@@ -11368,7 +11368,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd)
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer != INVALID_TIMER ) {
#endif
- TBL_NPC* nd = map->id2nd(npc_id);
+ struct npc_data *nd = map->id2nd(npc_id);
ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name);
clif->GM_kick(NULL,sd);
#ifdef SECURE_NPCTIMEOUT
diff --git a/src/map/map.c b/src/map/map.c
index f5b8618cc..a40ceebd0 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -332,8 +332,9 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) {
if (sc && sc->data[SC_PROPERTYWALK] &&
sc->data[SC_PROPERTYWALK]->val3 >= skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) )
status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER);
- } else if (bl->type == BL_NPC)
- npc->unsetcells((TBL_NPC*)bl);
+ } else if (bl->type == BL_NPC) {
+ npc->unsetcells((struct npc_data *)bl);
+ }
if (moveblock) map->delblock(bl);
#ifdef CELL_NOSTACK
@@ -403,8 +404,9 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) {
skill->unit_move_unit_group(skill->id2group(sc->data[SC_HAWKEYES]->val4), bl->m, x1-x0, y1-y0);
}
}
- } else if (bl->type == BL_NPC)
- npc->setcells((TBL_NPC*)bl);
+ } else if (bl->type == BL_NPC) {
+ npc->setcells((struct npc_data *)bl);
+ }
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index e4eb00431..f52918d23 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1184,7 +1184,7 @@ int mob_warpchase_sub(struct block_list *bl,va_list ap) {
target_nd= va_arg(ap, struct npc_data**);
min_distance= va_arg(ap, int*);
- nd = (TBL_NPC*) bl;
+ nd = (struct npc_data *)bl;
if(nd->subtype != WARP)
return 0; //Not a warp
diff --git a/src/map/npc.c b/src/map/npc.c
index c4ed896a9..8dd27389f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1171,7 +1171,7 @@ struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* b
nullpo_retr(NULL, sd);
if (bl == NULL) return NULL;
if (bl->type != BL_NPC) return NULL;
- nd = (TBL_NPC*)bl;
+ nd = (struct npc_data *)bl;
if (sd->npc_id == bl->id)
return nd;
@@ -1296,8 +1296,8 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing) {
nullpo_retr(1, sd);
if( id != sd->npc_id ){
- TBL_NPC* nd_sd=(TBL_NPC*)map->id2bl(sd->npc_id);
- TBL_NPC* nd = BL_CAST(BL_NPC, target);
+ struct npc_data *nd_sd = (struct npc_data *)map->id2bl(sd->npc_id);
+ struct npc_data *nd = BL_CAST(BL_NPC, target);
ShowDebug("npc_scriptcont: %s (sd->npc_id=%d) is not %s (id=%d).\n",
nd_sd?(char*)nd_sd->name:"'Unknown NPC'", (int)sd->npc_id,
nd?(char*)nd->name:"'Unknown NPC'", (int)id);
diff --git a/src/map/script.c b/src/map/script.c
index 66db534d7..7fc4f6b39 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8101,13 +8101,12 @@ BUILDIN(strcharinfo)
* 3 : ::str
* 4 : map name
*------------------------------------------*/
-BUILDIN(strnpcinfo) {
- TBL_NPC* nd;
+BUILDIN(strnpcinfo)
+{
int num;
char *buf,*name=NULL;
-
- nd = map->id2nd(st->oid);
- if (!nd) {
+ struct npc_data *nd = map->id2nd(st->oid);
+ if (nd == NULL) {
script_pushconststr(st, "");
return true;
}
@@ -10415,14 +10414,15 @@ int buildin_announce_sub(struct block_list *bl, va_list ap)
/* Runs item effect on attached character.
* itemeffect <item id>;
* itemeffect "<item name>"; */
-BUILDIN(itemeffect) {
- TBL_NPC *nd;
+BUILDIN(itemeffect)
+{
+ struct npc_data *nd;
struct item_data *item_data;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- nd = (TBL_NPC *)map->id2bl(sd->npc_id);
+ nd = (struct npc_data *)map->id2bl(sd->npc_id);
if( nd == NULL )
return false;
@@ -10750,8 +10750,9 @@ BUILDIN(hideonnpc)
* sc_start4 <effect_id>,<duration>,<val1>,<val2>,<val3>,<val4>{,<rate,<flag>,{<unit_id>}};
* <flag>: @see enum scstart_flag
*/
-BUILDIN(sc_start) {
- TBL_NPC * nd = map->id2nd(st->oid);
+BUILDIN(sc_start)
+{
+ struct npc_data *nd = map->id2nd(st->oid);
struct block_list* bl;
enum sc_type type;
int tick, val1, val2, val3, val4=0, rate, flag;
@@ -12001,11 +12002,12 @@ BUILDIN(emotion) {
if (sd != NULL)
clif->emotion(&sd->bl,type);
} else if( script_hasdata(st,4) ) {
- TBL_NPC *nd = npc->name2id(script_getstr(st,4));
- if(nd)
+ struct npc_data *nd = npc->name2id(script_getstr(st,4));
+ if (nd == NULL)
clif->emotion(&nd->bl,type);
- } else
+ } else {
clif->emotion(map->id2bl(st->oid),type);
+ }
return true;
}
@@ -12100,13 +12102,14 @@ BUILDIN(agitcheck2) {
/// Sets the guild_id of this npc.
///
/// flagemblem <guild_id>;
-BUILDIN(flagemblem) {
- TBL_NPC* nd;
+BUILDIN(flagemblem)
+{
+ struct npc_data *nd;
int g_id = script_getnum(st,2);
if(g_id < 0) return true;
- nd = (TBL_NPC*)map->id2nd(st->oid);
+ nd = (struct npc_data *)map->id2nd(st->oid);
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
@@ -13471,14 +13474,11 @@ BUILDIN(specialeffect) {
if(bl==NULL)
return true;
- if( script_hasdata(st,4) )
- {
- TBL_NPC *nd = npc->name2id(script_getstr(st,4));
- if(nd)
+ if (script_hasdata(st,4)) {
+ struct npc_data *nd = npc->name2id(script_getstr(st,4));
+ if (nd != NULL)
clif->specialeffect(&nd->bl, type, target);
- }
- else
- {
+ } else {
if (target == SELF) {
struct map_session_data *sd = script->rid2sd(st);
if (sd != NULL)
@@ -13557,7 +13557,7 @@ BUILDIN(atcommand)
struct block_list* bl = map->id2bl(st->oid);
memcpy(&sd->bl, bl, sizeof(struct block_list));
if (bl->type == BL_NPC)
- safestrncpy(sd->status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
+ safestrncpy(sd->status.name, ((struct npc_data *)bl)->name, NAME_LENGTH);
}
}
@@ -13784,8 +13784,9 @@ BUILDIN(__jump_zero)
/*==========================================
* movenpc [MouseJstr]
*------------------------------------------*/
-BUILDIN(movenpc) {
- TBL_NPC *nd = NULL;
+BUILDIN(movenpc)
+{
+ struct npc_data *nd = NULL;
const char *npc_name;
int x,y;
@@ -16501,7 +16502,7 @@ BUILDIN(unitwalk) {
}
if( bl->type == BL_NPC ) {
- unit->bl2ud2(bl); // ensure the ((TBL_NPC*)bl)->ud is safe to edit
+ unit->bl2ud2(bl); // ensure the ((struct npc_data*)bl)->ud is safe to edit
}
if( script_hasdata(st,4) ) {
int x = script_getnum(st,3);
@@ -16555,7 +16556,7 @@ BUILDIN(unitwarp) {
mapid = map->mapname2mapid(mapname);
if( mapid >= 0 && bl != NULL ) {
- unit->bl2ud2(bl); // ensure ((TBL_NPC*)bl)->ud is safe to edit
+ unit->bl2ud2(bl); // ensure ((struct npc_data *)bl)->ud is safe to edit
script_pushint(st, unit->warp(bl,mapid,x,y,CLR_OUTSIGHT));
} else {
script_pushint(st, 0);
@@ -16633,7 +16634,7 @@ BUILDIN(unitstop) {
bl = map->id2bl(unit_id);
if( bl != NULL ) {
- unit->bl2ud2(bl); // ensure ((TBL_NPC*)bl)->ud is safe to edit
+ unit->bl2ud2(bl); // ensure ((struct npc_data *)bl)->ud is safe to edit
unit->stop_attack(bl);
unit->stop_walking(bl, STOPWALKING_FLAG_NEXTCELL);
if( bl->type == BL_MOB )
@@ -16705,10 +16706,10 @@ BUILDIN(unitskilluseid) {
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
- if (!((TBL_NPC*)bl)->status.hp) {
- status_calc_npc(((TBL_NPC*)bl), SCO_FIRST);
+ if (((struct npc_data *)bl)->status.hp == 0) {
+ status_calc_npc((struct npc_data *)bl, SCO_FIRST);
} else {
- status_calc_npc(((TBL_NPC*)bl), SCO_NONE);
+ status_calc_npc((struct npc_data *)bl, SCO_NONE);
}
}
unit->skilluse_id(bl, target_id, skill_id, skill_lv);
@@ -16739,10 +16740,10 @@ BUILDIN(unitskillusepos) {
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
- if (!((TBL_NPC*)bl)->status.hp) {
- status_calc_npc(((TBL_NPC*)bl), SCO_FIRST);
+ if (((struct npc_data*)bl)->status.hp == 0) {
+ status_calc_npc((struct npc_data *)bl, SCO_FIRST);
} else {
- status_calc_npc(((TBL_NPC*)bl), SCO_NONE);
+ status_calc_npc((struct npc_data *)bl, SCO_NONE);
}
}
unit->skilluse_pos(bl, skill_x, skill_y, skill_id, skill_lv);
@@ -18648,8 +18649,8 @@ BUILDIN(useatcmd) {
if( st->oid ) {
struct block_list* bl = map->id2bl(st->oid);
memcpy(&sd->bl, bl, sizeof(struct block_list));
- if( bl->type == BL_NPC )
- safestrncpy(sd->status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
+ if (bl->type == BL_NPC)
+ safestrncpy(sd->status.name, ((struct npc_data *)bl)->name, NAME_LENGTH);
}
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 9f7ecc049..85de43198 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -10051,8 +10051,9 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
return 0;
}
-static int check_npc_chaospanic(struct block_list* bl, va_list args) {
- TBL_NPC* nd = (TBL_NPC*)bl;
+static int check_npc_chaospanic(struct block_list *bl, va_list args)
+{
+ struct npc_data *nd = (struct npc_data *)bl;
if( nd->option&(OPTION_HIDE|OPTION_INVISIBLE) || nd->class_ != 45 )
return 0;
diff --git a/src/map/status.c b/src/map/status.c
index 5ec4e64d0..e29e27236 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6209,7 +6209,7 @@ const char* status_get_name(struct block_list *bl) {
case BL_MOB: return ((struct mob_data *)bl)->name;
case BL_PET: return ((struct pet_data *)bl)->pet.name;
case BL_HOM: return ((struct homun_data *)bl)->homunculus.name;
- case BL_NPC: return ((TBL_NPC*)bl)->name;
+ case BL_NPC: return ((struct npc_data *)bl)->name;
}
return "Unknown";
}
@@ -6228,7 +6228,7 @@ int status_get_class(struct block_list *bl) {
case BL_PET: return ((struct pet_data *)bl)->pet.class_;
case BL_HOM: return ((struct homun_data *)bl)->homunculus.class_;
case BL_MER: return ((struct mercenary_data *)bl)->mercenary.class_;
- case BL_NPC: return ((TBL_NPC*)bl)->class_;
+ case BL_NPC: return ((struct npc_data *)bl)->class_;
case BL_ELEM: return ((struct elemental_data *)bl)->elemental.class_;
}
return 0;
@@ -6248,7 +6248,7 @@ int status_get_lv(struct block_list *bl) {
case BL_HOM: return ((struct homun_data *)bl)->homunculus.level;
case BL_MER: return ((struct mercenary_data *)bl)->db->lv;
case BL_ELEM: return ((struct elemental_data *)bl)->db->lv;
- case BL_NPC: return ((TBL_NPC*)bl)->level;
+ case BL_NPC: return ((struct npc_data *)bl)->level;
}
return 1;
}
@@ -6277,7 +6277,7 @@ struct status_data *status_get_status_data(struct block_list *bl)
case BL_HOM: return &((struct homun_data *)bl)->battle_status;
case BL_MER: return &((struct mercenary_data *)bl)->battle_status;
case BL_ELEM: return &((struct elemental_data *)bl)->battle_status;
- case BL_NPC: return ((mob->db_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : &status->dummy);
+ case BL_NPC: return mob->db_checkid(((struct npc_data *)bl)->class_) == 0 ? &((struct npc_data *)bl)->status : &status->dummy;
default:
return &status->dummy;
}
@@ -6293,7 +6293,7 @@ struct status_data *status_get_base_status(struct block_list *bl)
case BL_HOM: return &((struct homun_data *)bl)->base_status;
case BL_MER: return &((struct mercenary_data *)bl)->base_status;
case BL_ELEM: return &((struct elemental_data *)bl)->base_status;
- case BL_NPC: return ((mob->db_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL);
+ case BL_NPC: return mob->db_checkid(((struct npc_data *)bl)->class_) == 0 ? &((struct npc_data *)bl)->status : NULL;
default:
return NULL;
}
@@ -6385,8 +6385,8 @@ int status_get_guild_id(struct block_list *bl) {
return ((struct mercenary_data *)bl)->master->status.guild_id;
break;
case BL_NPC:
- if (((TBL_NPC*)bl)->subtype == SCRIPT)
- return ((TBL_NPC*)bl)->u.scr.guild_id;
+ if (((struct npc_data *)bl)->subtype == SCRIPT)
+ return ((struct npc_data *)bl)->u.scr.guild_id;
break;
case BL_SKILL:
if (((struct skill_unit *)bl)->group != NULL)
@@ -6428,9 +6428,9 @@ int status_get_emblem_id(struct block_list *bl) {
return ((struct mercenary_data *)bl)->master->guild_emblem_id;
break;
case BL_NPC:
- if (((TBL_NPC*)bl)->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) {
- struct guild *g = guild->search(((TBL_NPC*)bl)->u.scr.guild_id);
- if (g)
+ if (((struct npc_data *)bl)->subtype == SCRIPT && ((struct npc_data *)bl)->u.scr.guild_id > 0) {
+ struct guild *g = guild->search(((struct npc_data *)bl)->u.scr.guild_id);
+ if (g != NULL)
return g->emblem_id;
}
break;
@@ -6483,7 +6483,7 @@ struct view_data* status_get_viewdata(struct block_list *bl)
case BL_PC: return &((struct map_session_data *)bl)->vd;
case BL_MOB: return ((struct mob_data *)bl)->vd;
case BL_PET: return &((struct pet_data *)bl)->vd;
- case BL_NPC: return ((TBL_NPC*)bl)->vd;
+ case BL_NPC: return ((struct npc_data *)bl)->vd;
case BL_HOM: return ((struct homun_data *)bl)->vd;
case BL_MER: return ((struct mercenary_data *)bl)->vd;
case BL_ELEM: return ((struct elemental_data *)bl)->vd;
@@ -6602,13 +6602,13 @@ void status_set_viewdata(struct block_list *bl, int class_)
}
break;
case BL_NPC:
- {
- TBL_NPC* nd = (TBL_NPC*)bl;
- if (vd)
- nd->vd = vd;
- else
- ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name);
- }
+ {
+ struct npc_data *nd = (struct npc_data *)bl;
+ if (vd != NULL)
+ nd->vd = vd;
+ else
+ ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name);
+ }
break;
case BL_HOM: //[blackhole89]
{
diff --git a/src/map/unit.c b/src/map/unit.c
index 7cc510547..e095672e8 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -823,7 +823,7 @@ uint8 unit_getdir(struct block_list *bl) {
nullpo_ret(bl);
if( bl->type == BL_NPC )
- return ((TBL_NPC*)bl)->dir;
+ return ((struct npc_data *)bl)->dir;
ud = unit->bl2ud(bl);
if (!ud) return 0;
return ud->dir;
@@ -1875,7 +1875,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous) {
if( src->type == BL_PC ) {
struct map_session_data *sd = (struct map_session_data *)src;
if( target->type == BL_NPC ) { // monster npcs [Valaris]
- npc->click(sd,(TBL_NPC*)target); // submitted by leinsirk10 [Celest]
+ npc->click(sd, (struct npc_data *)target); // submitted by leinsirk10 [Celest]
return 0;
}
if( pc_is90overweight(sd) || pc_isridingwug(sd) ) { // overweight or mounted on warg - stop attacking