src/command.cpp
branchNewGRF_ports
changeset 6871 5a9dc001e1ad
parent 6870 ca3fd1fbe311
child 6872 1c4a4a609f85
--- a/src/command.cpp	Sat Oct 06 21:16:00 2007 +0000
+++ b/src/command.cpp	Mon Dec 03 23:39:38 2007 +0000
@@ -677,25 +677,13 @@
 
 CommandCost CommandCost::AddCost(Money cost)
 {
-	/* Overflow protection */
-	if (cost < 0 && (this->cost + cost) > this->cost) {
-		this->cost = INT64_MIN;
-	} else if (cost > 0 && (this->cost + cost) < this->cost) {
-		this->cost = INT64_MAX;
-	} else  {
-		this->cost += cost;
-	}
+	this->cost += cost;
 	return *this;
 }
 
 CommandCost CommandCost::MultiplyCost(int factor)
 {
-	/* Overflow protection */
-	if (factor != 0 && (INT64_MAX / myabs(factor)) < myabs(this->cost)) {
-		this->cost = (this->cost < 0 == factor < 0) ? INT64_MAX : INT64_MIN;
-	} else {
-		this->cost *= factor;
-	}
+	this->cost *= factor;
 	return *this;
 }