diff options
author | Haru <haru@dotalux.com> | 2016-12-03 04:20:55 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-12-03 15:38:58 +0100 |
commit | c1b4b0b2fb1066087e928e9440b40edd185b188e (patch) | |
tree | 61fb624792d54db3668601df7f95f03eb30d8baf /src/map/clif.c | |
parent | a222f21b459eb6abc0862695526c1d15361a99e0 (diff) | |
download | hercules-c1b4b0b2fb1066087e928e9440b40edd185b188e.tar.gz hercules-c1b4b0b2fb1066087e928e9440b40edd185b188e.tar.bz2 hercules-c1b4b0b2fb1066087e928e9440b40edd185b188e.tar.xz hercules-c1b4b0b2fb1066087e928e9440b40edd185b188e.zip |
Remove the platform-dependent variables from struct status_data
`struct status_data::class_` was platform dependent since
c30bb75ec50624429bff7b4106db4be0fda366d6 in order to silence some
compile warnings (uint32 on 64 bit builds and uint16 on 32 bit builds).
It's now been changed to the correct type, int32, on all platforms.
Since the change has potential to silently break third party code, the
variable was renamed to `class`.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 262ea1c57..887fa9d64 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -276,7 +276,7 @@ unsigned char clif_bl_type(struct block_list *bl) vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - if (clif->isdisguised(bl) && !pc->db_checkid(vd->class_)) + if (clif->isdisguised(bl) && !pc->db_checkid(vd->class)) return CLUT_NPC; return CLUT_PC; case BL_ITEM: @@ -288,15 +288,15 @@ unsigned char clif_bl_type(struct block_list *bl) case BL_MOB: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_MOB; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_MOB; case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_EVENT; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); - return pc->db_checkid(vd->class_) ? CLUT_PC : CLUT_PET; + return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_PET; case BL_HOM: return CLUT_HOMNUCLUS; case BL_MER: @@ -961,14 +961,15 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1005,7 +1006,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu nullpo_retv(bl); #if PACKETVER < 20091103 - if( !pc->db_checkid(vd->class_) ) { + if (!pc->db_checkid(vd->class)) { clif->set_unit_idle2(bl,tsd,target); return; } @@ -1028,7 +1029,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1037,7 +1038,8 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1082,7 +1084,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1115,11 +1117,12 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; - p.job = vd->class_; + p.job = vd->class; p.shield = vd->shield; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.shield = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1147,7 +1150,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { nullpo_retv(bl); #if PACKETVER < 20091103 - if( !pc->db_checkid(vd->class_) ) { + if (!pc->db_checkid(vd->class)) { clif->spawn_unit2(bl,target); return; } @@ -1170,7 +1173,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1179,7 +1182,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this? + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { + // The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); @@ -1223,7 +1227,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { if (sd->status.class != sd->disguise) clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1266,7 +1270,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1315,7 +1319,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; #else p.GID = -bl->id; @@ -1427,7 +1431,7 @@ bool clif_spawn(struct block_list *bl) if( !vd ) return false; - if (vd->class_ == INVISIBLE_CLASS) + if (vd->class == INVISIBLE_CLASS) return true; // Doesn't need to be spawned, so everything is alright if (bl->type == BL_NPC) { @@ -1774,7 +1778,7 @@ void clif_move(struct unit_data *ud) bl = ud->bl; nullpo_retv(bl); vd = status->get_viewdata(bl); - if (!vd || vd->class_ == INVISIBLE_CLASS) + if (vd == NULL || vd->class == INVISIBLE_CLASS) return; //This performance check is needed to keep GM-hidden objects from being notified to bots. if (bl->type == BL_NPC) { @@ -4231,7 +4235,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { nullpo_retv(bl); vd = status->get_viewdata(bl); - if (!vd || vd->class_ == INVISIBLE_CLASS) + if (vd == NULL || vd->class == INVISIBLE_CLASS) return; if (bl->type == BL_NPC) { @@ -4691,7 +4695,7 @@ int clif_outsight(struct block_list *bl,va_list ap) nullpo_ret(bl); switch(bl->type){ case BL_PC: - if (sd->vd.class_ != INVISIBLE_CLASS) + if (sd->vd.class != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); if (sd->chat_id != 0) { struct chat_data *cd = map->id2cd(sd->chat_id); @@ -4714,7 +4718,7 @@ int clif_outsight(struct block_list *bl,va_list ap) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; default: - if ((vd=status->get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) + if ((vd=status->get_viewdata(bl)) && vd->class != INVISIBLE_CLASS) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); break; } @@ -4723,7 +4727,7 @@ int clif_outsight(struct block_list *bl,va_list ap) nullpo_ret(tbl); if (tbl->type == BL_SKILL) //Trap knocked out of sight clif->clearchar_skillunit(BL_UCAST(BL_SKILL, tbl), sd->fd); - else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + else if ((vd = status->get_viewdata(tbl)) != NULL && vd->class != INVISIBLE_CLASS && !(tbl->type == BL_NPC && (BL_UCAST(BL_NPC, tbl)->option&OPTION_INVISIBLE))) clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); } |