void GeneticAlgorithmProfile1::SimulationForwardBackUp(ThreadData* td, AdditionalTowers& at) { GameScene* gs = ((GameScene*)td->_sc); //backup tower states td->towerStates.clear(); for ( std::list<Tower*>::iterator tower = gs->towerslist.begin(); tower != gs->towerslist.end(); ++tower ) { Tower* t = *tower; ThreadData::TStates ts; ts.damage = t->attackPoints; ts.speed = t->inbetweenAttacksPeriod; ts.attackUpgradesDone = t->GetAttackUpgradesDone(); ts.speedUpgradesDone = t->GetSpeedUpgradesDone(); std::pair<Tower*, ThreadData::TStates> p; p.first = t; p.second = ts; td->towerStates.insert(p); } }
int TowerRules::GetAttackUpgradeCost(Ref & t) { Tower * to = (Tower*) &t; return to->GetAttackUpgradesDone() * this->attackUpgradeCost; }