truelight@9360: /* $Id$ */ truelight@9360: truelight@9388: /** @file ai_base.hpp declaration of class for AIBase class */ truelight@9360: truelight@9360: #ifndef AI_BASE_HPP truelight@9360: #define AI_BASE_HPP truelight@9360: truelight@9361: #include "ai_object.hpp" truelight@9360: rubidium@9440: /** truelight@9447: * Class that handles some basic functions. rubidium@9440: * rubidium@9440: * @note The random functions are not called Random and RandomRange, because rubidium@9440: * when including them the RANDOM_DEBUG stuff messes with their names. rubidium@9440: * However, because in MP we cannot use Random because that will cause rubidium@9440: * desyncs (AIs are ran locally, not on all clients). This means that rubidium@9440: * we use InteractiveRandom in MP, thus the whole random debugging is rubidium@9440: * pointless for the AIs. Therefor the random functions are called rubidium@9440: * differently. rubidium@9440: */ rubidium@9436: class AIBase : public AIObject { truelight@9361: public: truelight@9360: /** truelight@9529: * The name of the class, needed by several sub-processes. truelight@9529: */ truelight@9529: static const char *GetClassName() { return "AIBase"; } truelight@9529: truelight@9529: /** truelight@9360: * Get a random value. truelight@9447: * @return a random value between 0 and MAX(uint32). truelight@9360: */ truelight@9660: static uint32 Rand(); truelight@9360: truelight@9360: /** truelight@9360: * Get a random value in a range. truelight@9447: * @param max the maximum value it will return. truelight@9447: * @return a random value between 0 .. max. truelight@9360: */ truelight@9660: static uint RandRange(uint max); truelight@9360: truelight@9360: /** truelight@9447: * Returns approximatelly 'out' times true when called 'max' times. truelight@9447: * After all, it is a random function. truelight@9447: * @return true if the chance worked out. truelight@9360: */ truelight@9660: static bool Chance(uint out, uint max); truelight@9360: }; truelight@9360: truelight@9360: #endif /* AI_BASE_HPP */