thing.h

main 67 lines · 2 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1/**
2 * The Forgotten Server - a free and open-source MMORPG server emulator
3 * Copyright (C) 2019 Mark Samman <mark.samman@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef FS_THING_H_6F16A8E566AF4ACEAE02CF32A7246144
21#define FS_THING_H_6F16A8E566AF4ACEAE02CF32A7246144
22
23#include "position.h"
24
25class Tile;
26class Cylinder;
27class Item;
28class Creature;
29class Container;
30
31class Thing {
32public:
33 constexpr Thing() = default;
34 virtual ~Thing() = default;
35
36 // non-copyable
37 Thing(const Thing &) = delete;
38 Thing &operator=(const Thing &) = delete;
39
40 virtual std::string getDescription(int32_t lookDistance) const = 0;
41
42 virtual Cylinder *getParent() const { return nullptr; }
43 virtual Cylinder *getRealParent() const { return getParent(); }
44
45 virtual void setParent(Cylinder *) {
46 //
47 }
48
49 virtual Tile *getTile();
50 virtual const Tile *getTile() const;
51
52 virtual const Position &getPosition() const;
53 virtual int32_t getThrowRange() const = 0;
54 virtual bool isPushable() const = 0;
55
56 virtual Container *getContainer() { return nullptr; }
57 virtual const Container *getContainer() const { return nullptr; }
58 virtual Item *getItem() { return nullptr; }
59 virtual const Item *getItem() const { return nullptr; }
60 virtual Creature *getCreature() { return nullptr; }
61 virtual const Creature *getCreature() const { return nullptr; }
62
63 virtual bool isRemoved() const { return true; }
64};
65
66#endif
67
Top