Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6885


Ignore:
Timestamp:
May 10, 2010, 4:24:18 PM (15 years ago)
Author:
smerkli
Message:

Strage delete-button bug persists.

Location:
code/branches/chat2/src/orxonox
Files:
2 edited

Legend:

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

    r6879 r6885  
    117117  { ChatInputHandler::getInstance().activate( false ); }
    118118
     119
     120
     121
    119122  void ChatInputHandler::activate( bool full )
    120123  {
     
    142145  }
    143146
    144   void ChatInputHandler::sub_adjust_dispoffset( int maxlen, int cursorpos, int inplen )
     147
     148  void ChatInputHandler::incomingChat(const std::string& message,
     149    unsigned int senderID)
     150  {
     151    /* --> a) look up the actual name of the sender */
     152    std::string text;
     153
     154    if (senderID != CLIENTID_UNKNOWN)
     155    {
     156       std::string name = "unknown";
     157       PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
     158       if (player)
     159         name = player->getName();
     160
     161         text = name + ": " + message;
     162    }
     163    else
     164      text = message;
     165
     166    /* e) create item and add to history */
     167    CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( text );
     168    this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
     169    this->lb_history->ensureItemIsVisible( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
     170
     171    /* f) make sure the history handles it */
     172    this->lb_history->handleUpdatedItemData();
     173  }
     174
     175
     176  void ChatInputHandler::sub_adjust_dispoffset( int maxlen,
     177    int cursorpos,
     178    int inplen )
    145179  {
    146180    /* already start offsetting 5 characters before end */
     
    213247    Host::Chat( msgtosend );
    214248
    215     /* d) stop listening to input */
     249    /* d) stop listening to input - only if this is not fullchat */
    216250    if( !this->fullchat )
    217251      this->deactivate();
    218252
    219     /* e) create item and add to history */
    220     CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( msgtosend );
    221     this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
    222     this->lb_history->ensureItemIsVisible( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
    223 
    224     /* f) make sure the history handles it */
    225     this->lb_history->handleUpdatedItemData();
    226253  }
    227254
  • code/branches/chat2/src/orxonox/ChatInputHandler.h

    r6879 r6885  
    4747#include "core/input/InputState.h"
    4848
     49#include <network/ChatListener.h>
     50#include <PlayerManager.h>
     51#include <infos/PlayerInfo.h>
     52
    4953#include "../libraries/network/Host.h"
    5054#include <util/Singleton.h>
     
    5559  /* class to handle chat using an InputBuffer */
    5660  class _OrxonoxExport ChatInputHandler : public Singleton<ChatInputHandler>,
    57     public OrxonoxClass
     61    public ChatListener
    5862  {
    5963    private:
     
    8993      static void activate_static();
    9094      static void activate_small_static();
     95
     96      void incomingChat( const std::string& message,
     97        unsigned int senderID );
     98
    9199      void activate( bool full );
    92100      void deactivate();
Note: See TracChangeset for help on using the changeset viewer.