mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
unit unlock research
This commit is contained in:
@@ -265,7 +265,7 @@ namespace battleship{
|
||||
|
||||
Ability ability;
|
||||
ability.type = techTable["type"];
|
||||
ability.ammount = techTable["ammount"].get_or(0);
|
||||
ability.ammount = techTable["ammount"].get_or(0.0);
|
||||
ability.gameObjType = techTable["gameObjType"];
|
||||
ability.gameObjIds = parseTechTable(i, techKey, "numGameObjIds", "gameObjIds");
|
||||
abilities.push_back(ability);
|
||||
@@ -287,4 +287,17 @@ namespace battleship{
|
||||
|
||||
return ammount;
|
||||
}
|
||||
|
||||
bool Game::isUnitUnlocked(vector<int> techResearch, int unitId){
|
||||
for(int techId : techResearch){
|
||||
for(int abilId : technologies[techId].abilities){
|
||||
vector<int> ids = abilities[abilId].gameObjIds;
|
||||
|
||||
if(find(ids.begin(), ids.end(), unitId) != ids.end())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user