Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MessageQueue.cpp

Go to the documentation of this file.
00001 #include "MessageQueue.h"
00002 
00003 MessageQueue::MessageQueue(int max){
00004         this->num = 0;
00005         this->max = max;
00006         this->msg = new Message();
00007 }
00008 
00009 void MessageQueue::newMessage(int playerid, const char *msg){
00010         this->msg->setLastMsg(playerid, msg);
00011         num++;
00012 }
00013 
00014 
00015 void MessageQueue::newMessage(msgstruct msg){
00016         this->msg->setLastMsg(msg.playerid, msg.msg);
00017         num++;
00018 }
00019 
00020 
00021 
00022 int MessageQueue::getNumMessages(){
00023         return(num);
00024 }
00025 
00026 
00027 msgstruct MessageQueue::getNextMessage(){
00028         msgstruct msg;
00029         if(num==0){
00030                 msg.playerid = -1;
00031                 msg.msg[0] = NULL;
00032                 return(msg);
00033         }
00034         msg = this->msg->getMsgStruct();
00035         this->msg = this->msg->getNextMsg();
00036         num--;
00037         return(msg);
00038 }
00039 
00040 bool MessageQueue::isEmpty(){
00041         if(this->num == 0)
00042                 return(true);
00043         return(false);
00044 }
00045 
00046 
00047 int MessageQueue::delMessageFrom(int id){
00048         int n = 0;
00049         bool b = true;
00050         while(b){
00051                 if(this->msg->isFrom() == id){
00052                         
00053                 }
00054         }
00055         return(n);
00056 }

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3