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
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:
[10045]14   main-programmer: Thomas Fahrni
[10029]15   co-programmer:
16*/
[10041]17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
[10029]18
19#include "ai_team.h"
20
[10135]21AITeam::AITeam(){
22        for(int i=0; i < maxSwarms; i++ )swarms[i]=NULL;
23}
[10029]24
25
[10135]26AISwarm* AITeam::getSwarm(int swarmNumber)
[10041]27{
[10135]28        if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
29        return swarms[swarmNumber];
[10041]30}
31
32
[10135]33AISwarm* AITeam::getCreateSwarm(int swarmNumber)
[10041]34{
[10135]35        if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
36        if(swarms[swarmNumber]==NULL)swarms[swarmNumber]=new AISwarm();
37        return swarms[swarmNumber];
[10041]38}
39
40
[10135]41void AITeam::addSwarm(int swarmNumber)
[10041]42{
[10135]43        if(swarmNumber>maxSwarms || swarmNumber<0)return;
44        swarms[swarmNumber]=new AISwarm();
[10041]45}
[10135]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.