mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
34 lines
781 B
C++
34 lines
781 B
C++
// Luanti
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
// Copyright (C) 2022 Minetest core developers & community
|
|
|
|
#pragma once
|
|
|
|
#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())
|
|
{};
|
|
|
|
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;
|
|
}
|
|
void setInventoryModified(const InventoryLocation &loc) override {}
|
|
|
|
Inventory p1;
|
|
Inventory p2;
|
|
|
|
};
|