Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 7, 2011, 3:11:16 PM (14 years ago)
Author:
landauf
Message:

enhanced chat system. chat related code is now separated into network-side code (located in Host, Client, Server) and client-side code (located in ChatManager).
note that there are now two chat related listeners: NetworkChatListener, which is used to send chat from the network to ChatManager, and ChatListener, which is used to send online and offline chat from ChatManager to the actual chat interfaces (ChatOverlay, ChatInputHandler, …).
the "chat" console command now supports a second argument which is the clientID of the receiver. this allows private messages (or gameplay messages directed to only one specific player).

Location:
code/branches/output/src/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/modules/gametypes/RaceCheckPoint.cc

    r8822 r8829  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
    34 #include "network/Host.h"
     34#include "chat/ChatManager.h"
    3535#include "SpaceRace.h"
    3636
     
    112112                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
    113113                const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
    114                 Host::Broadcast(message);
     114                ChatManager::message(message);
    115115            }
    116116        }
  • code/branches/output/src/modules/gametypes/SpaceRace.cc

    r8822 r8829  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "network/Host.h"
    33 #include <util/Clock.h>
    34 #include <util/Math.h>
     32#include "chat/ChatManager.h"
     33#include "util/Clock.h"
     34#include "util/Math.h"
    3535#include "util/Convert.h"
    3636
     
    6060                        + " before the time limit. You lose!";
    6161            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    62             Host::Broadcast(message);
     62            ChatManager::message(message);
    6363        }
    6464        else
     
    7070                        + "." + multi_cast<std::string>(ms) + " seconds.";
    7171            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    72             Host::Broadcast(message);
     72            ChatManager::message(message);
    7373/*
    7474            float time = this->clock_.getSecondsPrecise();
     
    8686
    8787        std::string message("The match has started! Reach the check points as quickly as possible!");
    88         Host::Broadcast(message);
     88        ChatManager::message(message);
    8989    }
    9090
     
    9999                        + " seconds.";
    100100        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    101         Host::Broadcast(message);
     101        ChatManager::message(message);
    102102    }
    103103
  • code/branches/output/src/modules/overlays/hud/ChatOverlay.cc

    r8826 r8829  
    6767    }
    6868
    69     void ChatOverlay::incomingChat(const std::string& message, unsigned int senderID)
     69    void ChatOverlay::incomingChat(const std::string& message, const std::string& /*name*/)
    7070    {
    71         std::string text = message;
    72 
    73         if (senderID != NETWORK_PEER_ID_UNKNOWN)
    74         {
    75             PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
    76             if (player)
    77                 text = player->getName() + ": " + message;
    78         }
    79 
    80         this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
     71        this->messages_.push_back(multi_cast<Ogre::DisplayString>(message));
    8172
    8273        Timer* timer = new Timer();
  • code/branches/output/src/modules/overlays/hud/ChatOverlay.h

    r6417 r8829  
    3535#include <OgreOverlayElement.h>
    3636
    37 #include "network/ChatListener.h"
     37#include "chat/ChatListener.h"
    3838#include "overlays/OverlayText.h"
    3939
     
    4949
    5050        protected:
    51             virtual void incomingChat(const std::string& message, unsigned int senderID);
     51            virtual void incomingChat(const std::string& message, const std::string& name);
    5252
    5353            std::list<Ogre::DisplayString> messages_;
Note: See TracChangeset for help on using the changeset viewer.