script.h

Go to the documentation of this file.
00001 /*
00002  *  The Mana World Server
00003  *  Copyright 2004 The Mana World Development Team
00004  *
00005  *  This file is part of The Mana World.
00006  *
00007  *  The Mana World is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  any later version.
00011  *
00012  *  The Mana World is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with The Mana World; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  *  $Id: script.h 2211 2006-03-06 00:26:05Z der_doener $
00022  */
00023 
00024 #ifndef SCRIPT_H
00025 #define SCRIPT_H
00026 
00027 #ifdef SCRIPT_SUPPORT
00028 
00029 #include <string>
00030 
00031 /*
00032  * Script
00033  * Script provides a simple class which is a simple interface
00034  * for defining a scripting backend. Each Script object consists
00035  * of an independant scripting environment.
00036  *
00037  * Requirements of Script Object:
00038  * - Each script object is independant from any other script object.
00039  * - A script is to be executed upon instantiation.
00040  * - A initialization and destruction function should be executed in
00041  *   the script if such a function is defined (the interface should
00042  *   provide default methods in case they are missing or not needed.)
00043  */
00044 class Script
00045 {
00046     protected:
00047         // Filename of the script corresponding to the script object
00048         std::string scriptName;
00049 
00050     public:
00051         Script(const std::string &file):scriptName(file) { }
00052 
00053         virtual ~Script() { }
00054 
00055         //State update
00056         virtual void update() = 0;
00057 
00058         //Execute specified function
00059         virtual bool execute(const std::string &) = 0;
00060 
00061         //Script sent raw message
00062         virtual void message(char *) = 0;
00063 };
00064 
00065 extern Script *script;                  // Global script (temporary?
00066 
00067 #endif
00068 
00069 #endif

Generated on Fri Mar 30 15:39:16 2007 for TMW Server by  doxygen 1.3.9.1