Esempio n. 1
0
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);
        
    }

}
Esempio n. 2
0
int TowerRules::GetSpeedUpgradeCost(Ref & t)
{
    Tower * to = (Tower*) &t;
    return to->GetSpeedUpgradesDone() * this->speedUpgradeCost;
}