Limit maximum production quantity in DirectorWorker: Updated the production calculation to cap the output at 100 units per start, ensuring it does not exceed available capacity or financial constraints. Enhanced comments for better understanding of the production limits.
This commit is contained in:
@@ -496,7 +496,14 @@ impl DirectorWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let to_produce = free_capacity.min(max_money_production).min(300).max(0);
|
// Maximale Produktionsmenge begrenzen:
|
||||||
|
// - nie mehr als der freie Lagerplatz (`free_capacity`)
|
||||||
|
// - nie mehr als durch das verfügbare Geld finanzierbar
|
||||||
|
// - absolut maximal 100 Einheiten pro Start
|
||||||
|
let to_produce = free_capacity
|
||||||
|
.min(max_money_production)
|
||||||
|
.min(100)
|
||||||
|
.max(0);
|
||||||
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"[DirectorWorker] Produktionsberechnung: free_capacity={}, one_piece_cost={}, max_money_production={}, to_produce={}",
|
"[DirectorWorker] Produktionsberechnung: free_capacity={}, one_piece_cost={}, max_money_production={}, to_produce={}",
|
||||||
|
|||||||
Reference in New Issue
Block a user