Remove old useless functions.
This commit is contained in:
parent
c9688551f3
commit
d429e385bb
|
@ -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");
|
||||
|
|
|
@ -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<TilePtr, BLOCK_SIZE*BLOCK_SIZE> getTiles() const { return m_tiles; }
|
||||
const std::array<TilePtr, BLOCK_SIZE*BLOCK_SIZE>& getTiles() const { return m_tiles; }
|
||||
|
||||
private:
|
||||
std::array<TilePtr, BLOCK_SIZE*BLOCK_SIZE> m_tiles;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue