ai/ai.c
changeset 2446 df659fbe7e4f
parent 2422 914a12dee832
child 2447 47f2b670fb22
equal deleted inserted replaced
2445:b475b9d30a26 2446:df659fbe7e4f
   147 
   147 
   148 	/* New tick */
   148 	/* New tick */
   149 	_ai.tick++;
   149 	_ai.tick++;
   150 
   150 
   151 	/* Make sure the AI follows the difficulty rule.. */
   151 	/* Make sure the AI follows the difficulty rule.. */
   152 	switch (_opt.diff.competitor_speed) {
   152 	assert(_opt.diff.competitor_speed <= 4);
   153 		case 0: // Very slow
   153 	if ((_ai.tick & ((1 << (4 - _opt.diff.competitor_speed)) - 1)) != 0)
   154 			if (!(_ai.tick & 8)) return;
   154 		return;
   155 			break;
       
   156 
       
   157 		case 1: // Slow
       
   158 			if (!(_ai.tick & 4)) return;
       
   159 			break;
       
   160 
       
   161 		case 2: // Medium
       
   162 			if (!(_ai.tick & 2)) return;
       
   163 			break;
       
   164 
       
   165 		case 3: // Fast
       
   166 			if (!(_ai.tick & 1)) return;
       
   167 			break;
       
   168 
       
   169 		case 4: // Very fast
       
   170 		default:
       
   171 			break;
       
   172 	}
       
   173 
   155 
   174 	/* Check for AI-client (so joining a network with an AI) */
   156 	/* Check for AI-client (so joining a network with an AI) */
   175 	if (_ai.network_client) {
   157 	if (_ai.network_client) {
   176 		/* Run the script */
   158 		/* Run the script */
   177 		AI_DequeueCommands(_ai.network_player);
   159 		AI_DequeueCommands(_ai.network_player);