Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 22, 2009, 2:07:44 PM (14 years ago)
Author:
rgrieder
Message:

std::string tweaks:

  • Declared BLANKSTRING in UtilPrereqs.h as well (removed obsolete StringUtils.h includes to avoid dependencies)
  • Using BLANKSTRING if const std::string& return type is possible
  • Replaced a few (const) std::string arguments with const std::string&
  • if (str == "") —> if (str.empty())
  • std::string msg = name + "adsf"; —> const std::string& msg = name + "asdf";
  • std::string asdf = object→getFooBar(); —> const std::string& asdf = object→getFooBar();
  • std::string asdf = "asdf"; —> std::string asdf("asdf");
  • ostream << "."; and name + "." —> ostream << '.'; and name + '.'
  • str = ""; —> str.clear()
  • std::string asdf = ""; —> std::string asdf;
  • asdf_ = ""; (in c'tor) —> delete line
Location:
code/branches/presentation2/src/orxonox/gametypes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/gametypes/Asteroids.cc

    r5929 r6394  
    7272        Gametype::start();
    7373
    74         std::string message = "The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...";
     74        std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
    7575        COUT(0) << message << std::endl;
    7676        Host::Broadcast(message);
     
    8181        Gametype::end();
    8282
    83         std::string message = "The match has ended.";
     83        std::string message("The match has ended.");
    8484        COUT(0) << message << std::endl;
    8585        Host::Broadcast(message);
  • code/branches/presentation2/src/orxonox/gametypes/Deathmatch.cc

    r5781 r6394  
    4747        Gametype::start();
    4848
    49         std::string message = "The match has started!";
     49        std::string message("The match has started!");
    5050        COUT(0) << message << std::endl;
    5151        Host::Broadcast(message);
     
    5656        Gametype::end();
    5757
    58         std::string message = "The match has ended.";
     58        std::string message("The match has ended.");
    5959        COUT(0) << message << std::endl;
    6060        Host::Broadcast(message);
     
    6565        Gametype::playerEntered(player);
    6666
    67         std::string message = player->getName() + " entered the game";
     67        const std::string& message = player->getName() + " entered the game";
    6868        COUT(0) << message << std::endl;
    6969        Host::Broadcast(message);
     
    7676        if (valid_player)
    7777        {
    78             std::string message = player->getName() + " left the game";
     78            const std::string& message = player->getName() + " left the game";
    7979            COUT(0) << message << std::endl;
    8080            Host::Broadcast(message);
     
    9090        if (valid_player)
    9191        {
    92             std::string message = player->getOldName() + " changed name to " + player->getName();
     92            const std::string& message = player->getOldName() + " changed name to " + player->getName();
    9393            COUT(0) << message << std::endl;
    9494            Host::Broadcast(message);
     
    126126        if (player)
    127127        {
    128             std::string message = player->getName() + " scores!";
     128            const std::string& message = player->getName() + " scores!";
    129129            COUT(0) << message << std::endl;
    130130            Host::Broadcast(message);
  • code/branches/presentation2/src/orxonox/gametypes/Gametype.cc

    r6387 r6394  
    7171
    7272        // load the corresponding score board
    73         if (GameMode::showsGraphics() && this->scoreboardTemplate_ != "")
     73        if (GameMode::showsGraphics() && !this->scoreboardTemplate_.empty())
    7474        {
    7575            this->scoreboard_ = new OverlayGroup(this);
  • code/branches/presentation2/src/orxonox/gametypes/UnderAttack.cc

    r5929 r6394  
    6969    {
    7070        this->end(); //end gametype
    71         std::string message = "Ship destroyed! Team 0 has won!";
     71        std::string message("Ship destroyed! Team 0 has won!");
    7272        COUT(0) << message << std::endl;
    7373        Host::Broadcast(message);
     
    152152                this->gameEnded_ = true;
    153153                this->end();
    154                 std::string message = "Time is up! Team 1 has won!";
     154                std::string message("Time is up! Team 1 has won!");
    155155                COUT(0) << message << std::endl;
    156156                Host::Broadcast(message);
     
    171171            if ( gameTime_ <= timesequence_ && gameTime_ > 0)
    172172            {
    173                 std::string message = multi_cast<std::string>(timesequence_) + " seconds left!";
     173                const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
    174174/*
    175175                COUT(0) << message << std::endl;
Note: See TracChangeset for help on using the changeset viewer.