1
/* $Id: ai_base.hpp 15060 2009-01-13 15:44:36Z smatz $ */
3
/** @file ai_base.hpp Everything to query basic things. */
8
#include "ai_object.hpp"
11
* Class that handles some basic functions.
13
* @note The random functions are not called Random and RandomRange, because
14
* RANDOM_DEBUG does some tricky stuff, which messes with those names.
15
* @note In MP we cannot use Random because that will cause desyncs (AIs are
16
* ran on the server only, not on all clients). This means that
17
* we use InteractiveRandom in MP. Rand() takes care of this for you.
19
class AIBase : public AIObject {
21
static const char *GetClassName() { return "AIBase"; }
25
* @return A random value between 0 and MAX(uint32).
31
* @param unused_param This param is not used, but is needed to work with lists.
32
* @return A random value between 0 and MAX(uint32).
34
static uint32 RandItem(int unused_param);
37
* Get a random value in a range.
38
* @param max The first number this function will never return (the maximum it returns is max - 1).
39
* @return A random value between 0 .. max - 1.
41
static uint RandRange(uint max);
44
* Get a random value in a range.
45
* @param unused_param This param is not used, but is needed to work with lists.
46
* @param max The first number this function will never return (the maximum it returns is max - 1).
47
* @return A random value between 0 .. max - 1.
49
static uint RandRangeItem(int unused_param, uint max);
52
* Returns approximatelly 'out' times true when called 'max' times.
53
* After all, it is a random function.
54
* @param out How many times it should return true.
55
* @param max Out of this many times.
56
* @return True if the chance worked out.
58
static bool Chance(uint out, uint max);
61
* Returns approximatelly 'out' times true when called 'max' times.
62
* After all, it is a random function.
63
* @param unused_param This param is not used, but is needed to work with lists.
64
* @param out How many times it should return true.
65
* @param max Out of this many times.
66
* @return True if the chance worked out.
68
static bool ChanceItem(int unused_param, uint out, uint max);
71
#endif /* AI_BASE_HPP */