From d429e385bb8dc928fe6c615b5a9afb665b1209d2 Mon Sep 17 00:00:00 2001 From: otfallen Date: Sun, 2 Sep 2012 19:31:50 +0000 Subject: [PATCH] Remove old useless functions. --- src/otclient/luafunctions.cpp | 1 - src/otclient/map.h | 5 +---- src/otclient/thingtypemanager.cpp | 23 ----------------------- src/otclient/thingtypemanager.h | 1 - 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 23a319a2..0904c023 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -63,7 +63,6 @@ void OTClient::registerLuaFunctions() g_lua.bindSingletonFunction("g_things", "findItemTypeByClientId", &ThingTypeManager::findItemTypeByClientId, &g_things); g_lua.bindSingletonFunction("g_things", "findThingTypeByAttr", &ThingTypeManager::findThingTypeByAttr, &g_things); g_lua.bindSingletonFunction("g_things", "findItemTypeByCategory", &ThingTypeManager::findItemTypeByCategory, &g_things); - g_lua.bindSingletonFunction("g_things", "castThingToCreature", &ThingTypeManager::castThingToCreature, &g_things); #if 0 g_lua.registerSingletonClass("g_houses"); diff --git a/src/otclient/map.h b/src/otclient/map.h index 99f18246..dc2597ba 100644 --- a/src/otclient/map.h +++ b/src/otclient/map.h @@ -102,21 +102,18 @@ public: tile = TilePtr(new Tile(pos)); return tile; } - const TilePtr& getOrCreate(const Position& pos) { TilePtr& tile = m_tiles[getTileIndex(pos)]; if(!tile) tile = TilePtr(new Tile(pos)); return tile; } - const TilePtr& get(const Position& pos) { return m_tiles[getTileIndex(pos)]; } - void remove(const Position& pos) { m_tiles[getTileIndex(pos)] = nullptr; } uint getTileIndex(const Position& pos) { return ((pos.y % BLOCK_SIZE) * BLOCK_SIZE) + (pos.x % BLOCK_SIZE); } - const std::array getTiles() const { return m_tiles; } + const std::array& getTiles() const { return m_tiles; } private: std::array m_tiles; diff --git a/src/otclient/thingtypemanager.cpp b/src/otclient/thingtypemanager.cpp index 6965bcfe..64e23127 100644 --- a/src/otclient/thingtypemanager.cpp +++ b/src/otclient/thingtypemanager.cpp @@ -272,29 +272,6 @@ const ItemTypePtr& ThingTypeManager::getItemType(uint16 id) return m_itemTypes[id]; } -CreaturePtr ThingTypeManager::castThingToCreature(const ThingTypePtr& thing) -{ - if(!thing) - return nullptr; - - if(thing->getCategory() != ThingCategoryCreature) - stdext::throw_exception("Thing type is not a creature"); - - uint16 clientId = thing->getId(); - CreaturePtr ret(new Creature); - CreatureTypePtr cType = g_creatures.getCreatureByLook(clientId); - if(!cType) { - // a creature can have a look item with whether client id or even server id - const ItemTypePtr& item = findItemTypeByClientId(clientId); - if(item && !(cType = g_creatures.getCreatureByLook(item->getServerId()))) - stdext::throw_exception(stdext::format("failed to find creature with look type/item %hd", item->getServerId())); - } - - ret->setName(cType->getName()); - ret->setOutfit(cType->getOutfit()); - return ret; -} - ThingTypeList ThingTypeManager::findThingTypeByAttr(ThingAttr attr, ThingCategory category) { ThingTypeList ret; diff --git a/src/otclient/thingtypemanager.h b/src/otclient/thingtypemanager.h index 12e258e3..b20f1907 100644 --- a/src/otclient/thingtypemanager.h +++ b/src/otclient/thingtypemanager.h @@ -50,7 +50,6 @@ public: const ItemTypePtr& getItemType(uint16 id); ThingType* rawGetThingType(uint16 id, ThingCategory category) { return m_thingTypes[category][id].get(); } ItemType* rawGetItemType(uint16 id) { return m_itemTypes[id].get(); } - CreaturePtr castThingToCreature(const ThingTypePtr& thing); ThingTypeList findThingTypeByAttr(ThingAttr attr, ThingCategory category); ItemTypeList findItemTypeByCategory(ItemCategory category);