Acedayz
Member
- Joined
- Jan 24, 2015
- Messages
- 38
- Reaction score
- 19
I've ran into a problem after making players be able to have a capacity below 0.
Everything is working as it should, except that the tibia client crashes the second time you login without closing the client (when the player's cap is below 0).
So, I can login once with a cap below 0 and it's all good. But if I logout and login again without closing the client, it crashes.
I have changed this in player.h:
to this:
And changed this in protocolgame.cpp (same problem without changing this):
to this:
This is the error report I get on the tibia client.
What else do I have to change?
Edit: Also crashes when I resize the client window etc, because of the negative cap.
Everything is working as it should, except that the tibia client crashes the second time you login without closing the client (when the player's cap is below 0).
So, I can login once with a cap below 0 and it's all good. But if I logout and login again without closing the client, it crashes.
I have changed this in player.h:
Code:
uint32_t getFreeCapacity() const {
if (hasFlag(PlayerFlag_CannotPickupItem)) {
return 0;
} else if (hasFlag(PlayerFlag_HasInfiniteCapacity)) {
return std::numeric_limits<uint32_t>::max();
} else {
return std::max<int32_t>(0, capacity - inventoryWeight);
}
}
to this:
Code:
int32_t getFreeCapacity() const {
if (hasFlag(PlayerFlag_CannotPickupItem)) {
return 0;
} else if (hasFlag(PlayerFlag_HasInfiniteCapacity)) {
return std::numeric_limits<int32_t>::max();
} else {
return std::max<int32_t>(std::numeric_limits<int32_t>::min(), capacity - inventoryWeight);
}
}
And changed this in protocolgame.cpp (same problem without changing this):
Code:
msg.Add<uint32_t>(player->getFreeCapacity());
to this:
Code:
msg.Add<int32_t>(player->getFreeCapacity());
This is the error report I get on the tibia client.
What else do I have to change?
Edit: Also crashes when I resize the client window etc, because of the negative cap.
Last edited: