diff -r b0482f81af3c -r 0986434f3af8 src/ai/api/ai_base.hpp --- a/src/ai/api/ai_base.hpp Fri Mar 16 10:00:17 2007 +0000 +++ b/src/ai/api/ai_base.hpp Fri Mar 16 10:14:14 2007 +0000 @@ -7,28 +7,31 @@ #include "ai_object.hpp" +/** + * Implementation of some basic function + * + * @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: /** * Get a random value. * @return A random value between 0 and MAX(uint32) */ -#if defined(RANDOM_DEBUG) - uint32 DoRandom(int line, const char *file); -#else - uint32 Random(); -#endif + uint32 Rand(); /** * Get a random value in a range. * @param max The maximum value it will return. * @return A random value between 0 .. max. */ -#if defined(RANDOM_DEBUG) - uint DoRandomRange(uint max, int line, const char *file); -#else - uint RandomRange(uint max); -#endif + uint RandRange(uint max); /** * Take a chance of 'out' out of 'max'. @@ -44,9 +47,9 @@ DefSQClass SQAIBase("AIBase"); SQAIBase.PreRegister(engine); SQAIBase.AddConstructor(engine); - SQAIBase.DefSQFunction(engine, &AIBase::Random, "Random"); - SQAIBase.DefSQFunction(engine, &AIBase::RandomRange, "RandomRange"); - SQAIBase.DefSQFunction(engine, &AIBase::Chance, "Chance"); + SQAIBase.DefSQFunction(engine, &AIBase::Rand, "Rand"); + SQAIBase.DefSQFunction(engine, &AIBase::RandRange, "RandRange"); + SQAIBase.DefSQFunction(engine, &AIBase::Chance, "Chance"); SQAIBase.PostRegister(engine); } #endif /* SQUIRREL_CLASS */