Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/ai/src/ai/ai_engine.cc @ 10135

Last change on this file since 10135 was 10135, checked in by tfahrni, 17 years ago
File size: 1.4 KB
Line 
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
22AIEngine* AIEngine::singletonRef = NULL;
23
24AIEngine::AIEngine(){
25        for(int i=0; i < maxTeams; i++ )teams[i]=NULL;
26}
27
28AITeam* AIEngine::getTeam(int teamNumber)
29{
30        if(teamNumber>maxTeams || teamNumber<0)return NULL;
31        return teams[teamNumber];
32}
33
34AITeam* 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
42void AIEngine::addTeam(int teamNumber)
43{
44        if(teamNumber>maxTeams || teamNumber<0)return;
45        teams[teamNumber]=new AITeam();
46}
47
48
49void AIEngine::removeTeam(int teamNumber)
50{
51        if(teamNumber>maxTeams || teamNumber<0)return;
52        teams[teamNumber]=NULL;
53}
54
55
56void 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
63void 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}
Note: See TracBrowser for help on using the repository browser.