npcnear.h

Go to the documentation of this file.
00001 /*
00002  *  npcnear.h - At random times, run proximity usecode functions on nearby NPC's.
00003  *
00004  *  Copyright (C) 2000-2001  The Exult Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef NPCNEAR_H
00022 #define NPCNEAR_H 1
00023 
00024 #include "lists.h"
00025 #include "tqueue.h"
00026 
00027 class Game_window;
00028 class Npc_actor;
00029 
00030 /*
00031  *  This class keeps track of NPC's nearby, and randomly runs the Usecode
00032  *  proximity functions for them.
00033  */
00034 class Npc_proximity_handler : public Time_sensitive
00035   {
00036   Game_window *gwin;
00037   unsigned long wait_until; // Skip running usecodes until past.
00038 public:
00039   Npc_proximity_handler(Game_window *gw) : gwin(gw)
00040     {
00041     wait_until = 0;
00042     }
00043           // Add npc to queue.
00044   void add(unsigned long curtime, Npc_actor *npc,
00045           int additional_secs = 0);
00046   void remove(Npc_actor *npc);  // Remove.
00047           // Run usecode function.
00048   void handle_event(unsigned long curtime, long udata);
00049           // Wait before running more funs.
00050   void wait(int secs);
00051   void get_all(Actor_queue& list);  // Fill list with nearby NPC's.
00052   };
00053 
00054 #endif  /* INCL_NPCNEAR */

Generated on Mon Jul 9 14:42:48 2007 for ExultEngine by  doxygen 1.5.1