Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 10, 2018, 3:06:55 PM (6 years ago)
Author:
merholzl
Message:

Merged Masterserver, refresh button had to be removed

Location:
code/branches/mergeFS18
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/mergeFS18

  • code/branches/mergeFS18/src/libraries/network/packet/Chat.cc

    r11071 r12027  
    3838#define   PACKET_FLAGS_CHAT PacketFlag::Reliable
    3939
    40 /* Some lengths */
     40/* Some lengths / offsets */
    4141#define _PACKETID         0
    4242#define _SOURCEID         _PACKETID + sizeof(Type)
     
    4949{
    5050  /* Add chat flag to packet flags */
    51   flags_ = flags_ | PACKET_FLAGS_CHAT;
     51  this->flags_ |= PACKET_FLAGS_CHAT;
    5252
    5353  /* set message length to length of input string + 1 */
    54   messageLength_ = message.length()+1;
     54  this->messageLength_ = message.length() + 1;
    5555
    5656  /* allocate memory for the data */
    57   data_=new unsigned char[ getSize() ];
     57  this->data_ = new unsigned char[ getSize() ];
    5858
    5959  *(Type *)(data_ + _PACKETID ) = Type::Chat;
    6060  *(unsigned int *)(data_ + _SOURCEID ) = sourceID;
    6161  *(unsigned int *)(data_ + _TARGETID ) = targetID;
    62   *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
     62  *(unsigned int *)(data_ + _MESSAGELENGTH ) = this->messageLength_;
    6363
    6464  /* cast the hell out of the message string, and copy it into the
    6565   * data buffer.
    6666   */
    67   memcpy( data_+_MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), messageLength_ );
     67  memcpy( this->data_ + _MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), this->messageLength_ );
    6868}
    6969
     
    7171  : Packet(data, clientID)
    7272{
    73   messageLength_ = *(uint32_t *)(data + _MESSAGELENGTH );
     73  this->messageLength_ = *(uint32_t *)(data + _MESSAGELENGTH );
    7474}
    7575
     
    7979
    8080unsigned int Chat::getSize() const{
    81   return _MESSAGE + messageLength_;
     81  return _MESSAGE + this->messageLength_;
    8282}
    8383
    8484bool Chat::process(orxonox::Host* host){
    85   host->doReceiveChat(std::string((const char*)data_+_MESSAGE), *(uint32_t *)(data_+_SOURCEID), *(uint32_t *)(data_+_TARGETID));
     85  host->doReceiveChat(std::string((const char*)this->data_ + _MESSAGE),
     86                                  *(uint32_t *)(this->data_+_SOURCEID),
     87                                  *(uint32_t *)(this->data_+_TARGETID));
    8688  delete this;
    8789  return true;
    8890}
    8991
    90 unsigned char *Chat::getMessage(){
    91   return data_ + _MESSAGE;
     92unsigned char *Chat::getMessage() {
     93  return this->data_ + _MESSAGE;
    9294}
    9395
Note: See TracChangeset for help on using the changeset viewer.