Author: mordante
Date: Sat Sep 13 19:13:04 2008
New Revision: 29441
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29441&view=rev
Log:
Update doxygen comment style.
Modified:
trunk/src/gamestatus.cpp
trunk/src/gamestatus.hpp
Modified: trunk/src/gamestatus.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=29441&r1=29440&r2=29441&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Sat Sep 13 19:13:04 2008
@@ -12,8 +12,10 @@
See the COPYING file for more details.
*/
-//! @file gamestatus.cpp
-//! Maintain status of a game, load&save games.
+/**
+ * @file gamestatus.cpp
+ * Maintain status of a game, load&save games.
+ */
#include "global.hpp"
@@ -54,13 +56,15 @@
#ifdef _WIN32
#include <windows.h>
-//! conv_ansi_utf8()
-//! - Convert a string between ANSI encoding (for Windows filename) and UTF-8
-//! string &name
-//! - filename to be converted
-//! bool a2u
-//! - if true, convert the string from ANSI to UTF-8.
-//! - if false, reverse. (convert it from UTF-8 to ANSI)
+/**
+ * conv_ansi_utf8()
+ * - Convert a string between ANSI encoding (for Windows filename) and UTF-8
+ * string &name
+ * - filename to be converted
+ * bool a2u
+ * - if true, convert the string from ANSI to UTF-8.
+ * - if false, reverse. (convert it from UTF-8 to ANSI)
+ */
void conv_ansi_utf8(std::string &name, bool a2u) {
int wlen = MultiByteToWideChar(a2u ? CP_ACP : CP_UTF8, 0,
name.c_str(), -1, NULL, 0);
@@ -185,8 +189,6 @@
}
}
-//! Reads turns and time information from parameters.
-//! It sets random starting ToD and current_tod to config.
gamestatus::gamestatus(const config& time_cfg, int num_turns, game_state*
s_o_g) :
teams(0),
times_(),
@@ -248,8 +250,6 @@
}
}
-//! Returns time of day object in the turn.
-//! Correct time is calculated from current time.
time_of_day gamestatus::get_time_of_day_turn(int nturn) const
{
VALIDATE(times_.size(), _("No time of day has been defined."));
@@ -264,7 +264,6 @@
return times_[time];
}
-//! ~eturns time of day object for current turn.
time_of_day gamestatus::get_time_of_day() const
{
VALIDATE(times_.size(), _("No time of day has been defined."));
@@ -277,9 +276,6 @@
return get_time_of_day_turn(turn()-1);
}
-//! Returns time of day object in the turn.
-//! It first tries to look for specified.
-//! If no area time specified in location, it returns global time.
time_of_day gamestatus::get_time_of_day(int illuminated, const
gamemap::location& loc, int n_turn) const
{
time_of_day res = get_time_of_day_turn(n_turn);
@@ -307,8 +303,6 @@
return get_time_of_day(illuminated,loc,turn());
}
-//! Sets global time of day in this turn.
-//! Time is a number between 0 and n-1, where n is number of ToDs.
bool gamestatus::set_time_of_day(int newTime)
{
// newTime can come from network so have to take run time test
@@ -611,8 +605,7 @@
out.write_key_val("can_recruit", can_recruit_str);
}
-
-//! @deprecated, use other write_game below.
+/** @deprecated, use other write_game below. */
void write_game(const game_state& gamestate, config& cfg, WRITE_GAME_MODE mode)
{
log_scope("write_game");
@@ -732,8 +725,10 @@
}
}
-//! A structure for comparing to save_info objects based on their modified
time.
-//! If the times are equal, will order based on the name.
+/**
+ * A structure for comparing to save_info objects based on their modified time.
+ * If the times are equal, will order based on the name.
+ */
struct save_info_less_time {
bool operator()(const save_info& a, const save_info& b) const {
if (a.time_modified > b.time_modified) {
@@ -981,7 +976,7 @@
// Find the first human leader so we can display their icon in the load
menu.
- //! @todo Ideally we should grab all leaders if there's more than 1
human player?
+ /** @todo Ideally we should grab all leaders if there's more than 1
human player? */
std::string leader;
for(std::map<std::string, player_info>::const_iterator p =
gamestate.players.begin();
@@ -1062,7 +1057,7 @@
// Find the first human leader so we can display their icon in the load
menu.
- //! @todo Ideally we should grab all leaders if there's more than 1
human player?
+ /** @todo Ideally we should grab all leaders if there's more than 1
human player? */
std::string leader;
const config::child_list& players = cfg_save.get_children("player");
@@ -1172,9 +1167,6 @@
}
}
-//! Loads the recall list.
-//!
-//! @param players Reference to the players section to load.
void game_state::load_recall_list(const config::child_list& players)
{
if(!players.empty()) {
Modified: trunk/src/gamestatus.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.hpp?rev=29441&r1=29440&r2=29441&view=diff
==============================================================================
--- trunk/src/gamestatus.hpp (original)
+++ trunk/src/gamestatus.hpp Sat Sep 13 19:13:04 2008
@@ -12,9 +12,7 @@
See the COPYING file for more details.
*/
-//! @file gamestatus.hpp
-//!
-//!
+/** @file gamestatus.hpp */
#ifndef GAME_STATUS_HPP_INCLUDED
#define GAME_STATUS_HPP_INCLUDED
@@ -45,7 +43,7 @@
config command;
};
-//! Information on a particular player of the game.
+/** Information on a particular player of the game. */
struct player_info
{
player_info() :
@@ -56,13 +54,15 @@
can_recruit()
{}
- std::string name; //!< Stores the current_player name
- int gold; //!< Amount of gold the player has
saved
- bool gold_add; //!< Amount of gold is added to the
- //!< starting gold, if not it uses
the highest
- //!< of the two.
- std::vector<unit> available_units; //!< Units the player may recall
- std::set<std::string> can_recruit; //!< Units the player has the
ability to recruit
+ std::string name; /**< Stores the current_player name
*/
+ int gold; /**< Amount of gold the player has
saved */
+ bool gold_add; /**<
+
* Amount of gold is added to the
+
* starting gold, if not it uses the
+
* highest of the two.
+
*/
+ std::vector<unit> available_units; /**< Units the player may recall */
+ std::set<std::string> can_recruit; /**< Units the player has the
ability to recruit */
void debug();
};
@@ -76,27 +76,28 @@
~game_state();
game_state& operator=(const game_state& state);
- std::string label; //!< Name of the game
(e.g. name of save file).
- std::string version; //!< Version game was
created with.
- std::string campaign_type; //!< Type of the game
- campaign, multiplayer etc.
-
- std::string campaign_define; //!< If there is a
define the campaign uses to customize data
- std::vector<std::string> campaign_xtra_defines; //!< more
customization of data
-
- std::string campaign; //!< the campaign
being played
- std::string history; //!< ancestral IDs
- std::string abbrev; //!< the campaign
abbreviation
- std::string scenario; //!< the scenario
being played
- std::string next_scenario; //!< the scenario
coming next (for campaigns)
- std::string completion; //!< running. victory,
or defeat
-
- //! Information about campaign players who carry resources
- //! from previous levels, indexed by a string identifier
- // (which is the leader name by default, but can be set
- // with the "id" attribute of the "side" tag).
+ std::string label; /**< Name of the game
(e.g. name of save file). */
+ std::string version; /**< Version game was
created with. */
+ std::string campaign_type; /**< Type of the game
- campaign, multiplayer etc. */
+
+ std::string campaign_define; /**< If there is a
define the campaign uses to customize data */
+ std::vector<std::string> campaign_xtra_defines; /**< more
customization of data */
+
+ std::string campaign; /**< the campaign
being played */
+ std::string history; /**< ancestral IDs */
+ std::string abbrev; /**< the campaign
abbreviation */
+ std::string scenario; /**< the scenario
being played */
+ std::string next_scenario; /**< the scenario
coming next (for campaigns) */
+ std::string completion; /**< running. victory,
or defeat */
+
+ /**
+ * Information about campaign players who carry resources from previous
+ * levels, indexed by a string identifier (which is the leader name by
+ * default, but can be set with the "id" attribute of the "side" tag).
+ */
std::map<std::string, player_info> players;
- //! Return the Nth player, or NULL if no such player exists.
+ /** Return the Nth player, or NULL if no such player exists. */
player_info* get_player(const std::string& id);
std::vector<scoped_wml_variable*> scoped_variables;
@@ -123,92 +124,146 @@
const rand_rng::simple_rng& rng() const { return rng_; }
rand_rng::simple_rng& rng() { return rng_; }
- std::string difficulty; //!< The difficulty level the game is being
played on.
-
- //! If the game is saved mid-level, we have a series of replay steps
- //! to take the game up to the position it was saved at.
+ std::string difficulty; /**< The difficulty level the game is being
played on. */
+
+ /**
+ * If the game is saved mid-level, we have a series of replay steps
+ * to take the game up to the position it was saved at.
+ */
config replay_data;
- //! Saved starting state of the game.
- //! For multiplayer games, the position the game started in
- //! may be different to the scenario,
+ /**
+ * Saved starting state of the game.
+ *
+ * For multiplayer games, the position the game started in may be
different
+ * to the scenario.
+ */
config starting_pos;
- //! Snapshot of the game's current contents.
- //! i.e. unless the player selects to view a replay,
- //! the game's settings are read in from this object.
+ /**
+ * Snapshot of the game's current contents.
+ *
+ * i.e. unless the player selects to view a replay, the game's settings
are
+ * read in from this object.
+ */
config snapshot;
- //! the last location where a select event fired.
+ /** the last location where a select event fired. */
gamemap::location last_selected;
private:
rand_rng::simple_rng rng_ ;
config variables;
mutable config temporaries; // lengths of arrays, etc.
- const rand_rng::set_random_generator generator_setter; //! Make sure
that rng is initialized first
+ const rand_rng::set_random_generator generator_setter; /**< Make sure
that rng is initialized first */
friend struct variable_info;
- //! Loads the recall list.
+ /**
+ * Loads the recall list.
+ *
+ * @param players Reference to the players section to load.
+ */
void load_recall_list(const config::child_list& players);
};
-
-//! Contains the global status of the game.
-//! Namely the current turn, the number of turns, and the time of day.
+/**
+ * Contains the global status of the game.
+ *
+ * Namely the current turn, the number of turns, and the time of day.
+ */
class gamestatus
{
public:
+ /**
+ * Reads turns and time information from parameters.
+ *
+ * It sets random starting ToD and current_tod to config.
+ */
gamestatus(const config& time_cfg, int num_turns, game_state* s_o_g =
NULL);
void write(config& cfg) const;
+ /** Returns time of day object for current turn. */
time_of_day get_time_of_day() const;
time_of_day get_previous_time_of_day() const;
time_of_day get_time_of_day(int illuminated, const gamemap::location&
loc) const;
+
+ /**
+ * Returns time of day object in the turn.
+ *
+ * It first tries to look for specified. If no area time specified in
+ * location, it returns global time.
+ */
time_of_day get_time_of_day(int illuminated, const gamemap::location&
loc, int n_turn) const;
- bool set_time_of_day(int);
+
+ /**
+ * Sets global time of day in this turn.
+ *
+ * Time is a number between 0 and n-1, where n is number of ToDs.
+ */
+ bool set_time_of_day(int newTime);
size_t turn() const;
int number_of_turns() const;
void modify_turns(const std::string& mod);
void add_turns(int num);
- //! Dynamically change the current turn number.
+ /** Dynamically change the current turn number. */
void set_turn(unsigned int num);
- //! Function to move to the next turn.
- //! Returns true if time has not expired.
+ /**
+ * Function to move to the next turn.
+ *
+ * @returns True if time has not expired.
+ */
bool next_turn();
static bool is_start_ToD(const std::string&);
- //! Adds a new local time area from config, making it follow its own
- //! time-of-day sequence.
- //! @param cfg Config object containing x,y range/list of locations,
- //! and desired [time] information.
+ /**
+ * Adds a new local time area from config, making it follow its own
+ * time-of-day sequence.
+ *
+ * @param cfg Config object containing x,y range/list
of
+ * locations and desired [time] information.
+ */
void add_time_area(const config& cfg);
- //! Adds a new local time area from a set of locations, making those
- //! follow a different time-of-day sequence.
- //! @param id Identifier string to associate this time area
with.
- //! @param locs Set of locations to be affected.
- //! @param time_cfg Config object containing [time] information
+ /**
+ * Adds a new local time area from a set of locations, making those
+ * follow a different time-of-day sequence.
+ *
+ * @param id Identifier string to associate this time
area
+ * with.
+ * @param locs Set of locations to be affected.
+ * @param time_cfg Config object containing [time]
information.
+ */
void add_time_area(const std::string& id, const
std::set<gamemap::location>& locs,
const config& time_cfg);
- //! Removes a time area from config, making it follow the scenario's
- //! normal time-of-day sequence.
- //! @param id Identifier of time_area to remove. Supply an empty one
- //! to remove all local time areas.
+ /**
+ * Removes a time area from config, making it follow the scenario's
+ * normal time-of-day sequence.
+ *
+ * @param id Identifier of time_area to remove. Supply
an
+ * empty one to remove all local time areas.
+ */
void remove_time_area(const std::string& id);
- //! @todo FIXME: since gamestatus may be constructed with NULL
game_state* (by default),
- //! you should not rely on this function to return the current
game_state.
+ /**
+ * @todo FIXME: since gamestatus may be constructed with NULL
game_state* (by default),
+ * you should not rely on this function to return the current
game_state.
+ */
const game_state& sog() const{return(*state_of_game_);}
std::vector<team> *teams;
private:
void set_start_ToD(config&, game_state*);
+
+ /**
+ * Returns time of day object in the turn.
+ *
+ * Correct time is calculated from current time.
+ */
time_of_day get_time_of_day_turn(int nturn) const;
void next_time_of_day();
@@ -239,16 +294,19 @@
std::string generate_game_uuid();
-//! Holds all the data needed to start a scenario.
-//! I.e. this is the object serialized to disk when saving/loading a game.
-//! It is also the object which needs to be created to start a new game.
+/**
+ * Holds all the data needed to start a scenario.
+ *
+ * I.e. this is the object serialized to disk when saving/loading a game.
+ * It is also the object which needs to be created to start a new game.
+ */
struct save_info {
save_info(const std::string& n, time_t t) : name(n), time_modified(t) {}
std::string name;
time_t time_modified;
};
-//! Get a list of available saves.
+/** Get a list of available saves. */
std::vector<save_info> get_saves_list(const std::string* dir = NULL, const
std::string* filter = NULL);
enum WRITE_GAME_MODE { WRITE_SNAPSHOT_ONLY, WRITE_FULL_GAME };
@@ -258,20 +316,21 @@
void write_game(const game_state& gamestate, config& cfg, WRITE_GAME_MODE
mode=WRITE_FULL_GAME);
void write_game(config_writer &out, const game_state& gamestate,
WRITE_GAME_MODE mode=WRITE_FULL_GAME);
-//! Returns true iff there is already a savegame with that name.
+/** Returns true iff there is already a savegame with that name. */
bool save_game_exists(const std::string & name);
-//! Throws game::save_game_failed
+/** Throws game::save_game_failed. */
scoped_ostream open_save_game(const std::string &label);
void finish_save_game(config_writer &out, const game_state& gamestate, const
std::string &label);
-//! Load/Save games.
+/** Load/Save games. */
void load_game(const std::string& name, game_state& gamestate, std::string*
error_log);
void load_game_summary(const std::string& name, config& cfg_summary,
std::string* error_log);
-//! Throws gamestatus::save_game_failed
+
+/** Throws gamestatus::save_game_failed. */
void save_game(const game_state& gamestate);
-//! Delete a savegame.
+/** Delete a savegame. */
void delete_game(const std::string& name);
config& save_summary(const std::string& save);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits