Panda3D

aiWorld.h

00001 ////////////////////////////////////////////////////////////////////////
00002 // Filename    : aiWorld.h
00003 // Created by  : Deepak, John, Navin
00004 // Date        :  8 Sep 09
00005 ////////////////////////////////////////////////////////////////////
00006 //
00007 // PANDA 3D SOFTWARE
00008 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00009 //
00010 // All use of this software is subject to the terms of the revised BSD
00011 // license.  You should have received a copy of this license along
00012 // with this source code in a file named "LICENSE."
00013 //
00014 ////////////////////////////////////////////////////////////////////
00015 
00016 #pragma warning (disable:4996)
00017 #pragma warning (disable:4005)
00018 #pragma warning(disable:4275)
00019 
00020 
00021 #ifndef _AIWORLD_H
00022 #define _AIWORLD_H
00023 
00024 #include "aiGlobals.h"
00025 #include "aiCharacter.h"
00026 #include "flock.h"
00027 
00028 class AICharacter;
00029 class Flock;
00030 
00031 ///////////////////////////////////////////////////////////////////////
00032 //
00033 // Class : AICharPool
00034 //  Description : This class implements a linked list of AI Characters allowing
00035 //              the user to add and delete characters from the linked list.
00036 //              This will be used in the AIWorld class.
00037 
00038 ////////////////////////////////////////////////////////////////////////
00039 
00040 
00041 class EXPCL_PANDAAI AICharPool {
00042     public:
00043     struct node {
00044       AICharacter * _ai_char;
00045       node * _next;
00046     } ;
00047 
00048     node* _head;
00049     AICharPool();
00050     ~AICharPool();
00051     void append(AICharacter *ai_ch);
00052     void del(string name);
00053         void print_list();
00054 };
00055 
00056 
00057 ///////////////////////////////////////////////////////////////////////
00058 //
00059 // Class : AIWorld
00060 //  Description : A class that implements the virtual AI world which keeps track
00061 //              of the AI characters active at any given time. It contains a linked
00062 //              list of AI characters, obstactle data and unique name for each
00063 //              character. It also updates each characters state. The AI characters
00064 //              can also be added to the world as flocks.
00065 
00066 ////////////////////////////////////////////////////////////////////////
00067 
00068 
00069 class EXPCL_PANDAAI AIWorld {
00070   private:
00071     AICharPool * _ai_char_pool;
00072     NodePath _render;
00073   public:
00074     vector<NodePath> _obstacles;
00075     typedef std::vector<Flock*> FlockPool;
00076     FlockPool _flock_pool;
00077     void remove_ai_char_from_flock(string name);
00078 
00079 PUBLISHED:
00080     AIWorld(NodePath render);
00081     ~AIWorld();
00082 
00083     void add_ai_char(AICharacter *ai_ch);
00084     void remove_ai_char(string name);
00085 
00086     void add_flock(Flock *flock);
00087     void flock_off(unsigned int flock_id);
00088     void flock_on(unsigned int flock_id);
00089     void remove_flock(unsigned int flock_id);
00090     Flock get_flock(unsigned int flock_id);
00091 
00092     void add_obstacle(NodePath obstacle);
00093     void remove_obstacle(NodePath obstacle);
00094 
00095     void print_list();
00096     void update();
00097 };
00098 
00099 #endif
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
 All Classes Functions Variables Enumerations