2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2022 Minetest core developers & community
|
2022-09-27 22:22:11 +02:00
|
|
|
|
2022-09-29 22:16:29 +02:00
|
|
|
#pragma once
|
2022-09-27 22:22:11 +02:00
|
|
|
|
2022-09-29 22:16:29 +02:00
|
|
|
#include "gamedef.h"
|
|
|
|
#include "inventory.h"
|
|
|
|
#include "server/serverinventorymgr.h"
|
|
|
|
|
|
|
|
class ServerEnvironment;
|
|
|
|
|
|
|
|
class MockInventoryManager : public ServerInventoryManager
|
2022-09-27 22:22:11 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MockInventoryManager(IGameDef *gamedef) :
|
|
|
|
p1(gamedef->getItemDefManager()),
|
|
|
|
p2(gamedef->getItemDefManager())
|
|
|
|
{};
|
|
|
|
|
2022-09-29 22:16:29 +02:00
|
|
|
Inventory *getInventory(const InventoryLocation &loc) override
|
|
|
|
{
|
2022-09-27 22:22:11 +02:00
|
|
|
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 {}
|
2022-09-27 22:22:11 +02:00
|
|
|
|
|
|
|
Inventory p1;
|
|
|
|
Inventory p2;
|
2022-09-29 22:16:29 +02:00
|
|
|
|
2022-09-27 22:22:11 +02:00
|
|
|
};
|