Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 7, 2011, 3:11:16 PM (13 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/libraries/network/Host.h

    r8403 r8829  
    5252class _NetworkExport Host: public GamestateManager
    5353{
     54  friend class packet::Chat;
     55
    5456  private:
    55     //TODO add these functions or adequate
    56     //virtual bool processChat(packet::Chat *message, unsigned int clientID)=0;
    57     //virtual bool sendChat(packet::Chat *chat)=0;
    5857    virtual void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID)=0;
    59     virtual bool chat(const std::string& message)=0;
    60     virtual bool broadcast(const std::string& message)=0;
    61     virtual bool processChat(const std::string& message, unsigned int playerID)=0;
    6258    virtual bool isServer_()=0;
    63 
    64 
    6559
    6660  protected:
     
    6862    virtual ~Host();
    6963    void setActive( bool bActive ){ bIsActive_ = bActive; }
    70 //     static Host *instance_;
     64
     65    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
     66    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
    7167
    7268  public:
     
    7470    static bool running(){ return instances_s.size(); }
    7571    static void addPacket(ENetPacket* packet, int clientID = NETWORK_PEER_ID_SERVER, uint8_t channelID = 0);
    76     //static bool chat(std::string& message);
    77 //     static bool receiveChat(packet::Chat *message, unsigned int clientID);
    7872    static unsigned int getPlayerID(){ return clientID_s; }
    7973    static void setClientID(unsigned int id){ clientID_s = id; }
    8074    static bool isServer();
    81     static void Chat(const std::string& message);
    82     static bool Broadcast(const std::string& message);
    83     static bool incomingChat(const std::string& message, unsigned int playerID);
     75    static void sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
    8476    virtual void printRTT()=0;
    8577    bool isActive(){ return bIsActive_; }
Note: See TracChangeset for help on using the changeset viewer.