Update to 14.0-beta1
This commit is contained in:
@@ -18,60 +18,63 @@
|
||||
*
|
||||
* @note The random functions are not called Random and RandomRange, because
|
||||
* RANDOM_DEBUG does some tricky stuff, which messes with those names.
|
||||
* @note In MP we cannot use Random because that will cause desyncs (scripts are
|
||||
* ran on the server only, not on all clients). This means that
|
||||
* we use InteractiveRandom in MP. Rand() takes care of this for you.
|
||||
*/
|
||||
class ScriptBase : public ScriptObject {
|
||||
public:
|
||||
/**
|
||||
* Get a random value.
|
||||
* @return A random value between 0 and MAX(uint32).
|
||||
* @return A random value between 0 and MAX(uint32_t).
|
||||
*/
|
||||
static uint32 Rand();
|
||||
static SQInteger Rand();
|
||||
|
||||
/**
|
||||
* Get a random value.
|
||||
* @param unused_param This parameter is not used, but is needed to work with lists.
|
||||
* @return A random value between 0 and MAX(uint32).
|
||||
* @return A random value between 0 and MAX(uint32_t).
|
||||
*/
|
||||
static uint32 RandItem(int unused_param);
|
||||
static SQInteger RandItem(SQInteger unused_param);
|
||||
|
||||
/**
|
||||
* Get a random value in a range.
|
||||
* @param max The first number this function will never return (the maximum it returns is max - 1).
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @return A random value between 0 .. max - 1.
|
||||
*/
|
||||
static uint RandRange(uint max);
|
||||
static SQInteger RandRange(SQInteger max);
|
||||
|
||||
/**
|
||||
* Get a random value in a range.
|
||||
* @param unused_param This parameter is not used, but is needed to work with lists.
|
||||
* @param max The first number this function will never return (the maximum it returns is max - 1).
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @return A random value between 0 .. max - 1.
|
||||
*/
|
||||
static uint RandRangeItem(int unused_param, uint max);
|
||||
static SQInteger RandRangeItem(SQInteger unused_param, SQInteger max);
|
||||
|
||||
/**
|
||||
* Returns approximately 'out' times true when called 'max' times.
|
||||
* After all, it is a random function.
|
||||
* @param out How many times it should return true.
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @param max Out of this many times.
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @pre \a out is at most equal to \a max.
|
||||
* @return True if the chance worked out.
|
||||
*/
|
||||
static bool Chance(uint out, uint max);
|
||||
static bool Chance(SQInteger out, SQInteger max);
|
||||
|
||||
/**
|
||||
* Returns approximately 'out' times true when called 'max' times.
|
||||
* After all, it is a random function.
|
||||
* @param unused_param This parameter is not used, but is needed to work with lists.
|
||||
* @param out How many times it should return true.
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @param max Out of this many times.
|
||||
* The value will be clamped to 0 .. MAX(uint32_t).
|
||||
* @pre \a out is at most equal to \a max.
|
||||
* @return True if the chance worked out.
|
||||
*/
|
||||
static bool ChanceItem(int unused_param, uint out, uint max);
|
||||
static bool ChanceItem(SQInteger unused_param, SQInteger out, SQInteger max);
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_BASE_HPP */
|
||||
|
||||
Reference in New Issue
Block a user