1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Consistent HP and damage types (#8167)

Remove deprecated HUDs and chat message handling.
Remove unused m_damage variable (compat break).
HP: s32 for setter/calculations, u16 for getter.
This commit is contained in:
SmallJoker 2019-02-11 00:03:26 +01:00 committed by Paramat
parent ba5a9f2b36
commit ffb17f1c9a
25 changed files with 67 additions and 136 deletions

View file

@ -437,7 +437,7 @@ void Client::step(float dtime)
ClientEnvEvent envEvent = m_env.getClientEnvEvent();
if (envEvent.type == CEE_PLAYER_DAMAGE) {
u8 damage = envEvent.player_damage.amount;
u16 damage = envEvent.player_damage.amount;
if (envEvent.player_damage.send_to_server)
sendDamage(damage);
@ -1213,9 +1213,9 @@ void Client::sendChangePassword(const std::string &oldpassword,
}
void Client::sendDamage(u8 damage)
void Client::sendDamage(u16 damage)
{
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u16));
pkt << damage;
Send(&pkt);
}
@ -1515,17 +1515,6 @@ void Client::typeChatMessage(const std::wstring &message)
// Send to others
sendChatMessage(message);
// Show locally
if (message[0] != L'/') {
// compatibility code
if (m_proto_ver < 29) {
LocalPlayer *player = m_env.getLocalPlayer();
assert(player);
std::wstring name = narrow_to_wide(player->getName());
pushToChatQueue(new ChatMessage(CHATMESSAGE_TYPE_NORMAL, message, name));
}
}
}
void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent)