Go to the documentation of this file.
45 m_tiles.insert(std::make_pair(tile->
getPosition(), tile));
50 TileMap::const_iterator iter = m_tiles.find(position);
51 if(iter != m_tiles.end())
60 m_doors[m_lastDoorId++] = door;
65 if(doorId >= m_lastDoorId)
67 doorId, m_lastDoorId));
68 m_doors[doorId] =
nullptr;
73 std::string name = elem->
Attribute(
"name");
81 m_isGuildHall = elem->
readType<
bool>(
"guildhall");
84 entryPos.
x = elem->
readType<
int>(
"entryx");
85 entryPos.y = elem->
readType<
int>(
"entryy");
86 entryPos.z = elem->
readType<
int>(
"entryz");
112 if(
findHouse(house->getId()) == m_houses.end())
113 m_houses.push_back(house);
119 if(it != m_houses.end())
126 return it != m_houses.end() ? *it :
nullptr;
131 auto it = std::find_if(m_houses.begin(), m_houses.end(),
132 [=] (
const HousePtr& house) ->
bool { return house->getName() == name; });
133 return it != m_houses.end() ? *it :
nullptr;
145 if(!root || root->
ValueTStr() !=
"houses")
149 if(elem->ValueTStr() !=
"house")
159 }
catch(std::exception& e) {
177 for(
auto house : m_houses) {
185 }
catch(std::exception& e) {
193 for(
const HousePtr& house : m_houses)
194 if(house->getTownId() == townId)
195 ret.push_back(house);
201 return std::find_if(m_houses.begin(), m_houses.end(),
202 [=] (
const HousePtr& house) ->
bool { return house->getId() == houseId; });
207 m_houses.sort([] (
const HousePtr& lhs,
const HousePtr& rhs) {
return lhs->getName() < rhs->getName(); });
std::list< HousePtr > HouseList
const TiXmlElement * NextSiblingElement() const
HouseList::iterator findHouse(uint32 houseId)
void setHouseId(uint32 hid)
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
void setName(const std::string &name)
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
const TIXML_STRING & ValueTStr() const
void error(const std::string &what)
const Position & getPosition()
void load(const std::string &fileName)
std::string Attribute(const std::string &name) const
void addDoor(const ItemPtr &door)
void setTownId(uint32 tid)
void SetTabSize(int _tabsize)
ResourceManager g_resources
HousePtr getHouse(uint32 houseId)
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
void setTile(const TilePtr &tile)
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
void save(TiXmlElement *elem)
void addHouse(const HousePtr &house)
void setFlag(uint32 flag)
stdext::shared_object_ptr< House > HousePtr
void SetAttribute(const std::string &name, const std::string &_value)
void removeDoorById(uint32 doorId)
void setDoorId(uint8 doorId)
HousePtr getHouseByName(std::string name)
T readType(const std::string &str) const
void throw_exception(const std::string &what)
Throws a generic exception.
HouseList filterHouses(uint32 townId)
std::string readFileContents(const std::string &fileName)
TilePtr getTile(const Position &pos)
void load(const TiXmlElement *elem)
void setEntry(const Position &p)
void removeHouse(uint32 houseId)
void save(const std::string &fileName)