Changeset 6885 for code/branches/chat2/src/orxonox/ChatInputHandler.cc
- Timestamp:
- May 10, 2010, 4:24:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/chat2/src/orxonox/ChatInputHandler.cc
r6879 r6885 117 117 { ChatInputHandler::getInstance().activate( false ); } 118 118 119 120 121 119 122 void ChatInputHandler::activate( bool full ) 120 123 { … … 142 145 } 143 146 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 ) 145 179 { 146 180 /* already start offsetting 5 characters before end */ … … 213 247 Host::Chat( msgtosend ); 214 248 215 /* d) stop listening to input */249 /* d) stop listening to input - only if this is not fullchat */ 216 250 if( !this->fullchat ) 217 251 this->deactivate(); 218 252 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();226 253 } 227 254
Note: See TracChangeset
for help on using the changeset viewer.