From c43c20b1e0b2167378e03d480bf7e22a3c6fd2a0 Mon Sep 17 00:00:00 2001
From: johns <>
Date: Fri, 8 Mar 2002 02:07:31 +0000
Subject: [PATCH] Assign more workers to the needed resources.

---
 src/ai/ai_resource.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/ai/ai_resource.cpp b/src/ai/ai_resource.cpp
index b944bb0a9..d7d43e3d8 100644
--- a/src/ai/ai_resource.cpp
+++ b/src/ai/ai_resource.cpp
@@ -1060,6 +1060,7 @@ local void AiCollectResources(void)
     Unit** units;
     Unit* unit;
     int p[MaxCosts] = { 0, 50, 50, 0 };
+    int pt = 100;
 
     //
     //	Collect statistics about the current assignment
@@ -1067,13 +1068,12 @@ local void AiCollectResources(void)
     for( i=0; i<MaxCosts; i++ ) {
 	rn[i]=0;
 	an[i]=0;
+	if( (AiPlayer->NeededMask&(1<<i)) ) {	// Double percent if needed
+	    pt+=p[i];
+	    p[i]<<=1;
+	}
     }
     total=un=0;
-#if 0
-    if( (AiPlayer->NeededMask&(1<<i)) ) {	// Double percent if needed
-	p[i]*=2;
-    }
-#endif
 
     n=AiPlayer->Player->TotalNumUnits;
     units=AiPlayer->Player->Units;
@@ -1163,8 +1163,8 @@ local void AiCollectResources(void)
 	unit=unassigned[i];
 
 	for( o=c=0; c<MaxCosts; ++c ) {
-	    DebugLevel3Fn("%d, %d, %d\n",(an[c]+rn[c])*p[c],p[c],total*100);
-	    if( (an[c]+rn[c])*100<total*p[c] ) {
+	    DebugLevel3Fn("%d, %d, %d\n",(an[c]+rn[c])*p[c],p[c],total*pt);
+	    if( (an[c]+rn[c])*pt<total*p[c] ) {
 		o=c;
 		break;
 	    }