1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00
luanti/src/unittest/mock_inventorymanager.h

35 lines
781 B
C
Raw Normal View History

// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Minetest core developers & community
2022-09-29 22:16:29 +02:00
#pragma once
2022-09-29 22:16:29 +02:00
#include "gamedef.h"
#include "inventory.h"
#include "server/serverinventorymgr.h"
class ServerEnvironment;
class MockInventoryManager : public ServerInventoryManager
{
public:
MockInventoryManager(IGameDef *gamedef) :
p1(gamedef->getItemDefManager()),
p2(gamedef->getItemDefManager())
{};
2022-09-29 22:16:29 +02:00
Inventory *getInventory(const InventoryLocation &loc) override
{
if (loc.type == InventoryLocation::PLAYER && loc.name == "p1")
return &p1;
if (loc.type == InventoryLocation::PLAYER && loc.name == "p2")
return &p2;
return nullptr;
}
2022-09-29 22:16:29 +02:00
void setInventoryModified(const InventoryLocation &loc) override {}
Inventory p1;
Inventory p2;
2022-09-29 22:16:29 +02:00
};