1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

C++11 cleanup inventorymanager (#6077)

* C++11 cleanup inventorymanager
This commit is contained in:
Vincent Glize
2017-07-01 14:07:40 +02:00
committed by Loïc Blot
parent 6e5588c8e1
commit c772e0e18c
4 changed files with 111 additions and 168 deletions

View File

@@ -908,7 +908,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
std::istringstream is(datastring, std::ios_base::binary);
// Create an action
InventoryAction *a = InventoryAction::deSerialize(is);
if (a == NULL) {
if (!a) {
infostream << "TOSERVER_INVENTORY_ACTION: "
<< "InventoryAction::deSerialize() returned NULL"
<< std::endl;
@@ -927,7 +927,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
/*
Handle restrictions and special cases of the move action
*/
if (a->getType() == IACTION_MOVE) {
if (a->getType() == IAction::Move) {
IMoveAction *ma = (IMoveAction*)a;
ma->from_inv.applyCurrentPlayer(player->getName());
@@ -982,7 +982,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
/*
Handle restrictions and special cases of the drop action
*/
else if (a->getType() == IACTION_DROP) {
else if (a->getType() == IAction::Drop) {
IDropAction *da = (IDropAction*)a;
da->from_inv.applyCurrentPlayer(player->getName());
@@ -1018,7 +1018,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
/*
Handle restrictions and special cases of the craft action
*/
else if (a->getType() == IACTION_CRAFT) {
else if (a->getType() == IAction::Craft) {
ICraftAction *ca = (ICraftAction*)a;
ca->craft_inv.applyCurrentPlayer(player->getName());