Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/network/WANDiscovery.h @ 9615

Last change on this file since 9615 was 8858, checked in by landauf, 13 years ago

merged output branch back to trunk.

Changes:

  • you have to include util/Output.h instead of util/Debug.h
  • COUT(x) is now called orxout(level)
  • output levels are now defined by an enum instead of numbers. see util/Output.h for the definition
  • it's possible to use output contexts with orxout(level, context). see util/Output.h for some common contexts. you can define more contexts
  • you must use 'endl' at the end of an output message, '\n' does not flush the message

Output levels:

  • instead of COUT(0) use orxout()
  • instead of COUT(1) use orxout(user_error) or orxout(internal_error)
  • instead of COUT(2) use orxout(user_warning) or orxout(internal_warning)
  • instead of COUT(3) use orxout(user_status/user_info) or orxout(internal_status/internal_info)
  • instead of COUT(4) use orxout(verbose)
  • instead of COUT(5) use orxout(verbose_more)
  • instead of COUT(6) use orxout(verbose_ultra)

Guidelines:

  • user_* levels are for the user, visible in the console and the log-file
  • internal_* levels are for developers, visible in the log-file
  • verbose_* levels are for debugging, only visible if the context of the output is activated

Usage in C++:

  • orxout() << "message" << endl;
  • orxout(level) << "message" << endl;
  • orxout(level, context) << "message" << endl;

Usage in Lua:

  • orxout("message")
  • orxout(orxonox.level.levelname, "message")
  • orxout(orxonox.level.levelname, "context", "message")

Usage in Tcl (and in the in-game-console):

  • orxout levelname message
  • orxout_context levelname context message
  • shortcuts: log message, error message, warning message, status message, info message, debug message
  • Property svn:eol-style set to native
File size: 2.8 KB
RevLine 
[7161]1/*
[7745]2 *   ORXONOX - the hottest 3D action shooter ever to exist > www.orxonox.net <
[7161]3 *
4 *
5 *   License notice:
6 *
[7745]7 *   This program is free software; you can redistribute it and/or modify it
8 *   under the terms of the GNU General Public License as published by the Free
9 *   Software Foundation; either version 2 of the License, or (at your option)
10 *   any later version.
[7161]11 *
[7745]12 *   This program is distributed in the hope that it will be useful, but
13 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 *   for more details.
[7161]16 *
[7745]17 *   You should have received a copy of the GNU General Public License along
18 *   with this program; if not, write to the Free Software Foundation, Inc., 51
19 *   Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
[7161]20 *
[8858]21 *   Author:
22 *      Sandro 'smerkli' Merkli
23 *   Co-authors:
24 *      Oliver Scheuss (original)
[7161]25 *
26 */
27
[7770]28#ifndef _WANDiscovery_H__
29#define _WANDiscovery_H__
[7161]30
31#include "NetworkPrereqs.h"
32#include "packet/ServerInformation.h"
[7737]33#include "core/ConfigFileManager.h"
34#include "core/OrxonoxClass.h"
35#include "core/ConfigValueIncludes.h"
36#include "core/CoreIncludes.h"
[7631]37#include "MasterServerComm.h"
[7650]38#include "MasterServerProtocol.h"
[7161]39
40#include <vector>
41
[7692]42#define WANDISC_MAXTRIES 5
[7631]43
[7161]44// tolua_begin
45namespace orxonox
46{
47
[7630]48  class _NetworkExport WANDiscovery
[7161]49// tolua_end
[8858]50    : public OrxonoxClass
[7161]51  { // tolua_export
52    public:
[7631]53      /** constructor */
[8858]54      WANDiscovery(); // tolua_export
[7631]55
56      /** destructor */
[7630]57      ~WANDiscovery();
[7631]58
[7750]59      /** \return Address of the master server
60       *
61       * Get the master server address
62       */
[7745]63      std::string getMSAddress()
64      { return this->msaddress; }
65
[7631]66      /** ask server for server list  */
[7161]67      void discover(); // tolua_export
[7631]68
69      /** \param index Index to get the name of
70       * \return The name of the server
71       *
72       * Get the name of the server at index index.
73       */
[7161]74      std::string getServerListItemName( unsigned int index ); // tolua_export
[7631]75
76      /** \param index Index to get the IP of
77       * \return The IP of the server
78       *
79       * Get the IP of the server at index index.
80       */
[7161]81      std::string getServerListItemIP( unsigned int index ); // tolua_export
[7631]82
[7672]83      /* todo: might make this private and use getter/setter methods
84       * at some later time.
85       */
[7657]86      /** game server list */
87      std::vector<packet::ServerInformation> servers_;
[7737]88
89      /** Function used for the configuration file parameter update */
90      void setConfigValues();
[7763]91
92      /** Master server communications object */
93      MasterServerComm msc;
[8858]94
95      int rhandler( char *addr, ENetEvent *ev );
[7161]96     
97    private:
[7737]98      /** master server address */
[7739]99      std::string msaddress;
[7737]100
[7161]101  }; // tolua_export
102
103} // tolua_export
104
[7770]105#endif // _WANDiscovery_H__
Note: See TracBrowser for help on using the repository browser.