tibia-client/src/otclient/core/tile.h

113 lines
3.5 KiB
C
Raw Normal View History

2011-08-28 15:17:58 +02:00
/*
2012-01-02 17:58:37 +01:00
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
2011-08-28 15:17:58 +02:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
2011-08-15 16:11:24 +02:00
#ifndef TILE_H
#define TILE_H
2011-08-15 23:02:52 +02:00
#include "declarations.h"
#include <framework/luascript/luaobject.h>
2011-08-15 16:11:24 +02:00
2012-06-21 04:31:29 +02:00
enum tileflags_t
{
TILESTATE_NONE = 0,
TILESTATE_PROTECTIONZONE = 1 << 0,
TILESTATE_TRASHED = 1 << 1,
TILESTATE_OPTIONALZONE = 1 << 2,
TILESTATE_NOLOGOUT = 1 << 3,
TILESTATE_HPPARDCOREZONE = 1 << 4,
TILESTATE_REFRESH = 1 << 5,
// internal usage
TILESTATE_HOUSE = 1 << 6,
TILESTATE_TELEPORT = 1 << 17,
TILESTATE_MAGICFIELD = 1 << 18,
TILESTATE_MAILBOX = 1 << 19,
TILESTATE_TRASHHOLDER = 1 << 20,
TILESTATE_BED = 1 << 21,
TILESTATE_DEPOT = 1 << 22
};
2011-08-15 23:02:52 +02:00
class Tile : public LuaObject
2011-08-15 16:11:24 +02:00
{
public:
2012-05-10 14:09:44 +02:00
enum {
MAX_THINGS = 10
};
2011-08-31 01:39:14 +02:00
Tile(const Position& position);
2011-08-15 16:11:24 +02:00
2012-01-30 19:18:10 +01:00
void draw(const Point& dest, float scaleFactor, int drawFlags);
2012-01-30 01:00:12 +01:00
public:
void clean();
2011-08-15 21:15:49 +02:00
void addWalkingCreature(const CreaturePtr& creature);
void removeWalkingCreature(const CreaturePtr& creature);
2011-08-31 22:22:57 +02:00
ThingPtr addThing(const ThingPtr& thing, int stackPos = -1);
2012-02-02 21:10:14 +01:00
bool removeThing(ThingPtr thing);
2011-08-31 22:22:57 +02:00
ThingPtr getThing(int stackPos);
bool hasThing(const ThingPtr& thing);
int getThingStackpos(const ThingPtr& thing);
2012-01-03 21:41:00 +01:00
ThingPtr getTopThing();
2012-01-30 01:00:12 +01:00
2012-01-04 14:02:35 +01:00
ThingPtr getTopLookThing();
ThingPtr getTopUseThing();
CreaturePtr getTopCreature();
2012-01-20 02:12:26 +01:00
ThingPtr getTopMoveThing();
2012-01-09 21:54:37 +01:00
ThingPtr getTopMultiUseThing();
2012-01-04 14:02:35 +01:00
2012-01-30 01:00:12 +01:00
const Position& getPosition() { return m_position; }
2011-08-31 22:22:57 +02:00
int getDrawElevation() { return m_drawElevation; }
std::vector<CreaturePtr> getCreatures();
2012-01-30 04:11:05 +01:00
const std::vector<ThingPtr>& getThings() { return m_things; }
2011-08-31 22:22:57 +02:00
ItemPtr getGround();
int getGroundSpeed();
Color getMinimapColor();
2012-02-02 21:10:14 +01:00
int getThingCount() { return m_things.size() + m_effects.size(); }
bool isPathable();
2011-11-05 21:34:49 +01:00
bool isWalkable();
2011-09-02 00:00:46 +02:00
bool isFullGround();
2011-08-31 22:22:57 +02:00
bool isFullyOpaque();
2011-09-02 00:00:46 +02:00
bool isLookPossible();
2012-01-04 15:30:28 +01:00
bool isClickable();
2012-01-30 01:00:12 +01:00
bool isEmpty();
2012-02-02 17:55:42 +01:00
bool mustHookSouth();
bool mustHookEast();
2012-01-30 01:00:12 +01:00
bool hasCreature();
bool limitsFloorsView();
2012-02-02 21:10:14 +01:00
bool canErase();
2011-09-01 16:49:51 +02:00
TilePtr asTile() { return std::static_pointer_cast<Tile>(shared_from_this()); }
2012-06-21 04:31:29 +02:00
void setFlags(tileflags_t flags) { m_flags |= (uint32)flags; }
2011-09-01 16:49:51 +02:00
2011-08-15 16:11:24 +02:00
private:
std::vector<CreaturePtr> m_walkingCreatures;
2012-01-30 01:00:12 +01:00
std::vector<EffectPtr> m_effects; // leave this outside m_things because it has no stackpos.
2011-08-31 22:22:57 +02:00
std::vector<ThingPtr> m_things;
2012-01-30 01:00:12 +01:00
Position m_position;
2012-02-02 21:10:14 +01:00
uint8 m_drawElevation;
2012-06-21 04:31:29 +02:00
uint32 m_flags;
2011-08-15 16:11:24 +02:00
};
#endif