Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10135 was 10135, checked in by tfahrni, 17 years ago
File size: 1.2 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: Thomas Fahrni
15   co-programmer:
16*/
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
18
19#include "ai_team.h"
20
21AITeam::AITeam(){
22        for(int i=0; i < maxSwarms; i++ )swarms[i]=NULL;
23}
24
25
26AISwarm* AITeam::getSwarm(int swarmNumber)
27{
28        if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
29        return swarms[swarmNumber];
30}
31
32
33AISwarm* AITeam::getCreateSwarm(int swarmNumber)
34{
35        if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
36        if(swarms[swarmNumber]==NULL)swarms[swarmNumber]=new AISwarm();
37        return swarms[swarmNumber];
38}
39
40
41void AITeam::addSwarm(int swarmNumber)
42{
43        if(swarmNumber>maxSwarms || swarmNumber<0)return;
44        swarms[swarmNumber]=new AISwarm();
45}
46
47
48void AITeam::removeSwarm(int swarmNumber)
49{
50        if(swarmNumber>maxSwarms || swarmNumber<0)return;
51        swarms[swarmNumber]=NULL;
52}
53
54
55void AITeam::process(float dt)
56{
57        for(int i=0; i < maxSwarms; i++ ){
58                if(swarms[i]!=NULL)swarms[i]->process(dt);
59        }
60}
61
62
Note: See TracBrowser for help on using the repository browser.