mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
tech research graph screen
This commit is contained in:
@@ -17,4 +17,19 @@ namespace battleship{
|
||||
if(activeState)
|
||||
activeState->addButton(this);
|
||||
}
|
||||
|
||||
//TODO optimize this code
|
||||
vector<Unit*> UnitButton::getUnits(int unitId){
|
||||
vector<Unit*> units;
|
||||
|
||||
ActiveGameState *activeState = (ActiveGameState*)(GameManager::getSingleton()->getStateManager()->getAppStateByType((int)AppStateType::ACTIVE_STATE));
|
||||
Player *player = activeState->getPlayer();
|
||||
vector<Unit*> selUnits = player->getSelectedUnits(), researchStructs = player->getUnitsById(unitId);
|
||||
|
||||
for(Unit *rs : researchStructs)
|
||||
if(find(selUnits.begin(), selUnits.end(), rs) != selUnits.end())
|
||||
units.push_back(rs);
|
||||
|
||||
return units;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user