C++ - Lua player syncing refactoring

This commit is contained in:
devZoGok
2023-12-09 12:27:31 +02:00
parent 90ebaf467f
commit a3e40d7810
6 changed files with 35 additions and 15 deletions
+6 -2
View File
@@ -30,8 +30,12 @@ namespace battleship{
}
void Game::update(){
for(Player *p : players)
p->update();
for(int i = 0; i < players.size(); i++){
players[i]->update();
if(players[i]->isCpuPlayer())
generateView().script("game.players[" + to_string(i + 1) + "]:update()");
}
for(Projectile *proj : projectiles)
proj->update();