Json::Value arrayObj1;
for(int i = 0; i < GET_BUILD_CONF_LIST->size(); i++)
{
if(GET_BUILD_CONF_LIST->at(i)->getIntIconFromData(BUILD_CONF_type) == DEFENSE && GET_BUILD_CONF_LIST->at(i)->getIntIconFromData(BUILD_CONF_level) == this->getModel()->getConf()->getIntIconFromData(BUILD_CONF_level))
{
defense_id = GET_BUILD_CONF_LIST->at(i)->getIntIconFromData(BUILD_CONF_id);
break;
}
}
for(int i = 0; i < arr.size(); i++)
{
BuildModel *model = arr.at(i);
Json::Value posi;
posi["x"] = Json::Value(model->getCurrentX());
posi["y"] = Json::Value(model->getCurrentY());
arrayObj1.append(posi);
model->setConfID(defense_id);
model->setChange();
}
Json::Value root1;
root1["name"] = Json::Value("build_defense");
root1["build_id"] = Json::Value(defense_id);
root1["position"] = arrayObj1;
SocketMessage *message1 = new SocketMessage(BUILD_DEFENSE,root1);
GameSocketClient::sharedGameSocketClient()->socketSend(message1);