00001 /* $Id: player.hpp 24730 2008-03-17 05:11:14Z dave $ */ 00002 /* 00003 Copyright (C) 2003 - 2008 by David White <dave@whitevine.net> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License version 2 00008 or at your option any later version. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 #ifndef PLAYER_HPP_INCLUDED 00016 #define PLAYER_HPP_INCLUDED 00017 00018 #include <ctime> 00019 00020 #include "../config.hpp" 00021 #include "simple_wml.hpp" 00022 00023 #include <string> 00024 00025 class player 00026 { 00027 public: 00028 player(const std::string& n, simple_wml::node& cfg, const size_t max_messages=4, const size_t time_period=10); 00029 00030 // mark a player as member of the game 'game_id' or as located in the lobby 00031 void mark_available(const int game_id=0, const std::string location=""); 00032 00033 00034 const std::string& name() const { return name_; } 00035 00036 simple_wml::node* config_address() const { return &cfg_; } 00037 00038 bool silenced() const { return messages_since_flood_start_ > MaxMessages; } 00039 bool is_message_flooding(); 00040 00041 private: 00042 const std::string name_; 00043 simple_wml::node& cfg_; 00044 00045 time_t flood_start_; 00046 unsigned int messages_since_flood_start_; 00047 const size_t MaxMessages; 00048 const time_t TimePeriod; 00049 }; 00050 00051 #endif
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |