Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7190 for code


Ignore:
Timestamp:
Aug 19, 2010, 5:48:01 PM (14 years ago)
Author:
landauf
Message:

removed unnecessary return values from console commands "log", "error", "warning", "info", and "debug"
removed return value from console command Chat (the non-static chat functions still return a bool)
config and tconfig don't return a bool anymore but instead print an error if the config value doesn't exist.

fixed console command "printRTT" - it shouldn't crash on a standalone system.

Location:
code/branches/consolecommands3/src/libraries
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc

    r7163 r7190  
    543543    }
    544544
    545     bool SettingsConfigFile::config(const std::string& section, const std::string& entry, const std::string& value)
    546     {
    547         return this->configImpl(section, entry, value, &ConfigValueContainer::set);
    548     }
    549 
    550     bool SettingsConfigFile::tconfig(const std::string& section, const std::string& entry, const std::string& value)
    551     {
    552         return this->configImpl(section, entry, value, &ConfigValueContainer::tset);
     545    void SettingsConfigFile::config(const std::string& section, const std::string& entry, const std::string& value)
     546    {
     547        if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
     548            COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
     549    }
     550
     551    void SettingsConfigFile::tconfig(const std::string& section, const std::string& entry, const std::string& value)
     552    {
     553        if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
     554            COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
    553555    }
    554556
  • code/branches/consolecommands3/src/libraries/core/ConfigFileManager.h

    r7163 r7190  
    331331            void clean(bool bCleanComments = false); // tolua_export
    332332
    333             bool config(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
    334             bool tconfig(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
     333            void config(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
     334            void tconfig(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
    335335            std::string getConfig(const std::string& section, const std::string& entry); // tolua_export
    336336
  • code/branches/consolecommands3/src/libraries/network/ClientConnection.cc

    r6417 r7190  
    149149  uint32_t ClientConnection::getRTT()
    150150  {
    151     assert(server_);
    152     return server_->roundTripTime;
     151    if (server_)
     152        return server_->roundTripTime;
     153    else
     154        return 0;
    153155  }
    154156
  • code/branches/consolecommands3/src/libraries/network/Host.cc

    r7163 r7190  
    8989  }
    9090
    91   bool Host::Chat(const std::string& message)
     91  void Host::Chat(const std::string& message)
    9292  {
    9393    if(instances_s.size()==0)
     
    9595      for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    9696        it->incomingChat(message, 0);
    97       return true;
     97//      return true;
    9898    }
    9999    else
     
    108108        }
    109109      }
    110       return result;
     110//      return result;
    111111    }
    112112  }
     
    139139    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    140140      it->incomingChat(message, playerID);
    141    
     141
    142142    bool result = true;
    143143    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
  • code/branches/consolecommands3/src/libraries/network/Host.h

    r7163 r7190  
    7979    static void setShipID(unsigned int id){ shipID_s = id; }
    8080    static bool isServer();
    81     static bool Chat(const std::string& message);
     81    static void Chat(const std::string& message);
    8282    static bool Broadcast(const std::string& message);
    8383    static bool incomingChat(const std::string& message, unsigned int playerID);
  • code/branches/consolecommands3/src/libraries/util/OutputHandler.h

    r6105 r7190  
    104104
    105105            //! Writes to all output devices
    106             static inline const std::string& log(const std::string& text)
    107                 { OutputHandler::getOutStream(0).output(text) << std::endl; return text; }
     106            static inline void log(const std::string& text)
     107                { OutputHandler::getOutStream(0).output(text) << std::endl; }
    108108
    109109            //! Writes an error message to the output
    110             static inline const std::string& error(const std::string& text)
    111                 { OutputHandler::getOutStream(1).output(text) << std::endl; return text; }
     110            static inline void error(const std::string& text)
     111                { OutputHandler::getOutStream(1).output(text) << std::endl; }
    112112
    113113            //! Writes a warning message to the output
    114             static inline const std::string& warning(const std::string& text)
    115                 { OutputHandler::getOutStream(2).output(text) << std::endl; return text; }
     114            static inline void warning(const std::string& text)
     115                { OutputHandler::getOutStream(2).output(text) << std::endl; }
    116116
    117117            //! Writes an informational message to the output
    118             static inline const std::string& info(const std::string& text)
    119                 { OutputHandler::getOutStream(3).output(text) << std::endl; return text; }
     118            static inline void info(const std::string& text)
     119                { OutputHandler::getOutStream(3).output(text) << std::endl; }
    120120
    121121            //! Writes a debug message to the output
    122             static inline const std::string& debug(const std::string& text)
    123                 { OutputHandler::getOutStream(4).output(text) << std::endl; return text; }
     122            static inline void debug(const std::string& text)
     123                { OutputHandler::getOutStream(4).output(text) << std::endl; }
    124124
    125125            //! Registers an object that receives output via a provided std::ostream
Note: See TracChangeset for help on using the changeset viewer.