bool Fleet::removeShips(uint32_t type, uint32_t number){ std::map<std::pair<int32_t, uint32_t>, uint32_t> ships = ((RefQuantityListObjectParam*)(obj->getParameter(4,1)))->getRefQuantityList(); if(ships[std::pair<int32_t, uint32_t>(rst_Design, type)] >= number){ ships[std::pair<int32_t, uint32_t>(rst_Design, type)] -= number; if(ships[std::pair<int32_t, uint32_t>(rst_Design, type)] == 0){ ships.erase(std::pair<int32_t, uint32_t>(rst_Design, type)); } ((RefQuantityListObjectParam*)(obj->getParameter(4,1)))->setRefQuantityList(ships); DesignStore* ds = Game::getGame()->getDesignStore(); bool colonise = false; for(std::map<std::pair<int32_t, uint32_t>, uint32_t>::iterator itcurr = ships.begin(); itcurr != ships.end(); ++itcurr){ if(ds->getDesign(itcurr->first.second)->getPropertyValue(ds->getPropertyByName("Colonise")) == 1.0){ colonise = true; break; } } OrderManager* om = Game::getGame()->getOrderManager(); OrderQueueObjectParam* orderqueue = ((OrderQueueObjectParam*)(obj->getParameter(3,1))); if(colonise){ std::set<uint32_t> allowed = orderqueue->getAllowedOrders(); allowed.insert(om->getOrderTypeByName("Colonise")); orderqueue->setAllowedOrders(allowed); }else{ std::set<uint32_t> allowed = orderqueue->getAllowedOrders(); allowed.erase(om->getOrderTypeByName("Colonise")); orderqueue->setAllowedOrders(allowed); } obj->touchModTime(); return true; } return false; }
long long Fleet::maxSpeed(){ double speed = 1e100; DesignStore* ds = Game::getGame()->getDesignStore(); std::map<std::pair<int32_t, uint32_t>, uint32_t> ships = ((RefQuantityListObjectParam*)(obj->getParameter(4,1)))->getRefQuantityList(); for(std::map<std::pair<int32_t, uint32_t>, uint32_t>::iterator itcurr = ships.begin(); itcurr != ships.end(); ++itcurr){ speed = fmin(speed, ds->getDesign(itcurr->first.second)->getPropertyValue(ds->getPropertyByName("Speed"))); } return (long long)(floor(speed)); }
void Fleet::addShips(uint32_t type, uint32_t number){ std::map<std::pair<int32_t, uint32_t>, uint32_t> ships = ((RefQuantityListObjectParam*)(obj->getParameter(4,1)))->getRefQuantityList(); ships[std::pair<int32_t, uint32_t>(rst_Design, type)] += number; ((RefQuantityListObjectParam*)(obj->getParameter(4,1)))->setRefQuantityList(ships); DesignStore* ds = Game::getGame()->getDesignStore(); OrderManager* om = Game::getGame()->getOrderManager(); if(ds->getDesign(type)->getPropertyValue(ds->getPropertyByName("Colonise")) == 1.0){ std::set<uint32_t> allowed = ((OrderQueueObjectParam*)(obj->getParameter(3,1)))->getAllowedOrders(); allowed.insert(om->getOrderTypeByName("Colonise")); ((OrderQueueObjectParam*)(obj->getParameter(3,1)))->setAllowedOrders(allowed); } obj->touchModTime(); }
void PropertyFactory::initWeaponWinProperty() { Property* prop = new Property(); DesignStore *ds = Game::getGame()->getDesignStore(); prop->setCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("WeaponWin"); prop->setDisplayName("Weapon Strength at Win"); prop->setDescription("The amount of damage done on a win."); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" HP\")) ) )"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); return; }
void PropertyFactory::initColoniseProperty() { Property* prop = new Property(); DesignStore *ds = Game::getGame()->getDesignStore(); prop->setCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("Colonise"); prop->setDisplayName("Colonise"); prop->setDescription("Whether a ship can colonise or not."); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (if (= n 1) \"Yes\" \"No\")) ) )"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); return; }
void PropertyFactory::initSpeedProperty() { Property* prop = new Property(); DesignStore *ds = Game::getGame()->getDesignStore(); prop->setCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("Speed"); prop->setDisplayName("Speed"); prop->setDescription("How fast a ship moves. "); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string (/ n 1000000)) \" mega-units\")) ) )"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); return; }
void PropertyFactory::initBuildTimeProperty() { Property* prop = new Property(); DesignStore *ds = Game::getGame()->getDesignStore(); prop->setCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("BuildTime"); prop->setDisplayName("Build Time"); prop->setDescription("The number of turns to build a ship"); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" turns\")) ) )"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); return; }
void PropertyFactory::init_num_componentsProperty() { Property* prop = new Property(); DesignStore *ds = Game::getGame()->getDesignStore(); prop->setCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("_num-components"); prop->setDisplayName("Number of Components"); prop->setDescription("The number of components in a design"); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" components\"))))"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); return; }
// Create properties for use with components. This function is based off the // function of the same name implemented in RFTS. void taeRuleset::createProperties() { Property* prop = new Property(); DesignStore* ds = Game::getGame()->getDesignStore(); // Passengers prop = new Property(); prop->addCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("Passengers"); prop->setDisplayName("Passengers"); prop->setDescription("The passengers aboard the ship"); // Value of property -> String to display: // 1 -> Merchants // 2 -> Scientists // 3 -> Settlers // 4 -> Mining Robots // 5 -> Merchant Leader // 6 -> Lead Scientist // 7 -> Government Official // 8 -> Mining Foreman prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits)))" "(cons n (cond " "((= n 1) \"Merchants\") " "((= n 2) \"Scientists\") " "((= n 3) \"Settlers\") " "((= n 4) \"Mining Robots\") " "((= n 5) \"Merchant Leader\") " "((= n 6) \"Lead Scientist\") " "((= n 7) \"Government Official\") " "((= n 8) \"Mining Foreman\") " "((< n 1) (cons n \"ERROR: value too low!\")) " "((> n 8) (cons n \"ERROR: value too high!\"))))))"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); prop = new Property(); prop->addCategoryId(ds->getCategoryByName("Ships")); prop->setRank(0); prop->setName("Bombs"); prop->setDisplayName("Supernova Bombs"); prop->setDescription("The number of supernova bombs aboard the ship"); prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" bombs\")) ) )"); prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))"); ds->addProperty(prop); }
void taeRuleset::createComponents() { DesignStore *ds = Game::getGame()->getDesignStore(); Component* comp = new Component(); map<unsigned int, string> propList; //Merchants comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("MerchantCargo"); comp->setDescription("A cargo hold outfitted to carry businessmen"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 1)"; comp->setPropertyList(propList); ds->addComponent(comp); //Scientists comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("ScientistCargo"); comp->setDescription("A cargo hold outfitted to carry scientists"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 2)"; comp->setPropertyList(propList); ds->addComponent(comp); //Settlers comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("SettlerCargo"); comp->setDescription("A cargo hold outfitted to carry settlers"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 3)"; comp->setPropertyList(propList); ds->addComponent(comp); //Mining Robots comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("MiningCargo"); comp->setDescription("A cargo hold outfitted to carry mining robots"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 4)"; comp->setPropertyList(propList); ds->addComponent(comp); //Merchant Leader comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("MerchantLeaderCargo"); comp->setDescription("A cargo hold outfitted to carry powerful business leaders"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 5)"; comp->setPropertyList(propList); ds->addComponent(comp); //Lead Scientist comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("ScientistLeaderCargo"); comp->setDescription("A cargo hold outfitted to carry a lead scientist"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 6)"; comp->setPropertyList(propList); ds->addComponent(comp); //Government Official comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("SettlerLeaderCargo"); comp->setDescription("A cargo hold outfitted to a government leader"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 7)"; comp->setPropertyList(propList); ds->addComponent(comp); //Mining Foreman comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("MiningLeaderCargo"); comp->setDescription("A cargo hold outfitted to a highly specialized mining robot leader"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 8)"; comp->setPropertyList(propList); ds->addComponent(comp); //Weapons Arsenal comp = new Component(); comp->addCategoryId(ds->getCategoryByName("Ships")); comp->setName("Weapon"); comp->setDescription("The weapons arsenal for the ship"); comp->setTpclRequirementsFunction( "(lambda (design) " "(if (= (designType._num-components design) 1) " "(cons #t \"\") " "(cons #f \"This is a complete component, nothing else can be included\")))"); propList.clear(); propList[ds->getPropertyByName("Bombs")] = "(lambda (design) 1)"; comp->setPropertyList(propList); ds->addComponent(comp); }
bool Colonise::doOrder(IGObject * ob){ //if not close, move IGObject* target = Game::getGame()->getObjectManager()->getObject(ob->getParent()); if(target == NULL || target->getType() != Game::getGame()->getObjectTypeManager()->getObjectTypeByName("Planet")){ Logger::getLogger()->debug("Object(%d)->Colonise->doOrder(): Target was not valid.", ob->getID()); Game::getGame()->getObjectManager()->doneWithObject(ob->getParent()); Message * msg = new Message(); msg->setSubject("Colonise order canceled"); msg->setBody("Not at a planet, colonisation canceled"); msg->addReference(rst_Action_Order, rsorav_Canceled); msg->addReference(rst_Object, ob->getID()); Game::getGame()->getPlayerManager()->getPlayer(((Fleet*)(ob->getObjectBehaviour()))->getOwner())->postToBoard(msg); return true; } Fleet* fleet = (Fleet*)(ob->getObjectBehaviour()); Planet* planet = (Planet*)(target->getObjectBehaviour()); Message * msg = new Message(); msg->addReference(rst_Object, ob->getID()); msg->addReference(rst_Object, target->getID()); if(planet->getOwner() != fleet->getOwner()){ if(planet->getOwner() != 0){ Logger::getLogger()->debug("Object(%d)->Colonise->doOrder(): Planet already owned.", ob->getID()); msg->setSubject("Colonisation failed"); msg->setBody("The planet you tried to colonise, is already owned by someone else."); msg->addReference(rst_Action_Order, rsorav_Canceled); }else{ DesignStore* ds = Game::getGame()->getDesignStore(); int shiptype = 0; int shiphp = 2000000; std::map<uint32_t, uint32_t> ships = fleet->getShips(); unsigned int colonisePropID = ds->getPropertyByName( "Colonise"); unsigned int armorPropID = ds->getPropertyByName( "Armour"); for(std::map<uint32_t, uint32_t>::iterator itcurr = ships.begin(); itcurr != ships.end(); ++itcurr){ Design *design = ds->getDesign(itcurr->first); if(design->getPropertyValue(colonisePropID) != 0.0 && shiphp > (int)design->getPropertyValue(armorPropID)){ shiptype = itcurr->first; shiphp = (int)design->getPropertyValue(armorPropID); } } Logger::getLogger()->debug("Object(%d)->Colonise->doOrder(): shiptype %d", ob->getID(), shiptype); if(shiptype != 0){ uint32_t oldowner = planet->getOwner(); planet->setOwner(fleet->getOwner()); Game::getGame()->getPlayerManager()->getPlayer(fleet->getOwner())->getPlayerView()->addOwnedObject(target->getID()); uint32_t queueid = static_cast<OrderQueueObjectParam*>(target->getParameterByType(obpT_Order_Queue))->getQueueId(); OrderQueue* queue = Game::getGame()->getOrderManager()->getOrderQueue(queueid); queue->removeOwner(oldowner); queue->addOwner(fleet->getOwner()); fleet->removeShips(shiptype, 1); msg->setSubject("Colonised planet"); msg->setBody("You have colonised a planet!"); msg->addReference(rst_Action_Order, rsorav_Completion); }else{ msg->setSubject("Colonisation failed"); msg->setBody("Your fleet did not have a frigate to colonise the planet"); msg->addReference(rst_Action_Order, rsorav_Invalid); } if(fleet->totalShips() == 0){ Game::getGame()->getObjectManager()->scheduleRemoveObject(ob->getID()); Game::getGame()->getPlayerManager()->getPlayer(fleet->getOwner())->getPlayerView()->removeOwnedObject(ob->getID()); } } }else{ Logger::getLogger()->debug("Object(%d)->Colonise->doOrder(): Was already owned by the player!", ob->getID()); msg->setSubject("Colonisation failed"); msg->setBody("You already own the planet you tried to colonise"); msg->addReference(rst_Action_Order, rsorav_Canceled); } Game::getGame()->getPlayerManager()->getPlayer(fleet->getOwner())->postToBoard(msg); Game::getGame()->getObjectManager()->doneWithObject(target->getID()); return true; }
//Award artifacts to any players who have a merchant leader //in a region with two artifacts void TaeTurn::awardArtifacts() { Game* game = Game::getGame(); ObjectTypeManager* obtm = game->getObjectTypeManager(); ObjectManager* objectmanager = game->getObjectManager(); std::set<uint32_t> artifacts; std::set<uint32_t> regions; std::set<uint32_t> objects = objectmanager->getAllIds(); std::set<uint32_t>::iterator itcurr; //Find any regions with 2 or more alien artifacts for(itcurr = objects.begin(); itcurr != objects.end(); ++itcurr) { IGObject * ob = objectmanager->getObject(*itcurr); if(ob->getType() == obtm->getObjectTypeByName("Planet")) { Planet* p = (Planet*) ob->getObjectBehaviour(); if(p->getResource(3) > 0) { StarSystem* sys = (StarSystem*)(objectmanager->getObject(ob->getParent())->getObjectBehaviour()); if(sys->getRegion() != 0) { if(regions.count(sys->getRegion()) > 0) { artifacts.insert(*itcurr); } else { regions.insert(sys->getRegion()); } } } } } if(!artifacts.empty()) { uint32_t type; DesignStore* ds = game->getDesignStore(); PlayerManager* pm = game->getPlayerManager(); std::set<unsigned int> designs = ds->getDesignIds(); //get leader ID for(itcurr = designs.begin(); itcurr != designs.end(); ++itcurr) { if(ds->getDesign(*itcurr)->getName().compare("MerchantLeaderShip")) { type = *itcurr; } } //Search the objects for a merchant leader for(itcurr = objects.begin(); itcurr != objects.end(); ++itcurr) { IGObject * ob = objectmanager->getObject(*itcurr); if(ob->getType() == obtm->getObjectTypeByName("Fleet")) { Fleet* f = (Fleet*) (ob->getObjectBehaviour()); if(f->getShips().count(type) > 0) { IGObject* parent = objectmanager->getObject(ob->getParent()); if(parent->getType() == obtm->getObjectTypeByName("Star System")) { StarSystem* parentData = (StarSystem*) (parent->getObjectBehaviour()); //See if this leader is in a region with //2 or more alien artifacts for(std::set<uint32_t>::iterator i = artifacts.begin(); i != artifacts.end(); ++i) { IGObject* obj = objectmanager->getObject(*i); Planet* p = (Planet*) obj->getObjectBehaviour(); StarSystem* sys = (StarSystem*)(objectmanager->getObject(obj->getParent())->getObjectBehaviour()); if(sys->getRegion() == parentData->getRegion()) { //+1 to leader's owner's artifact score Player* owner = pm->getPlayer(f->getOwner()); owner->setScore(5, owner->getScore(5) + 1); p->removeResource(3, 1); artifacts.erase(*i); } } } } } } } }
//Setup the next turn to be ready for combat void TaeTurn::initCombat() { std::set<uint32_t>::iterator itcurr; Game* game = Game::getGame(); ObjectManager* objectmanager = game->getObjectManager(); PlayerManager* playermanager = game->getPlayerManager(); ObjectTypeManager* obtm = game->getObjectTypeManager(); DesignStore* ds = game->getDesignStore(); //Pop the combat queue and set the combatants pair<bool, map<uint32_t, uint32_t> > temp; temp = combatQueue.front(); combatQueue.pop(); isInternal = temp.first; combatants = temp.second; strength.clear(); for(map<uint32_t, uint32_t>::iterator i = combatants.begin(); i != combatants.end(); ++i) { IGObject* ob = Game::getGame()->getObjectManager()->getObject(i->first); Fleet* f = (Fleet*) ob->getObjectBehaviour(); strength[f->getOwner()] = 0; } set<uint32_t> owners; set<uint32_t> regions; string shipType; for(map<uint32_t, uint32_t>::iterator i = combatants.begin(); i != combatants.end(); ++i) { IGObject* ob = objectmanager->getObject(i->first); Fleet* leader = (Fleet*) (ob)->getObjectBehaviour(); //look for the shiptype which this combat is associated with if(shipType.empty()) { if(isInternal) { shipType = "ScientistShip"; } else { //Set shiptype to the type corresponding to the leader uint32_t ship = leader->getShips().begin()->first; shipType = ds->getDesign(ship)->getName(); size_t pos = shipType.find("Leader"); if(pos != shipType.npos) { shipType.erase(pos, 6); } } } owners.insert(leader->getOwner()); //Set which regions are involved in combat if(regions.count(i->second) <= 0) { regions.insert(i->second); } //Set initial internal combat strength if(isInternal) { IGObject *starSys = objectmanager->getObject(ob->getParent()); StarSystem* starSysData = (StarSystem*)(starSys->getObjectBehaviour()); Vector3d pos = starSysData->getPosition(); //Search for bordering science colonies //east-west neighbors for(int i = -1; i < 2; i+=2) { set<uint32_t> ids = objectmanager->getObjectsByPos(pos+Vector3d(80000*i,0,0), 1); for(set<uint32_t>::iterator j=ids.begin(); j != ids.end(); j++) { IGObject *tempObj = objectmanager->getObject(*j); if(tempObj->getType() == obtm->getObjectTypeByName("Planet")) { Planet* p = (Planet*)(tempObj->getObjectBehaviour()); if(p->getResource(5) > 0) { addReinforcement(leader->getOwner()); } } } } //north-south neighbors for(int i = -1; i < 2; i+=2) { set<uint32_t> ids = objectmanager->getObjectsByPos(pos+Vector3d(0,80000*i,0), 1); for(set<uint32_t>::iterator j=ids.begin(); j != ids.end(); j++) { IGObject *tempObj = objectmanager->getObject(*j); if(tempObj->getType() == obtm->getObjectTypeByName("Planet")) { Planet* p = (Planet*)(tempObj->getObjectBehaviour()); if(p->getResource(5) > 0) { addReinforcement(leader->getOwner()); } } } } } } //Set which resource will be awarded int resourceType; if(shipType.compare("MerchantShip") == 0) { resourceType = 4; } else if(shipType.compare("ScientistShip") == 0) { resourceType = 5; } else if(shipType.compare("SettlerShip") == 0) { resourceType = 6; } else { resourceType = 7; } //Set all fleets to combat mode. Flag the fleets whose owners are //directly involved in combat. std::set<ObjectView*> views; std::set<uint32_t> objects = objectmanager->getAllIds(); for(itcurr = objects.begin(); itcurr != objects.end(); ++itcurr) { IGObject * ob = objectmanager->getObject(*itcurr); if(ob->getType() == obtm->getObjectTypeByName("Fleet")) { Fleet* f = (Fleet*) ob->getObjectBehaviour(); f->toggleCombat(); //check to see if this fleet is a combatant if(owners.count(f->getOwner()) > 0) { uint32_t ship = f->getShips().begin()->first; string name = ds->getDesign(ship)->getName(); if(name.compare(shipType) == 0) { f->setCombatant(true); } } //Set visibility ObjectView* obv = new ObjectView(); obv->setObjectId(ob->getID()); obv->setCompletelyVisible(true); views.insert(obv); } //Set initial external combat strength else if(ob->getType() == obtm->getObjectTypeByName("Planet") && !isInternal) { Planet* p = (Planet*) ob->getObjectBehaviour(); StarSystem* sys = (StarSystem*) objectmanager->getObject(ob->getParent())->getObjectBehaviour(); if(regions.count(sys->getRegion()) > 0) { if(p->getResource(resourceType) > 0) { for(map<uint32_t, uint32_t>::iterator i = combatants.begin(); i != combatants.end(); ++i) { if(i->second == sys->getRegion()) { Fleet* leader = (Fleet*) (objectmanager->getObject(i->first))->getObjectBehaviour(); addReinforcement(leader->getOwner()); } } } } } } //Send message to players letting them know about combat Message * msg = new Message(); msg->setSubject("COMBAT!"); stringstream out; out << "The next turn is an "; if(isInternal) { out << "INTERNAL "; } else { out << "EXTERNAL "; } out << "combat turn! Combatants are: "; out << playermanager->getPlayer(*owners.begin())->getName(); out << " with an initial strength of "; out << strength[*owners.begin()] << " and "; out << playermanager->getPlayer(*owners.end())->getName(); out << " with an initial strength of "; out << strength[*owners.end()]; msg->setBody(out.str()); std::set<uint32_t> players = playermanager->getAllIds(); for(itcurr = players.begin(); itcurr != players.end(); ++itcurr) { Player* player = playermanager->getPlayer(*itcurr); player->postToBoard(msg); for(std::set<ObjectView*>::iterator i = views.begin(); i != views.end(); ++i) { player->getPlayerView()->addVisibleObject(*i); } } }