[10029] | 1 | |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | orxonox - the future of 3D-vertical-scrollers |
---|
| 5 | |
---|
| 6 | Copyright (C) 2004 orx |
---|
| 7 | |
---|
| 8 | This program is free software; you can redistribute it and/or modify |
---|
| 9 | it under the terms of the GNU General Public License as published by |
---|
| 10 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 11 | any later version. |
---|
| 12 | |
---|
| 13 | ### File Specific: |
---|
| 14 | main-programmer: Patrick Boenzli |
---|
| 15 | co-programmer: |
---|
| 16 | */ |
---|
[10040] | 17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI |
---|
[10029] | 18 | |
---|
| 19 | #include "ai_engine.h" |
---|
[10040] | 20 | #include "debug.h" |
---|
[10029] | 21 | |
---|
[10040] | 22 | AIEngine* AIEngine::singletonRef = NULL; |
---|
[10029] | 23 | |
---|
[10135] | 24 | AIEngine::AIEngine(){ |
---|
| 25 | for(int i=0; i < maxTeams; i++ )teams[i]=NULL; |
---|
| 26 | } |
---|
[10040] | 27 | |
---|
[10135] | 28 | AITeam* AIEngine::getTeam(int teamNumber) |
---|
| 29 | { |
---|
| 30 | if(teamNumber>maxTeams || teamNumber<0)return NULL; |
---|
| 31 | return teams[teamNumber]; |
---|
| 32 | } |
---|
[10029] | 33 | |
---|
[10135] | 34 | AITeam* AIEngine::getCreateTeam(int teamNumber) |
---|
| 35 | { |
---|
| 36 | if(teamNumber>maxTeams || teamNumber<0)return NULL; |
---|
| 37 | if(teams[teamNumber]==NULL)teams[teamNumber]=new AITeam(); |
---|
| 38 | return teams[teamNumber]; |
---|
| 39 | } |
---|
[10040] | 40 | |
---|
| 41 | |
---|
[10135] | 42 | void AIEngine::addTeam(int teamNumber) |
---|
| 43 | { |
---|
| 44 | if(teamNumber>maxTeams || teamNumber<0)return; |
---|
| 45 | teams[teamNumber]=new AITeam(); |
---|
| 46 | } |
---|
[10041] | 47 | |
---|
[10135] | 48 | |
---|
| 49 | void AIEngine::removeTeam(int teamNumber) |
---|
[10041] | 50 | { |
---|
[10135] | 51 | if(teamNumber>maxTeams || teamNumber<0)return; |
---|
| 52 | teams[teamNumber]=NULL; |
---|
[10041] | 53 | } |
---|
| 54 | |
---|
| 55 | |
---|
[10135] | 56 | void AIEngine::tick(float dt) |
---|
[10041] | 57 | { |
---|
[10135] | 58 | for(int i=0; i < maxTeams; i++ ) |
---|
| 59 | if(teams[i]!=NULL)teams[i]->process(dt); |
---|
[10041] | 60 | } |
---|
| 61 | |
---|
| 62 | |
---|
[10135] | 63 | void AIEngine::rebuildAIVector(){ |
---|
| 64 | //AIVector.clear(); |
---|
[10041] | 65 | |
---|
[10135] | 66 | //for(int i=0; i < maxTeams; i++ ) |
---|
| 67 | //if(teams[i]!=NULL)AIVector.push_back(teams[i]); |
---|
[10040] | 68 | } |
---|