Refactoring fuel: Removed the 'get_partial' parameter.

This was used inconsistently and without regard to correctness, so it is better removed altogether. In case of incomplete objects, the incomplete object always returns the reduced amount.
liquid_container
Mark 2016-03-01 17:19:39 +01:00
parent 4f19651f0e
commit 072f599cdb
7 changed files with 10 additions and 13 deletions

View File

@ -14,10 +14,9 @@ protected func Hit(x, y)
} }
public func IsFuel() { return true; } public func IsFuel() { return true; }
public func GetFuelAmount(bool get_partial) public func GetFuelAmount()
{ {
if (get_partial) if (this != Coal) return GetCon();
return GetCon();
return 100; return 100;
} }

View File

@ -18,10 +18,9 @@ private func Hit()
} }
public func IsFuel() { return true; } public func IsFuel() { return true; }
public func GetFuelAmount(bool get_partial) public func GetFuelAmount()
{ {
if (get_partial) if (this != CottonSeed) return GetCon()/2;
return GetCon()/2;
return 50; return 50;
} }

View File

@ -130,7 +130,7 @@ private func FindNearWater()
/*-- Status --*/ /*-- Status --*/
public func IsFuel() { return !wetness; } public func IsFuel() { return !wetness; }
public func GetFuelAmount(bool get_partial) { return 100; } public func GetFuelAmount() { return 100; }
local Collectible = 1; local Collectible = 1;
local Name = "$Name$"; local Name = "$Name$";

View File

@ -12,10 +12,9 @@ func Incineration()
} }
public func IsFuel() { return true; } public func IsFuel() { return true; }
public func GetFuelAmount(bool get_partial) public func GetFuelAmount()
{ {
if (get_partial) if (this != Wood) return GetCon() / 2;
return GetCon() / 2;
return 50; return 50;
} }
public func IsSawmillProduct() { return true; } public func IsSawmillProduct() { return true; }

View File

@ -16,7 +16,7 @@ public func Incineration()
} }
public func IsFuel() { return true; } public func IsFuel() { return true; }
public func GetFuelAmount(bool get_partial) { return 30; } public func GetFuelAmount() { return 30; }
// Main bridge object is saved. // Main bridge object is saved.
func SaveScenarioObject() { return false; } func SaveScenarioObject() { return false; }

View File

@ -583,7 +583,7 @@ public func CheckFuel(id product, bool remove)
for (var fuel in FindObjects(Find_Container(this), Find_Func("IsFuel"))) for (var fuel in FindObjects(Find_Container(this), Find_Func("IsFuel")))
{ {
// Extract the fuel amount from stored objects // Extract the fuel amount from stored objects
var fuel_extracted = fuel->~GetFuelAmount(true, fuel_needed); var fuel_extracted = fuel->~GetFuelAmount(fuel_needed);
if (fuel_extracted > 0) if (fuel_extracted > 0)
{ {

View File

@ -46,7 +46,7 @@ public func ContentsCheck()
{ {
// Ejects non fuel items immediately // Ejects non fuel items immediately
var fuel; var fuel;
if(fuel = FindObject(Find_Container(this), Find_Not(Find_Func("IsFuel")), Find_Exclude(GetLiquidItem()))) if(fuel = FindObject(Find_Container(this), Find_Not(Find_Func("IsFuel"))))
{ {
fuel->Exit(-45, 21, -20, -1, -1, -30); fuel->Exit(-45, 21, -20, -1, -1, -30);
Sound("Chuff"); Sound("Chuff");