summaryrefslogtreecommitdiffstats
path: root/Game.cpp
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2011-11-29 15:14:18 +0100
committerDominique Martinet <asmadeus@codewreck.org>2011-11-29 15:14:18 +0100
commit49d47e8256467c1c01bba34058c40e660b9b0070 (patch)
tree65b02b09476f0d8a6e746e0a51d1feec4fb8631c /Game.cpp
parentfa22bba8c675945ecfb3161401c575aee3b38045 (diff)
better AI, removed debug
Diffstat (limited to 'Game.cpp')
-rw-r--r--Game.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/Game.cpp b/Game.cpp
index 8d4b0cd..7b570c5 100644
--- a/Game.cpp
+++ b/Game.cpp
@@ -27,14 +27,14 @@ Game::Game(int width, int height, PlayerNumber num):
}
m_vPlayers[i].setCoordinates(Coordinates(x,y));
- m_vPlayers[i].setVelocityVector(velocity);
+ m_vPlayers[i].setVelocity(velocity);
m_vPlayers[i].setNumber(i);
m_vPlayers[i].revive();
m_Field.getCell(Coordinates(x,y)).setState(PLAYER);
m_Field.getCell(Coordinates(x,y)).setPlayer(&m_vPlayers[i]);
// create AI
- AIController* cont = new AIController(m_vPlayers[i], m_Field, 5);
+ AIController* cont = new AIController(m_vPlayers[i], m_Field, 3);
m_vPlayers[i].setController(cont);
}
}
@@ -78,9 +78,11 @@ void Game::updateGame(uint timeElapsedMs) {
// ask the AI if they wanna change something?
for(std::vector<Player>::iterator player = m_vPlayers.begin(); player != m_vPlayers.end(); ++player) {
- if (player->getController()) {
- player->getController()->think();
- }
+ if (player->isAlive()) {
+ if (player->getController()) {
+ player->getController()->think();
+ }
+ }
}
// move everyone and update cells