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 | */ |
---|
17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI |
---|
18 | |
---|
19 | #include "ai_engine.h" |
---|
20 | #include "debug.h" |
---|
21 | |
---|
22 | AIEngine* AIEngine::singletonRef = NULL; |
---|
23 | |
---|
24 | AIEngine::AIEngine(){ |
---|
25 | for(int i=0; i < maxTeams; i++ )teams[i]=NULL; |
---|
26 | } |
---|
27 | |
---|
28 | AITeam* AIEngine::getTeam(int teamNumber) |
---|
29 | { |
---|
30 | if(teamNumber>maxTeams || teamNumber<0)return NULL; |
---|
31 | return teams[teamNumber]; |
---|
32 | } |
---|
33 | |
---|
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 | } |
---|
40 | |
---|
41 | |
---|
42 | void AIEngine::addTeam(int teamNumber) |
---|
43 | { |
---|
44 | if(teamNumber>maxTeams || teamNumber<0)return; |
---|
45 | teams[teamNumber]=new AITeam(); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | void AIEngine::removeTeam(int teamNumber) |
---|
50 | { |
---|
51 | if(teamNumber>maxTeams || teamNumber<0)return; |
---|
52 | teams[teamNumber]=NULL; |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | void AIEngine::tick(float dt) |
---|
57 | { |
---|
58 | for(int i=0; i < maxTeams; i++ ) |
---|
59 | if(teams[i]!=NULL)teams[i]->process(dt); |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | void AIEngine::rebuildAIVector(){ |
---|
64 | //AIVector.clear(); |
---|
65 | |
---|
66 | //for(int i=0; i < maxTeams; i++ ) |
---|
67 | //if(teams[i]!=NULL)AIVector.push_back(teams[i]); |
---|
68 | } |
---|