@@ -46,7 +46,7 @@ public int maxHitPoints {
4646
4747 public TileDirection facingDirection ;
4848
49- public int WorkerProgressTowardsJob { get ; set ; }
49+ public float WorkerProgressTowardsJob { get ; set ; }
5050 public Terraform WorkerJob { get ; set ; }
5151
5252
@@ -144,8 +144,14 @@ public bool DeservesPlayerAttention() {
144144 private const int JOB_PROGRESS_WORKER = 2 ;
145145 private const int JOB_PROGRESS_SLAVE = 1 ;
146146
147- private static int GetWorkerJobCost ( Terraform workerJob ) {
148- return workerJob . TurnsToComplete ;
147+ private static int GetWorkerJobCost ( Tile tile , Terraform workerJob ) {
148+ // For the movement cost multiplier, see note 7
149+ // (https://apolyton.net/forum/civilization-series/civilization-iii/59815-civilization-iii-bic-file-format-2nd-thread?p=1362768#post1362768)
150+ // For example, clearing a forest has a cost of 4, but with a nomral
151+ // worker that would take 2 turns. In order for the job to take the
152+ // expected 4 turns we need to multiply by the movement cost of the
153+ // terrain. This also makes roading hills/mountains more expensive.
154+ return workerJob . TurnsToComplete * tile . overlayTerrainType . movementCost ;
149155 }
150156
151157 public void animate ( MapUnit . AnimatedAction action , bool wait , AnimationEnding ending = AnimationEnding . Stop ) {
@@ -571,8 +577,8 @@ public bool move(TileDirection dir, bool wait = false) {
571577 return true ;
572578 }
573579
574- private int SumWorkerProgress ( Tile tile , Terraform workerJob ) {
575- int result = 0 ;
580+ private float SumWorkerProgress ( Tile tile , Terraform workerJob ) {
581+ float result = 0 ;
576582 foreach ( MapUnit unit in tile . unitsOnTile ) {
577583 if ( WorkerJob == workerJob ) {
578584 result += WorkerProgressTowardsJob ;
@@ -598,7 +604,7 @@ public void PerformBusyAction() {
598604 updateWorkerJob ( ) ;
599605
600606 // See if this worker finished the job.
601- if ( SumWorkerProgress ( location , WorkerJob ) >= GetWorkerJobCost ( WorkerJob ) ) {
607+ if ( ( int ) SumWorkerProgress ( location , WorkerJob ) >= GetWorkerJobCost ( location , WorkerJob ) ) {
602608 location . FinishWorkerJob ( WorkerJob ) ;
603609 }
604610 }
@@ -677,7 +683,12 @@ public void PerformTerraformAction(Terraform terraform) {
677683 }
678684
679685 public void updateWorkerJob ( ) {
680- WorkerProgressTowardsJob += JOB_PROGRESS_WORKER ;
686+ float progressPerTurn = JOB_PROGRESS_WORKER ;
687+ if ( owner . civilization . traits . Contains ( Civilization . Trait . Industrious ) ) {
688+ progressPerTurn *= 1.5f ;
689+ }
690+
691+ WorkerProgressTowardsJob += progressPerTurn ;
681692 movementPoints . onConsumeAll ( ) ;
682693 }
683694
0 commit comments