(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
/* $Id$ */
/** @file ai_base.hpp declaration of class for AIBase class */
#ifndef AI_BASE_HPP
#define AI_BASE_HPP
#include "ai_object.hpp"
/**
* Class that handles some basic functions.
*
* @note The random functions are not called Random and RandomRange, because
* when including them the RANDOM_DEBUG stuff messes with their names.
* However, because in MP we cannot use Random because that will cause
* desyncs (AIs are ran locally, not on all clients). This means that
* we use InteractiveRandom in MP, thus the whole random debugging is
* pointless for the AIs. Therefor the random functions are called
* differently.
*/
class AIBase : public AIObject {
public:
/**
* The name of the class, needed by several sub-processes.
*/
static const char *GetClassName() { return "AIBase"; }
/**
* Get a random value.
* @return a random value between 0 and MAX(uint32).
*/
static uint32 Rand();
/**
* Get a random value.
* @param unused_param This param is not used, but is needed to work with lists.
* @return a random value between 0 and MAX(uint32).
*/
static uint32 RandItem(int unused_param);
/**
* Get a random value in a range.
* @param max the maximum value it will return.
* @return a random value between 0 .. max.
*/
static uint RandRange(uint max);
/**
* Get a random value in a range.
* @param unused_param This param is not used, but is needed to work with lists.
* @param max the maximum value it will return.
* @return a random value between 0 .. max.
*/
static uint RandRangeItem(int unused_param, uint max);
/**
* Returns approximatelly 'out' times true when called 'max' times.
* After all, it is a random function.
* @param out how many times it should return true.
* @param max out of this many times.
* @return true if the chance worked out.
*/
static bool Chance(uint out, uint max);
/**
* Returns approximatelly 'out' times true when called 'max' times.
* After all, it is a random function.
* @param unused_param This param is not used, but is needed to work with lists.
* @param out how many times it should return true.
* @param max out of this many times.
* @return true if the chance worked out.
*/
static bool ChanceItem(int unused_param, uint out, uint max);
};
#endif /* AI_BASE_HPP */