Panda3D
aiWorld.h
1 ////////////////////////////////////////////////////////////////////////
2 // Filename : aiWorld.h
3 // Created by : Deepak, John, Navin
4 // Date : 8 Sep 09
5 ////////////////////////////////////////////////////////////////////
6 //
7 // PANDA 3D SOFTWARE
8 // Copyright (c) Carnegie Mellon University. All rights reserved.
9 //
10 // All use of this software is subject to the terms of the revised BSD
11 // license. You should have received a copy of this license along
12 // with this source code in a file named "LICENSE."
13 //
14 ////////////////////////////////////////////////////////////////////
15 
16 #pragma warning (disable:4996)
17 #pragma warning (disable:4005)
18 #pragma warning(disable:4275)
19 
20 
21 #ifndef _AIWORLD_H
22 #define _AIWORLD_H
23 
24 #include "aiGlobals.h"
25 #include "aiCharacter.h"
26 #include "flock.h"
27 
28 class AICharacter;
29 class Flock;
30 
31 ///////////////////////////////////////////////////////////////////////
32 //
33 // Class : AICharPool
34 // Description : This class implements a linked list of AI Characters allowing
35 // the user to add and delete characters from the linked list.
36 // This will be used in the AIWorld class.
37 
38 ////////////////////////////////////////////////////////////////////////
39 
40 
41 class EXPCL_PANDAAI AICharPool {
42  public:
43  struct node {
44  AICharacter * _ai_char;
45  node * _next;
46  } ;
47 
48  node* _head;
49  AICharPool();
50  ~AICharPool();
51  void append(AICharacter *ai_ch);
52  void del(string name);
53  void print_list();
54 };
55 
56 
57 ///////////////////////////////////////////////////////////////////////
58 //
59 // Class : AIWorld
60 // Description : A class that implements the virtual AI world which keeps track
61 // of the AI characters active at any given time. It contains a linked
62 // list of AI characters, obstactle data and unique name for each
63 // character. It also updates each characters state. The AI characters
64 // can also be added to the world as flocks.
65 
66 ////////////////////////////////////////////////////////////////////////
67 
68 
69 class EXPCL_PANDAAI AIWorld {
70  private:
71  AICharPool * _ai_char_pool;
72  NodePath _render;
73  public:
74  vector<NodePath> _obstacles;
75  typedef std::vector<Flock*> FlockPool;
76  FlockPool _flock_pool;
77  void remove_ai_char_from_flock(string name);
78 
79 PUBLISHED:
80  AIWorld(NodePath render);
81  ~AIWorld();
82 
83  void add_ai_char(AICharacter *ai_ch);
84  void remove_ai_char(string name);
85 
86  void add_flock(Flock *flock);
87  void flock_off(unsigned int flock_id);
88  void flock_on(unsigned int flock_id);
89  void remove_flock(unsigned int flock_id);
90  Flock get_flock(unsigned int flock_id);
91 
92  void add_obstacle(NodePath obstacle);
93  void remove_obstacle(NodePath obstacle);
94 
95  void print_list();
96  void update();
97 };
98 
99 #endif
100 
101 
102 
103 
104 
105 
106 
107 
108 
This class is used to define the flock attributes and the AI characters which are part of the flock...
Definition: flock.h:32
A class that implements the virtual AI world which keeps track of the AI characters active at any giv...
Definition: aiWorld.h:69
This class implements a linked list of AI Characters allowing the user to add and delete characters f...
Definition: aiWorld.h:41
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165