Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2008, 7:38:53 AM (15 years ago)
Author:
dafrick
Message:
  • QuestListener works now.
  • Rearranged the places Notifications are sent from, and also created actually meaningfull Notification messages
  • Done some changes to Notifications
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem3/src/orxonox/overlays/notifications/NotificationManager.cc

    r2328 r2346  
    8787        updateQueue();
    8888       
    89         COUT(3) << "Notification inserted, title: " << notification->getTitle() << ", message: " << notification->getMessage() << std::endl;
     89        COUT(4) << "Notification inserted. Title: " << notification->getTitle() << std::endl;
    9090       
    9191        return true;
     
    104104                continue;
    105105           
    106             COUT(3) << "Update, title: " << container->notification->getTitle() << ", message: " << container->notification->getMessage() << std::endl;
    107            
    108             text = text + "\n\n\n------------" + container->notification->getTitle() + "\n\n" + container->notification->getMessage();
     106            text = text + "\n\n\n------------\n\n" + container->notification->getTitle() + "\n\n" + container->notification->getMessage();
    109107        }
    110 
    111         COUT(3) << "Queue updated: " << text << std::endl;
    112108       
    113109        NotificationQueue::queue_s->setQueueText(text);
    114110    }
     111   
     112    const std::string & NotificationManager::clipMessage(const std::string & message)
     113    {
     114        std::string* clippedMessageP = new std::string();
     115        std::string clippedMessage = *clippedMessageP;
     116        clippedMessage = "";
     117        std::string tempWord = "";
     118        int wordLength = 0;
     119        signed int i = 0;
     120        int widthLeft = NotificationQueue::queue_s->getWidth();
     121        while(i < message.length())
     122        {
     123            while(i < message.length() && message[i] != ' ' && message[i] != '\n')
     124            {
     125                tempWord = tempWord + message[i];
     126                i++;
     127                wordLength++;
     128            }
     129           
     130            if(wordLength <= widthLeft)
     131            {
     132                clippedMessage = clippedMessage + tempWord + message[i];
     133                widthLeft -= (wordLength+1);
     134                wordLength = 0;
     135                tempWord = "";
     136                i++;
     137            }
     138            else
     139            {
     140                clippedMessage = clippedMessage + '\n' + tempWord + message[i];
     141                widthLeft = NotificationQueue::queue_s->getWidth() - (wordLength+1);
     142                i++;
     143                wordLength = 0;
     144                tempWord = "";
     145            }
     146        }
     147       
     148        return clippedMessage;
     149    }
    115150
    116151}
Note: See TracChangeset for help on using the changeset viewer.