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
RevLine 
[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]22AIEngine* AIEngine::singletonRef = NULL;
[10029]23
[10135]24AIEngine::AIEngine(){
25        for(int i=0; i < maxTeams; i++ )teams[i]=NULL;
26}
[10040]27
[10135]28AITeam* AIEngine::getTeam(int teamNumber)
29{
30        if(teamNumber>maxTeams || teamNumber<0)return NULL;
31        return teams[teamNumber];
32}
[10029]33
[10135]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}
[10040]40
41
[10135]42void AIEngine::addTeam(int teamNumber)
43{
44        if(teamNumber>maxTeams || teamNumber<0)return;
45        teams[teamNumber]=new AITeam();
46}
[10041]47
[10135]48
49void AIEngine::removeTeam(int teamNumber)
[10041]50{
[10135]51        if(teamNumber>maxTeams || teamNumber<0)return;
52        teams[teamNumber]=NULL;
[10041]53}
54
55
[10135]56void 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]63void 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}
Note: See TracBrowser for help on using the repository browser.