Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
mock_inventorymanager.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2022 Minetest core developers & community
4
5#pragma once
6
7#include "gamedef.h"
8#include "inventory.h"
10
12
14{
15public:
17 p1(gamedef->getItemDefManager()),
18 p2(gamedef->getItemDefManager())
19 {};
20
22 {
23 if (loc.type == InventoryLocation::PLAYER && loc.name == "p1")
24 return &p1;
25 if (loc.type == InventoryLocation::PLAYER && loc.name == "p2")
26 return &p2;
27 return nullptr;
28 }
29 void setInventoryModified(const InventoryLocation &loc) override {}
30
33
34};
Definition gamedef.h:36
Definition inventory.h:314
Definition mock_inventorymanager.h:14
Inventory p2
Definition mock_inventorymanager.h:32
void setInventoryModified(const InventoryLocation &loc) override
Definition mock_inventorymanager.h:29
Inventory p1
Definition mock_inventorymanager.h:31
MockInventoryManager(IGameDef *gamedef)
Definition mock_inventorymanager.h:16
Inventory * getInventory(const InventoryLocation &loc) override
Definition mock_inventorymanager.h:21
Definition serverenvironment.h:219
Definition serverinventorymgr.h:17
Definition inventorymanager.h:18
enum InventoryLocation::Type type
std::string name
Definition inventorymanager.h:27
@ PLAYER
Definition inventorymanager.h:22