Author: mordante
Date: Sun Sep 21 09:31:38 2008
New Revision: 29602
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29602&view=rev
Log:
Update doxygen comment style.
Modified:
trunk/src/server/game.cpp
trunk/src/server/game.hpp
Modified: trunk/src/server/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/game.cpp?rev=29602&r1=29601&r2=29602&view=diff
==============================================================================
--- trunk/src/server/game.cpp (original)
+++ trunk/src/server/game.cpp Sun Sep 21 09:31:38 2008
@@ -194,12 +194,6 @@
send_observerjoins();
}
-//! Figures out which side to take and tells that side to the game owner.
-//! The owner then should send a [scenario_diff] that implements the side
-//! change and a subsequent update_side_data() call makes it actually
-//! happen.
-//! First we look for a side where save_id= or current_player= matches the
-//! new user's name then we search for the first controller="network" side.
bool game::take_side(const player_map::const_iterator user)
{
DBG_GAME << "take_side...\n";
@@ -264,7 +258,6 @@
return false;
}
-//! Resets the side configuration according to the scenario data.
void game::update_side_data() {
DBG_GAME << "update_side_data...\n";
DBG_GAME << debug_player_info();
@@ -458,7 +451,6 @@
}
}
-//! Send [change_controller] message to tell all clients the new controller's
name.
void game::send_change_controller(const size_t side_num,
const player_map::const_iterator newplayer, const bool
player_left)
{
@@ -584,7 +576,6 @@
}
}
-//! Checks whether the connection's ip address is banned.
bool game::player_is_banned(const network::connection sock) const {
std::vector<std::string>::const_iterator ban =
std::find(bans_.begin(), bans_.end(),
network::ip_address(sock));
@@ -600,8 +591,6 @@
}
}
-//! Mute an observer or give a message of all currently muted observers if no
-//! name is given.
void game::mute_observer(const simple_wml::node& mute, const
player_map::const_iterator muter) {
if (muter->first != owner_) {
send_server_message("You cannot mute: not the game host.",
muter->first);
@@ -627,13 +616,16 @@
return;
}
const player_map::const_iterator user = find_user(name);
- //! @todo FIXME: Maybe rather save muted nicks as a vector of strings
- //! and also allow muting of usernames not in the game.
+ /**
+ * @todo FIXME: Maybe rather save muted nicks as a vector of strings and
+ * also allow muting of usernames not in the game.
+ */
if (user == player_info_->end() || !is_observer(user->first)) {
send_server_message("Observer not found.", muter->first);
return;
}
- //! Prevent muting ourselves.
+
+ // Prevent muting ourselves.
if (user->first == muter->first) {
send_server_message("Don't mute yourself, silly.",
muter->first);
return;
@@ -649,8 +641,6 @@
send_and_record_server_message((user->second.name() + " has been
muted.").c_str());
}
-//! Kick a member by name.
-//! @return the network handle of the removed member if successful, '0'
otherwise.
network::connection game::kick_member(const simple_wml::node& kick,
const player_map::const_iterator kicker)
{
@@ -681,10 +671,6 @@
return user->first;
}
-//! Ban a user by name.
-//! The user does not need to be in this game but logged in.
-//! @return the network handle of the banned player if he was in this game, '0'
-//! otherwise.
network::connection game::ban_user(const simple_wml::node& ban,
const player_map::const_iterator banner)
{
@@ -777,12 +763,6 @@
return false;
}
-//! Handles [end_turn], repackages [commands] with private [speak]s in them
-//! and sends the data.
-//! Also filters commands from all but the current player.
-//! Currently removes all commands but [speak] for observers and all but
-//! [speak], [label] and [rename] for players.
-//! Returns true if the turn ended.
bool game::process_turn(simple_wml::document& data, const
player_map::const_iterator user) {
//DBG_GAME << "processing commands: '" << cfg << "'\n";
if (!started_) return false;
@@ -988,9 +968,6 @@
}
}
-//! Removes a user from the game.
-//! @return true iff the game ends that is if there are no more players
-//! or the host left on a not yet started game.
bool game::remove_player(const network::connection player, const bool
disconnect) {
if (!is_member(player)) {
ERR_GAME << "ERROR: User is not in this game. (socket: "
@@ -1088,7 +1065,7 @@
//if the game hasn't started yet, then send all players a list
//of the users in the game
if (started_ || description_ == NULL) return;
- //! @todo Should be renamed to userlist.
+ /** @todo Should be renamed to userlist. */
simple_wml::document cfg;
cfg.root().add_child("gamelist");
user_vector users = all_game_users();
@@ -1103,7 +1080,6 @@
send_data(cfg, exclude);
}
-//! A member asks for the next scenario to advance to.
void game::load_next_scenario(const player_map::const_iterator user) const {
send_server_message_to_all((user->second.name() + " advances to the
next scenario").c_str(), user->first);
simple_wml::document cfg_scenario;
@@ -1181,8 +1157,6 @@
return false;
}
-//! Send [observer] tags of all the observers in the game to the user or
-//! everyone if none given.
void game::send_observerjoins(const network::connection sock) const {
for (user_vector::const_iterator ob = observers_.begin(); ob !=
observers_.end(); ++ob) {
if (*ob == sock) continue;
@@ -1316,7 +1290,6 @@
return result.str();
}
-//! Find a user by name.
player_map::const_iterator game::find_user(const simple_wml::string_span&
name) const {
player_map::const_iterator pl;
for (pl = player_info_->begin(); pl != player_info_->end(); pl++) {
Modified: trunk/src/server/game.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/game.hpp?rev=29602&r1=29601&r2=29602&view=diff
==============================================================================
--- trunk/src/server/game.hpp (original)
+++ trunk/src/server/game.hpp Sun Sep 21 09:31:38 2008
@@ -46,6 +46,8 @@
bool allow_observers() const;
bool is_observer(const network::connection player) const;
bool is_player(const network::connection player) const;
+
+ /** Checks whether the connection's ip address is banned. */
bool player_is_banned(const network::connection player) const;
bool level_init() const { return level_.child("side") != NULL; }
bool started() const { return started_; }
@@ -55,44 +57,88 @@
size_t current_turn() const { return (nsides_ ? end_turn_ / nsides_ + 1
: 0); }
void mute_all_observers();
- //! Mute an observer by name.
+
+ /**
+ * Mute an observer or give a message of all currently muted observers
if no
+ * name is given.
+ */
void mute_observer(const simple_wml::node& mute, const
player_map::const_iterator muter);
- //! Kick a member by name.
+
+ /**
+ * Kick a member by name.
+ *
+ * @return The network handle of the removed member
if
+ * successful, '0' otherwise.
+ */
network::connection kick_member(const simple_wml::node& kick, const
player_map::const_iterator kicker);
- //! Ban and kick a user by name. He doesn't need to be in this game.
+
+ /**
+ * Ban and kick a user by name.
+ *
+ * The user does not need to be in this game but logged in.
+ *
+ * @return The network handle of the banned player
if he
+ * was in this game, '0' otherwise.
+ */
network::connection ban_user(const simple_wml::node& ban, const
player_map::const_iterator banner);
void add_player(const network::connection player, bool observer =
false);
+
+ /**
+ * Removes a user from the game.
+ *
+ * @return True iff the game ends that is if there
are
+ * no more players or the host left on a not
yet
+ * started game.
+ */
bool remove_player(const network::connection player, const bool
disconnect=false);
- //! Adds players and observers into one vector and returns that.
+ /** Adds players and observers into one vector and returns that. */
const user_vector all_game_users() const;
- //! Adds players from one game to another. This is used to add players
and
- //! observers from a game to the lobby (which is also implemented as a
game),
- //! if that game ends. The second parameter controls, wether the
players are
- //! added to the players_ or observers_ vector (default observers_).
+
+ /**
+ * Adds players from one game to another. This is used to add players
and
+ * observers from a game to the lobby (which is also implemented as a
game),
+ * if that game ends. The second parameter controls, wether the players
are
+ * added to the players_ or observers_ vector (default observers_).
+ */
void add_players(const game& other_game, const bool observer = true);
void start_game(const player_map::const_iterator starter);
- //! A user (player only?) asks for the next scenario to advance to.
+
+ /** A user (player only?) asks for the next scenario to advance to. */
void load_next_scenario(const player_map::const_iterator user) const;
- //! Resets the side configuration according to the scenario data.
+ /** Resets the side configuration according to the scenario data. */
void update_side_data();
- //! Let's a player owning a side give it to another player or observer.
+
+ /** Let's a player owning a side give it to another player or observer.
*/
void transfer_side_control(const network::connection sock, const
simple_wml::node& cfg);
void process_message(simple_wml::document& data, const
player_map::iterator user);
- //! Filters and processes (some) commands.
- //! Returns true iff the turn ended.
+
+ /**
+ * Handles [end_turn], repackages [commands] with private [speak]s in
them
+ * and sends the data.
+ * Also filters commands from all but the current player.
+ * Currently removes all commands but [speak] for observers and all but
+ * [speak], [label] and [rename] for players.
+ *
+ * @returns True if the turn ended.
+ */
bool process_turn(simple_wml::document& data, const
player_map::const_iterator user);
- //! Set the description to the number of available slots.
- //! Returns true iff the number of slots has changed.
+
+ /**
+ * Set the description to the number of available slots.
+ *
+ * @Returns True iff the number of slots has changed.
+ */
bool describe_slots();
void send_server_message_to_all(const char* message,
network::connection exclude=0) const;
void send_server_message(const char* message, network::connection
sock=0, simple_wml::document* doc=NULL) const;
- //! Send data to all players in this game except 'exclude'.
+
+ /** Send data to all players in this game except 'exclude'. */
void send_and_record_server_message(const char* message,
const network::connection exclude=0);
void send_data(simple_wml::document& data, const network::connection
exclude=0, std::string packet_type = "") const;
@@ -100,11 +146,13 @@
void record_data(simple_wml::document* data);
- //! The full scenario data.
+ /** The full scenario data. */
simple_wml::document& level() { return level_; }
- //! Functions to set/get the address of the game's summary description
as
- //! sent to players in the lobby.
+ /**
+ * Functions to set/get the address of the game's summary description as
+ * sent to players in the lobby.
+ */
void set_description(simple_wml::node* desc);
simple_wml::node* description() const { return description_; }
@@ -134,9 +182,18 @@
bool is_muted_observer(const network::connection player) const;
bool all_observers_muted() const { return all_observers_muted_; }
- //! Figures out which side to take and tells that side to the game
owner.
+ /**
+ * Figures out which side to take and tells that side to the game owner.
+ *
+ * The owner then should send a [scenario_diff] that implements the side
+ * change and a subsequent update_side_data() call makes it actually
+ * happen.
+ * First we look for a side where save_id= or current_player= matches
the
+ * new user's name then we search for the first controller="network"
side.
+ */
bool take_side(const player_map::const_iterator user);
- //! Send [change_controller] message to tell all clients the new
controller's name.
+
+ /** Send [change_controller] message to tell all clients the new
controller's name. */
void send_change_controller(const size_t side_num,
const player_map::const_iterator newplayer,
const bool player_left=true);
@@ -144,69 +201,91 @@
void send_data_team(simple_wml::document& data, const
simple_wml::string_span& team,
const network::connection exclude=0, std::string
packet_type = "") const;
void send_data_observers(simple_wml::document& data, const
network::connection exclude=0, std::string packet_type = "") const;
- //! Send [observer] tags of all the observers in the game to the user or
- //! everyone if none given.
+
+ /**
+ * Send [observer] tags of all the observers in the game to the user or
+ * everyone if none given.
+ */
void send_observerjoins(const network::connection sock=0) const;
void send_observerquit(const player_map::const_iterator observer) const;
void send_history(const network::connection sock) const;
- //! In case of a host transfer, notify the new host about its status.
+
+ /** In case of a host transfer, notify the new host about its status. */
void notify_new_host();
- //! Convenience function for finding a user by name.
+
+ /** Convenience function for finding a user by name. */
player_map::const_iterator find_user(const simple_wml::string_span&
name) const;
bool observers_can_label() const { return false; }
bool observers_can_chat() const { return true; }
bool is_legal_command(const simple_wml::node& command, bool is_player);
- //! Function which returns true iff 'player' is on 'team'.
+
+ /** Function which returns true iff 'player' is on 'team'. */
bool is_on_team(const simple_wml::string_span& team, const
network::connection player) const;
- //! Function which should be called every time a player ends their turn
- //! (i.e. [end_turn] received). This will update the 'turn' attribute
for
- //! the game's description when appropriate. Will return true iff there
has
- //! been a change.
+ /**
+ * Function which should be called every time a player ends their turn
+ * (i.e. [end_turn] received). This will update the 'turn' attribute for
+ * the game's description when appropriate. Will return true iff there
has
+ * been a change.
+ */
bool end_turn();
- //! Function to send a list of users to all clients.
- //! Only sends data if the game is initialized but not yet started.
+ /**
+ * Function to send a list of users to all clients.
+ *
+ * Only sends data if the game is initialized but not yet started.
+ */
void send_user_list(const network::connection exclude=0) const;
- //! Helps debugging player and observer lists.
+ /** Helps debugging player and observer lists. */
std::string debug_player_info() const;
player_map* player_info_;
static int id_num;
int id_;
- //! The name of the game.
+
+ /** The name of the game. */
std::string name_;
std::string password_;
- //! The game host or later owner (if the host left).
+
+ /** The game host or later owner (if the host left). */
network::connection owner_;
- //! A vector of players (members owning a side).
+
+ /** A vector of players (members owning a side). */
user_vector players_;
- //! A vector of observers (members not owning a side).
+
+ /** A vector of observers (members not owning a side). */
user_vector observers_;
user_vector muted_observers_;
- //! A vector of side owners.
+
+ /** A vector of side owners. */
side_vector sides_;
- //! A vector indicating what sides are actually taken. (Really needed?)
+
+ /** A vector indicating what sides are actually taken. (Really needed?)
*/
std::vector<bool> sides_taken_;
- //! A vector of controller strings indicating the type.
- //! "network" - a side controlled by some member of the game (not the
owner)
- //! "human" - a side controlled by the owner
- //! "ai" - a side of the owner controlled by an AI
- //! "null" - an empty side
+
+ /**
+ * A vector of controller strings indicating the type.
+ * "network" - a side controlled by some member of the game (not the
owner)
+ * "human" - a side controlled by the owner
+ * "ai" - a side of the owner controlled by an AI
+ * "null" - an empty side
+ */
std::vector<std::string> side_controllers_;
- //! Number of sides in the current scenario.
+ /** Number of sides in the current scenario. */
int nsides_;
bool started_;
- //! The current scenario data.
+ /** The current scenario data. */
simple_wml::document level_;
- //! Replay data.
+
+ /** Replay data. */
mutable std::vector<simple_wml::document*> history_;
- //! Pointer to the game's description in the games_and_users_list_.
+
+ /** Pointer to the game's description in the games_and_users_list_. */
simple_wml::node* description_;
int end_turn_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits