Hi,
Some - else - are unneeded//useless in Player.cpp
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 8e75ca4..aa374b1 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2029,12 +2029,11 @@ uint8 Player::chatTag() const
// 0x1 - afk
if (isGMChat())
return 4;
- else if (isDND())
+ if (isDND())
return 3;
if (isAFK())
return 1;
- else
- return 0;
+ return 0;
}
void Player::SendTeleportPacket(Position &oldPos)
Best regards,
MacWarrior.
Nay
September 25, 2011, 7:18pm
2
You could try to change the hardcoded numbers to an enum… it would be a bit more “useful” /emoticons/default_smile.png
Melik1
September 26, 2011, 2:30pm
3
Don’t wanna bulge in like a tard going off topic or anything; but what’s “hardcoded” and how do you see if something is it? What’s the downsides of hardcoded?
kliver
September 26, 2011, 4:05pm
4
i think
Harcoded
[CODE]if(ItemID== 12345 || 54321){
return 0;
}[/CODE]
Should be
[CODE]enum ExcludedItems{
EXCLUDED_ITEM = 12345,
EXCLUDED_ITEM_2 = 54321,
ITEM_NOT_EQUIPPABLE = 0
}
if (ItemID == EXCLUDED_ITEM || EXCLUDED_ITEM_2){
return ITEM_NOT_EQUIPPABLE;
}[/CODE]
but i am not shure about this /emoticons/default_tongue.png
both are hardcoded.
what you mean here are “magic numbers”
Micha
October 5, 2011, 10:11am
6
Hardcoded means code which will be unchangeable during the runtime. A non hardcoded value f.e. is a value taken out of the database. What Nay means is the return 4…return 3 and so on…those are magic numbers because: what is 4? what is 3? eggs? apples?
Nay
October 5, 2011, 12:42pm
7
My definition of “harcoded” was pretty similar to “magic numbers”. Well, it isn’t anymore and I meant “magic numbers”.
Patch now useless thanks to commit :
Core/Player: Make chat tag (last byte in SMSG_MESSAGECHAT) a bitmask.
Can someone close the topic, please ?
Best regards,
MacWarrior.