Position pos = player->getPosition();
pos = getNextPosition(player->direction, pos);
if(Tile* tile = g_game.getTile(pos.x, pos.y, pos.z))
{
if(HouseTile* houseTile = dynamic_cast<HouseTile*>(tile))
{
if(House* house = houseTile->getHouse())
{
if(house->getDoorByPosition(pos))
{
if(!house->getHouseOwner())
{
if(g_config.getString(ConfigManager::HOUSE_NEED_PREMIUM) != "no" || player->isPremium())
{
uint32_t levelToBuyHouse = g_config.getNumber(ConfigManager::LEVEL_TO_BUY_HOUSE);
if(player->getLevel() >= levelToBuyHouse)
{
if(house->getPrice())
{
if(g_game.getMoney(player) >= house->getPrice() && g_game.removeMoney(player, house->getPrice()))
{
house->setHouseOwner(player->guid);
player->sendTextMessage(MSG_INFO_DESCR, "You have successfully bought this house, remember to leave money at bank or depot of this city for rent.");
return true;
}
else
player->sendCancel("You do not have enough money.");
bool Commands::buyHouse(Creature* creature, const std::string& cmd, const std::string& param)
{
Player* player = creature->getPlayer();
if(player)
{
Position pos = player->getPosition();
pos = getNextPosition(player->direction, pos);
for(HouseMap::iterator it = Houses::getInstance().getHouseBegin(); it != Houses::getInstance().getHouseEnd(); it++)
{
if(it->second->getHouseOwner() == player->guid)
{
player->sendCancel("You are already the owner of a house.");
return false;
}
}
if(Tile* tile = g_game.getTile(pos.x, pos.y, pos.z))
{
if(HouseTile* houseTile = dynamic_cast<HouseTile*>(tile))
{
if(House* house = houseTile->getHouse())
{
if(house->getDoorByPosition(pos))
{
if(!house->getHouseOwner())
{
if(player->isPremium())
{
uint32_t price = 0;
for(HouseTileList::iterator it = house->getHouseTileBegin(); it != house->getHouseTileEnd(); it++)
price += g_config.getNumber(ConfigManager::HOUSE_PRICE);
if(price)
{
uint32_t money = g_game.getMoney(player);
if(money >= price && g_game.removeMoney(player, price))
{
house->setHouseOwner(player->guid);
player->sendTextMessage(MSG_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in your depot of this city.");
return true;
}
else
player->sendCancel("You do not have enough money.");
}
else
player->sendCancel("That house doesn't contain any house tile.");
}
else
player->sendCancelMessage(RET_YOUNEEDPREMIUMACCOUNT);
}
else
player->sendCancel("This house alreadly has an owner.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
return false;
}
bool Commands::buyHouse(Creature* creature, const std::string& cmd, const std::string& param)
{
Player* player = creature->getPlayer();
if(player)
{
Position pos = player->getPosition();
pos = getNextPosition(player->direction, pos);
for(HouseMap::iterator it = Houses::getInstance().getHouseBegin(); it != Houses::getInstance().getHouseEnd(); it++)
{
if(it->second->getHouseOwner() == player->guid)
{
player->sendCancel("You are already the owner of a house.");
return false;
}
}
if(Tile* tile = g_game.getTile(pos.x, pos.y, pos.z))
{
if(HouseTile* houseTile = dynamic_cast<HouseTile*>(tile))
{
if(House* house = houseTile->getHouse())
{
if(house->getDoorByPosition(pos))
{
if(!house->getHouseOwner())
{
uint32_t price = 0;
for(HouseTileList::iterator it = house->getHouseTileBegin(); it != house->getHouseTileEnd(); it++)
price += g_config.getNumber(ConfigManager::HOUSE_PRICE);
if(price)
{
uint32_t money = g_game.getMoney(player);
if(money >= price && g_game.removeMoney(player, price))
{
house->setHouseOwner(player->guid);
player->sendTextMessage(MSG_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in your depot of this city.");
return true;
}
else
player->sendCancel("You do not have enough money.");
}
else
player->sendCancel("That house doesn't contain any house tile.");
}
else
player->sendCancel("This house alreadly has an owner.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
else
player->sendCancel("You have to be looking at the door of the house you would like to buy.");
}
return false;
}
1665 C:\Documents and Settings\Kingcool\Desktop\Forgotten Sources\trunk\commands.cpp a function-definition is not allowed here before '{' token
1715 C:\Documents and Settings\Kingcool\Desktop\Forgotten Sources\trunk\commands.cpp expected `}' at end of input
bool Commands::changeFloor(Creature* creature, const std::string &cmd, const std::string ¶m)
{ <----Error on this line
Player* player = creature->getPlayer();