Author: mordante
Date: Sat Jun 7 16:58:51 2008
New Revision: 27029
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27029&view=rev
Log:
Update doxygen comment style.
Modified:
trunk/src/random.cpp
trunk/src/random.hpp
Modified: trunk/src/random.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/random.cpp?rev=27029&r1=27028&r2=27029&view=diff
==============================================================================
--- trunk/src/random.cpp (original)
+++ trunk/src/random.cpp Sat Jun 7 16:58:51 2008
@@ -12,29 +12,30 @@
See the COPYING file for more details.
*/
-
-//! @file random.cpp
-//! Generate random numbers.
-//!
-//! There are various ways to get a random number.
-//! rand() This can be used for things that never are send over
the
-//! network e.g. generate a random map (the final result
the
-//! map is send, but the other players don't need to
generate
-//! the map.
-//!
-//! get_random() A random generator which is syncronized over the
network
-//! this only seems to work when it's used by 1 player at
the
-//! same time. It's syncronized after an event so if an
event
-//! runs at two clients at the same time it gets out of
sync
-//! and sets the entire game out of sync.
-//!
-//! game_state::get_random()
-//! A random generator which is seeded by the host of an MP
-//! game. This generator is (not yet) synchronized over the
-//! network. It's only used by [set_variable]rand=. The map
-//! designer has to make sure it stays in sync. This
-//! generator can be used at the same time at multiple
client
-//! since the generators are always in sync.
+/**
+ * @file random.cpp
+ * Generate random numbers.
+ *
+ * There are various ways to get a random number.
+ * rand() This can be used for things that never are send over
the
+ * network e.g. generate a random map (the final result
the
+ * map is send, but the other players don't need to
generate
+ * the map.
+ *
+ * get_random() A random generator which is syncronized over the
network
+ * this only seems to work when it's used by 1 player at
the
+ * same time. It's syncronized after an event so if an
event
+ * runs at two clients at the same time it gets out of
sync
+ * and sets the entire game out of sync.
+ *
+ * game_state::get_random()
+ * A random generator which is seeded by the host of an MP
+ * game. This generator is (not yet) synchronized over the
+ * network. It's only used by [set_variable]rand=. The map
+ * designer has to make sure it stays in sync. This
+ * generator can be used at the same time at multiple
client
+ * since the generators are always in sync.
+ */
#include "global.hpp"
@@ -135,14 +136,15 @@
{}
simple_rng::simple_rng(const config& cfg) :
- //! @todo older savegames don't have random_seed stored, evaluate later
- //! whether default can be removed again. Look after branching 1.5.
+ /**
+ * @todo older savegames don't have random_seed stored, evaluate later
+ * whether default can be removed again. Look after branching 1.5.
+ */
random_seed_(lexical_cast_default<int>(cfg["random_seed"], 42)),
random_pool_(random_seed_),
random_calls_(0)
{}
-//! Get a new random number.
int simple_rng::get_random()
{
random_next();
@@ -153,22 +155,11 @@
return (static_cast<unsigned>(random_pool_ / 65536) % 32768);
}
-//! Seeds the random pool.
-//!
-//! @param call_count Upon loading we need to restore the state at saving
-//! so set the number of times a random number is generated
-//! for replays the orginal value is required.
void simple_rng::seed_random(const unsigned call_count)
{
seed_random(random_seed_, call_count);
}
-//! Seeds the random pool.
-//!
-//! @param seed The initial value for the random engine.
-//! @param call_count Upon loading we need to restore the state at saving
-//! so set the number of times a random number is generated
-//! for replays the orginal value is required.
void simple_rng::seed_random(const int seed, const unsigned call_count)
{
random_pool_ = seed;
@@ -181,7 +172,6 @@
// << random_pool_ << '\n';
}
-//! Sets the next random number in the pool.
void simple_rng::random_next()
{
// Use the simple random generator as shown in man rand(3).
Modified: trunk/src/random.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/random.hpp?rev=27029&r1=27028&r2=27029&view=diff
==============================================================================
--- trunk/src/random.hpp (original)
+++ trunk/src/random.hpp Sat Jun 7 16:58:51 2008
@@ -13,8 +13,7 @@
See the COPYING file for more details.
*/
-//! @file random.hpp
-//!
+/** @file random.hpp */
#ifndef RANDOM_H_INCLUDED
#define RANDOM_H_INCLUDED
@@ -59,17 +58,35 @@
simple_rng();
simple_rng(const config& cfg);
- //! Get a new random number.
+ /** Get a new random number. */
int get_random();
- //! Seeds the random pool.
+ /**
+ * Seeds the random pool.
+ *
+ * @param call_count Upon loading we need to restore the state at
saving
+ * so set the number of times a random number is
+ * generated for replays the orginal value is
+ * required.
+ */
void seed_random(const unsigned call_count = 0);
- //! Seeds the random pool.
+
+ /**
+ * Seeds the random pool.
+ *
+ * @param seed The initial value for the random engine.
+ * @param call_count Upon loading we need to restore the state at
saving
+ * so set the number of times a random number is
+ * generated for replays the orginal value is
+ * required.
+ */
void seed_random(const int seed, const unsigned call_count = 0);
- //! Resets the random to the 0 calls and the seed to the random
- //! this way we stay in the same sequence but don't have a lot
- //! calls. Used when moving to the next scenario.
+ /**
+ * Resets the random to the 0 calls and the seed to the random
+ * this way we stay in the same sequence but don't have a lot
+ * calls. Used when moving to the next scenario.
+ */
void rotate_random()
{ random_seed_ = random_pool_; random_calls_ = 0; }
@@ -78,16 +95,16 @@
int get_random_calls() const { return random_calls_; }
private:
- //! Initial seed for the pool.
+ /** Initial seed for the pool. */
int random_seed_;
- //! State for the random pool.
+ /** State for the random pool. */
int random_pool_;
- //! Number of time a random number is generated.
+ /** Number of time a random number is generated. */
unsigned random_calls_;
- //! Sets the next random number in the pool.
+ /** Sets the next random number in the pool. */
void random_next();
};
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits