ai_new.c
changeset 1260 632f63689178
parent 1253 6e5662905cb1
child 1299 39c06aba09aa
equal deleted inserted replaced
1259:8d8515e3da29 1260:632f63689178
   364     	if (!AiNew_Check_City_or_Industry(p, p->ainew.temp, p->ainew.from_type)) {
   364     	if (!AiNew_Check_City_or_Industry(p, p->ainew.temp, p->ainew.from_type)) {
   365     		// It was not a valid city
   365     		// It was not a valid city
   366     		//  increase the temp with one, and return. We will come back later here
   366     		//  increase the temp with one, and return. We will come back later here
   367     		//  to try again
   367     		//  to try again
   368     		p->ainew.temp++;
   368     		p->ainew.temp++;
   369         	if (p->ainew.from_type == AI_CITY) {
   369 				if (p->ainew.from_type == AI_CITY) {
   370         		if (p->ainew.temp >= _total_towns) p->ainew.temp = 0;
   370 					if (p->ainew.temp >= (int)_total_towns) p->ainew.temp = 0;
   371         	} else {
   371 				} else {
   372         		if (p->ainew.temp >= _total_industries) p->ainew.temp = 0;
   372 					if (p->ainew.temp >= _total_industries) p->ainew.temp = 0;
   373         	}
   373 				}
   374 
   374 
   375         	// Don't do an attempt if we are trying the same id as the last time...
   375         	// Don't do an attempt if we are trying the same id as the last time...
   376         	if (p->ainew.last_id == p->ainew.temp) return;
   376         	if (p->ainew.last_id == p->ainew.temp) return;
   377         	p->ainew.last_id = p->ainew.temp;
   377         	p->ainew.last_id = p->ainew.temp;
   378 
   378 
   487 	   			}
   487 	   			}
   488    			}
   488    			}
   489    		}
   489    		}
   490    	}
   490    	}
   491 
   491 
   492     // It was not a valid city
   492 	// It was not a valid city
   493    	//  increase the temp with one, and return. We will come back later here
   493 	//  increase the temp with one, and return. We will come back later here
   494    	//  to try again
   494 	//  to try again
   495    	p->ainew.temp++;
   495 	p->ainew.temp++;
   496     if (p->ainew.to_type == AI_CITY) {
   496 	if (p->ainew.to_type == AI_CITY) {
   497     	if (p->ainew.temp >= _total_towns) p->ainew.temp = 0;
   497 		if (p->ainew.temp >= (int)_total_towns) p->ainew.temp = 0;
   498     } else {
   498 	} else {
   499     	if (p->ainew.temp >= _total_industries) p->ainew.temp = 0;
   499 		if (p->ainew.temp >= _total_industries) p->ainew.temp = 0;
   500     }
   500 	}
   501 
   501 
   502    	// Don't do an attempt if we are trying the same id as the last time...
   502    	// Don't do an attempt if we are trying the same id as the last time...
   503    	if (p->ainew.last_id == p->ainew.temp) return;
   503    	if (p->ainew.last_id == p->ainew.temp) return;
   504    	p->ainew.last_id = p->ainew.temp;
   504    	p->ainew.last_id = p->ainew.temp;
   505 }
   505 }