[Orxonox-commit 4155] r8826 - in code/branches/output/src: modules/overlays/hud orxonox

landauf at orxonox.net landauf at orxonox.net
Sat Aug 6 15:40:37 CEST 2011


Author: landauf
Date: 2011-08-06 15:40:37 +0200 (Sat, 06 Aug 2011)
New Revision: 8826

Modified:
   code/branches/output/src/modules/overlays/hud/ChatOverlay.cc
   code/branches/output/src/orxonox/ChatHistory.cc
   code/branches/output/src/orxonox/ChatInputHandler.cc
Log:
display chat messages without sender without name (currently used for gameplay messages)

Modified: code/branches/output/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/branches/output/src/modules/overlays/hud/ChatOverlay.cc	2011-08-06 09:07:35 UTC (rev 8825)
+++ code/branches/output/src/modules/overlays/hud/ChatOverlay.cc	2011-08-06 13:40:37 UTC (rev 8826)
@@ -68,22 +68,14 @@
 
     void ChatOverlay::incomingChat(const std::string& message, unsigned int senderID)
     {
-        std::string text;
+        std::string text = message;
 
         if (senderID != NETWORK_PEER_ID_UNKNOWN)
         {
-            std::string name = "unknown";
-
             PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
             if (player)
-                name = player->getName();
-
-            text = name + ": " + message;
+                text = player->getName() + ": " + message;
         }
-        else
-        {
-            text = message;
-        }
 
         this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
 

Modified: code/branches/output/src/orxonox/ChatHistory.cc
===================================================================
--- code/branches/output/src/orxonox/ChatHistory.cc	2011-08-06 09:07:35 UTC (rev 8825)
+++ code/branches/output/src/orxonox/ChatHistory.cc	2011-08-06 13:40:37 UTC (rev 8826)
@@ -77,25 +77,16 @@
     unsigned int senderID)
   {
     /* --> a) look up the actual name of the sender */
-    std::string text;
+    std::string text = message;
 
 #ifndef CHATTEST
     /* get sender ID and prepend it to the message */
     if (senderID != NETWORK_PEER_ID_UNKNOWN)
     {
-      /* if we can't find anything, use "unknown" as default */
-      std::string name = "unknown";
-
       PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
       if (player)
-        name = player->getName();
-
-      text = name + ": " + message;
+        text = player->getName() + ": " + message;
     }
-    else
-      text = message;
-#else
-    text = message;
 #endif
 
     /* add the line to the history */

Modified: code/branches/output/src/orxonox/ChatInputHandler.cc
===================================================================
--- code/branches/output/src/orxonox/ChatInputHandler.cc	2011-08-06 09:07:35 UTC (rev 8825)
+++ code/branches/output/src/orxonox/ChatInputHandler.cc	2011-08-06 13:40:37 UTC (rev 8826)
@@ -216,24 +216,26 @@
     unsigned int senderID)
   {
     /* look up the actual name of the sender */
-    std::string text, name = "unknown";
+    std::string text = message;
+    std::string name = "";
 
     /* setup player name info */
     if (senderID != NETWORK_PEER_ID_UNKNOWN)
     {
        PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
        if (player)
+       {
          name = player->getName();
+         text = name + ": " + message;
+       }
     }
 
-    /* assemble the text */
-    text = name + ": " + message;
-
     /* create item */
     CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( text );
 
     /* setup colors */
-    sub_setcolor( toadd, name );
+    if (name != "")
+      sub_setcolor( toadd, name );
 
     /* now add */
     this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) );




More information about the Orxonox-commit mailing list