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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/orxonox/chat/ChatInputHandler.cc

    r8828 r8829  
    4444#include "core/input/InputManager.h"
    4545#include "core/input/InputState.h"
    46 #include "network/Host.h"
    47 
     46
     47#include "chat/ChatManager.h"
    4848#include "PlayerManager.h"
    4949#include "infos/PlayerInfo.h"
     
    213213
    214214  /* handle incoming chat */
    215   void ChatInputHandler::incomingChat(const std::string& message,
    216     unsigned int senderID)
    217   {
    218     /* look up the actual name of the sender */
    219     std::string text = message;
    220     std::string name = "";
    221 
    222     /* setup player name info */
    223     if (senderID != NETWORK_PEER_ID_UNKNOWN)
    224     {
    225        PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
    226        if (player)
    227        {
    228          name = player->getName();
    229          text = name + ": " + message;
    230        }
    231     }
    232 
     215  void ChatInputHandler::incomingChat(const std::string& message, const std::string& name)
     216  {
    233217    /* create item */
    234     CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( text );
     218    CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( message );
    235219
    236220    /* setup colors */
     
    320304
    321305    /* c) send the chat via some call */
    322     Host::Chat( msgtosend );
     306    ChatManager::chat( msgtosend );
    323307
    324308    /* d) stop listening to input - only if this is not fullchat */
Note: See TracChangeset for help on using the changeset viewer.