00001 #include "Message.h" 00002 00003 Message::Message(){ 00004 this->islast = true; 00005 // this->prevMessage = NULL; 00006 this->nextMessage = NULL; 00007 } 00008 00009 void Message::setLastMsg(int playerid, const char *msg){ 00010 if(islast){ 00011 // this->msg.msg = (char *)malloc(strlen(msg)); 00012 strcpy(this->msg.msg, msg); 00013 this->msg.playerid = playerid; 00014 islast = false; 00015 this->nextMessage = new Message(); 00016 // this->nextMessage->prevMessage = this; 00017 } 00018 else{ 00019 this->nextMessage->setLastMsg(playerid, msg); 00020 } 00021 } 00022 00023 msgstruct Message::getMsgStruct(){ 00024 return(this->msg); 00025 } 00026 00027 00028 bool Message::isLast(){ 00029 return(islast); 00030 } 00031 00032 00033 int Message::isFrom(){ 00034 return(this->msg.playerid); 00035 } 00036 00037 00038 Message *Message::getNextMsg(){ 00039 return(this->nextMessage); 00040 }