commander_server.cpp

Go to the documentation of this file.
00001 /* MANTAINER: Bernard */
00002 
00003 #include "commander_server.h"
00004 #include "log.h"
00005 #include "application_server.h"
00006 
00007 using namespace std;
00008 
00009 
00010 #define TEST_CMD(name, function) \
00011         if ( cmd == name ) \
00012         { \
00013                 function(s, playerID); \
00014                 return; \
00015         }
00016 
00017 void CommanderServer::processCommand(const string &command, int playerID)
00018 {
00019         stringstream s(command);
00020         string cmd;
00021         
00022         LOGD << "Processing command " << command << endl;
00023 
00024         s >> cmd;
00025 
00026 // Other tests here
00027         TEST_CMD("/chat", command_chat);
00028 
00029         // if player has large privileges
00030         // {
00031                 TEST_CMD("/quit", command_quit);
00032         // }
00033 }
00034 
00035 
00036 void CommanderServer::command_chat(std::stringstream &args, int playerID)
00037 {
00038         //TODO: Here should be code that send the message to everybody
00039         
00040         LOGI << "Chat command: " << args << endl;
00041         
00042 }
00043 
00044 void CommanderServer::command_quit(std::stringstream &args, int playerID)
00045 {
00046         
00047         LOGI << "Quit command" << endl;
00048         
00049         // Here should be something like test for permissions to shut down the server!
00050         getAppServer().getGame().endFun();      
00051 }

Generated on Wed Apr 12 13:55:27 2006 for bjs by  doxygen 1.4.5