# HG changeset patch # User tron # Date 1127457246 0 # Node ID df659fbe7e4fb02f1fb616b2f08516230ca58b4c # Parent b475b9d30a268a47bb4fc2fe89b5384893a0c588 (svn r2972) Fix the speed of the AI diff -r b475b9d30a26 -r df659fbe7e4f ai/ai.c --- a/ai/ai.c Thu Sep 22 20:58:14 2005 +0000 +++ b/ai/ai.c Fri Sep 23 06:34:06 2005 +0000 @@ -149,27 +149,9 @@ _ai.tick++; /* Make sure the AI follows the difficulty rule.. */ - switch (_opt.diff.competitor_speed) { - case 0: // Very slow - if (!(_ai.tick & 8)) return; - break; - - case 1: // Slow - if (!(_ai.tick & 4)) return; - break; - - case 2: // Medium - if (!(_ai.tick & 2)) return; - break; - - case 3: // Fast - if (!(_ai.tick & 1)) return; - break; - - case 4: // Very fast - default: - break; - } + assert(_opt.diff.competitor_speed <= 4); + if ((_ai.tick & ((1 << (4 - _opt.diff.competitor_speed)) - 1)) != 0) + return; /* Check for AI-client (so joining a network with an AI) */ if (_ai.network_client) {