unit unlock research

This commit is contained in:
devZoGok
2024-03-09 14:05:45 +02:00
parent 7d8cb88194
commit aaf1ee61b9
6 changed files with 24 additions and 4 deletions
+14 -1
View File
@@ -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;
}
}