mirror of https://github.com/OpenTTD/OpenTTD
Feature: [AI/GS] Missing water related functions and objects (#8390)
parent
c6035158ca
commit
37de878129
|
@ -547,6 +547,8 @@ function Regression::Prices()
|
||||||
print(" BT_DOCK: " + AIMarine.GetBuildCost(AIMarine.BT_DOCK));
|
print(" BT_DOCK: " + AIMarine.GetBuildCost(AIMarine.BT_DOCK));
|
||||||
print(" BT_DEPOT: " + AIMarine.GetBuildCost(AIMarine.BT_DEPOT));
|
print(" BT_DEPOT: " + AIMarine.GetBuildCost(AIMarine.BT_DEPOT));
|
||||||
print(" BT_BUOY: " + AIMarine.GetBuildCost(AIMarine.BT_BUOY));
|
print(" BT_BUOY: " + AIMarine.GetBuildCost(AIMarine.BT_BUOY));
|
||||||
|
print(" BT_LOCK: " + AIMarine.GetBuildCost(AIMarine.BT_LOCK));
|
||||||
|
print(" BT_CANAL: " + AIMarine.GetBuildCost(AIMarine.BT_CANAL));
|
||||||
print(" -Tile-");
|
print(" -Tile-");
|
||||||
print(" BT_FOUNDATION: " + AITile.GetBuildCost(AITile.BT_FOUNDATION));
|
print(" BT_FOUNDATION: " + AITile.GetBuildCost(AITile.BT_FOUNDATION));
|
||||||
print(" BT_TERRAFORM: " + AITile.GetBuildCost(AITile.BT_TERRAFORM));
|
print(" BT_TERRAFORM: " + AITile.GetBuildCost(AITile.BT_TERRAFORM));
|
||||||
|
@ -556,6 +558,7 @@ function Regression::Prices()
|
||||||
print(" BT_CLEAR_ROCKY: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROCKY));
|
print(" BT_CLEAR_ROCKY: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROCKY));
|
||||||
print(" BT_CLEAR_FIELDS: " + AITile.GetBuildCost(AITile.BT_CLEAR_FIELDS));
|
print(" BT_CLEAR_FIELDS: " + AITile.GetBuildCost(AITile.BT_CLEAR_FIELDS));
|
||||||
print(" BT_CLEAR_HOUSE: " + AITile.GetBuildCost(AITile.BT_CLEAR_HOUSE));
|
print(" BT_CLEAR_HOUSE: " + AITile.GetBuildCost(AITile.BT_CLEAR_HOUSE));
|
||||||
|
print(" BT_CLEAR_WATER: " + AITile.GetBuildCost(AITile.BT_CLEAR_WATER));
|
||||||
}
|
}
|
||||||
|
|
||||||
function cost_callback(old_path, new_tile, new_direction, self) { if (old_path == null) return 0; return old_path.GetCost() + 1; }
|
function cost_callback(old_path, new_tile, new_direction, self) { if (old_path == null) return 0; return old_path.GetCost() + 1; }
|
||||||
|
@ -919,6 +922,9 @@ function Regression::Marine()
|
||||||
|
|
||||||
print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28480));
|
print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28480));
|
||||||
print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT));
|
print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT));
|
||||||
|
print(" BuildBuoy(): " + AIMarine.BuildBuoy(28481));
|
||||||
|
print(" BuildLock(): " + AIMarine.BuildLock(28487));
|
||||||
|
print(" BuildCanal(): " + AIMarine.BuildCanal(28744));
|
||||||
}
|
}
|
||||||
|
|
||||||
function Regression::Order()
|
function Regression::Order()
|
||||||
|
@ -1470,9 +1476,41 @@ function Regression::TileList()
|
||||||
print(" " + i + " => " + list.GetValue(i));
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
list.AddRectangle(54421 - 256 * 2, 256 * 2 + 54421 + 8);
|
list.AddRectangle(0x6F3F, 0x7248);
|
||||||
list.Valuate(AITile.IsWaterTile);
|
list.Valuate(AITile.IsWaterTile);
|
||||||
print(" Water(): done");
|
print(" IsWaterTile(): done");
|
||||||
|
print(" Count(): " + list.Count());
|
||||||
|
print(" ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Valuate(AITile.IsSeaTile);
|
||||||
|
print(" IsSeaTile(): done");
|
||||||
|
print(" Count(): " + list.Count());
|
||||||
|
print(" ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Valuate(AITile.IsRiverTile);
|
||||||
|
print(" IsRiverTile() done");
|
||||||
|
print(" Count(): " + list.Count());
|
||||||
|
print(" ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Valuate(AIMarine.IsCanalTile);
|
||||||
|
print(" IsCanalTile() done");
|
||||||
|
print(" Count(): " + list.Count());
|
||||||
|
print(" ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Valuate(AITile.IsCoastTile);
|
||||||
|
print(" IsCoastTile() done");
|
||||||
print(" Count(): " + list.Count());
|
print(" Count(): " + list.Count());
|
||||||
print(" ListDump:");
|
print(" ListDump:");
|
||||||
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
|
|
@ -7365,6 +7365,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetBankBalance(): 1999959285
|
GetBankBalance(): 1999959285
|
||||||
BuildWaterDepot(): true
|
BuildWaterDepot(): true
|
||||||
BuildDock(): true
|
BuildDock(): true
|
||||||
|
BuildBuoy(): true
|
||||||
|
BuildLock(): true
|
||||||
|
BuildCanal(): true
|
||||||
|
|
||||||
--Prices--
|
--Prices--
|
||||||
-Rail-
|
-Rail-
|
||||||
|
@ -7391,6 +7394,8 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
BT_DOCK: 262
|
BT_DOCK: 262
|
||||||
BT_DEPOT: 525
|
BT_DEPOT: 525
|
||||||
BT_BUOY: 262
|
BT_BUOY: 262
|
||||||
|
BT_LOCK: 5625
|
||||||
|
BT_CANAL: 3750
|
||||||
-Tile-
|
-Tile-
|
||||||
BT_FOUNDATION: 187
|
BT_FOUNDATION: 187
|
||||||
BT_TERRAFORM: 187
|
BT_TERRAFORM: 187
|
||||||
|
@ -7400,6 +7405,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
BT_CLEAR_ROCKY: 150
|
BT_CLEAR_ROCKY: 150
|
||||||
BT_CLEAR_FIELDS: 375
|
BT_CLEAR_FIELDS: 375
|
||||||
BT_CLEAR_HOUSE: 1200
|
BT_CLEAR_HOUSE: 1200
|
||||||
|
BT_CLEAR_WATER: 7500
|
||||||
|
|
||||||
--Rail--
|
--Rail--
|
||||||
IsRailTile(): false
|
IsRailTile(): false
|
||||||
|
@ -8450,54 +8456,221 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
KeepValue(1): done
|
KeepValue(1): done
|
||||||
Count(): 0
|
Count(): 0
|
||||||
ListDump:
|
ListDump:
|
||||||
Water(): done
|
IsWaterTile(): done
|
||||||
Count(): 45
|
Count(): 40
|
||||||
ListDump:
|
ListDump:
|
||||||
54941 => 1
|
29251 => 1
|
||||||
54940 => 1
|
29250 => 1
|
||||||
54939 => 1
|
29249 => 1
|
||||||
54938 => 1
|
29248 => 1
|
||||||
54937 => 1
|
29247 => 1
|
||||||
54936 => 1
|
28996 => 1
|
||||||
54935 => 1
|
28995 => 1
|
||||||
54934 => 1
|
28994 => 1
|
||||||
54933 => 1
|
28993 => 1
|
||||||
54685 => 1
|
28992 => 1
|
||||||
54684 => 1
|
28991 => 1
|
||||||
54683 => 1
|
28744 => 1
|
||||||
54682 => 1
|
28741 => 1
|
||||||
54681 => 1
|
28740 => 1
|
||||||
54680 => 1
|
28739 => 1
|
||||||
54679 => 1
|
28738 => 1
|
||||||
54678 => 1
|
28737 => 1
|
||||||
54677 => 1
|
28736 => 1
|
||||||
54429 => 1
|
28735 => 1
|
||||||
54428 => 1
|
28488 => 1
|
||||||
54427 => 1
|
28487 => 1
|
||||||
54426 => 1
|
28486 => 1
|
||||||
54425 => 1
|
28485 => 1
|
||||||
54424 => 1
|
28484 => 1
|
||||||
54423 => 1
|
28483 => 1
|
||||||
54422 => 1
|
28482 => 1
|
||||||
54421 => 1
|
28480 => 1
|
||||||
54173 => 1
|
28479 => 1
|
||||||
54172 => 1
|
29256 => 0
|
||||||
54171 => 1
|
29255 => 0
|
||||||
54170 => 1
|
29254 => 0
|
||||||
54169 => 1
|
29253 => 0
|
||||||
54168 => 0
|
29252 => 0
|
||||||
54167 => 0
|
29000 => 0
|
||||||
54166 => 0
|
28999 => 0
|
||||||
54165 => 0
|
28998 => 0
|
||||||
53917 => 0
|
28997 => 0
|
||||||
53916 => 0
|
28743 => 0
|
||||||
53915 => 0
|
28742 => 0
|
||||||
53914 => 0
|
28481 => 0
|
||||||
53913 => 0
|
IsSeaTile(): done
|
||||||
53912 => 0
|
Count(): 40
|
||||||
53911 => 0
|
ListDump:
|
||||||
53910 => 0
|
29251 => 1
|
||||||
53909 => 0
|
29250 => 1
|
||||||
|
29249 => 1
|
||||||
|
29248 => 1
|
||||||
|
29247 => 1
|
||||||
|
28996 => 1
|
||||||
|
28995 => 1
|
||||||
|
28994 => 1
|
||||||
|
28993 => 1
|
||||||
|
28992 => 1
|
||||||
|
28991 => 1
|
||||||
|
28741 => 1
|
||||||
|
28740 => 1
|
||||||
|
28739 => 1
|
||||||
|
28738 => 1
|
||||||
|
28737 => 1
|
||||||
|
28736 => 1
|
||||||
|
28735 => 1
|
||||||
|
28485 => 1
|
||||||
|
28484 => 1
|
||||||
|
28483 => 1
|
||||||
|
28482 => 1
|
||||||
|
29256 => 0
|
||||||
|
29255 => 0
|
||||||
|
29254 => 0
|
||||||
|
29253 => 0
|
||||||
|
29252 => 0
|
||||||
|
29000 => 0
|
||||||
|
28999 => 0
|
||||||
|
28998 => 0
|
||||||
|
28997 => 0
|
||||||
|
28744 => 0
|
||||||
|
28743 => 0
|
||||||
|
28742 => 0
|
||||||
|
28488 => 0
|
||||||
|
28487 => 0
|
||||||
|
28486 => 0
|
||||||
|
28481 => 0
|
||||||
|
28480 => 0
|
||||||
|
28479 => 0
|
||||||
|
IsRiverTile() done
|
||||||
|
Count(): 40
|
||||||
|
ListDump:
|
||||||
|
29256 => 0
|
||||||
|
29255 => 0
|
||||||
|
29254 => 0
|
||||||
|
29253 => 0
|
||||||
|
29252 => 0
|
||||||
|
29251 => 0
|
||||||
|
29250 => 0
|
||||||
|
29249 => 0
|
||||||
|
29248 => 0
|
||||||
|
29247 => 0
|
||||||
|
29000 => 0
|
||||||
|
28999 => 0
|
||||||
|
28998 => 0
|
||||||
|
28997 => 0
|
||||||
|
28996 => 0
|
||||||
|
28995 => 0
|
||||||
|
28994 => 0
|
||||||
|
28993 => 0
|
||||||
|
28992 => 0
|
||||||
|
28991 => 0
|
||||||
|
28744 => 0
|
||||||
|
28743 => 0
|
||||||
|
28742 => 0
|
||||||
|
28741 => 0
|
||||||
|
28740 => 0
|
||||||
|
28739 => 0
|
||||||
|
28738 => 0
|
||||||
|
28737 => 0
|
||||||
|
28736 => 0
|
||||||
|
28735 => 0
|
||||||
|
28488 => 0
|
||||||
|
28487 => 0
|
||||||
|
28486 => 0
|
||||||
|
28485 => 0
|
||||||
|
28484 => 0
|
||||||
|
28483 => 0
|
||||||
|
28482 => 0
|
||||||
|
28481 => 0
|
||||||
|
28480 => 0
|
||||||
|
28479 => 0
|
||||||
|
IsCanalTile() done
|
||||||
|
Count(): 40
|
||||||
|
ListDump:
|
||||||
|
28744 => 1
|
||||||
|
29256 => 0
|
||||||
|
29255 => 0
|
||||||
|
29254 => 0
|
||||||
|
29253 => 0
|
||||||
|
29252 => 0
|
||||||
|
29251 => 0
|
||||||
|
29250 => 0
|
||||||
|
29249 => 0
|
||||||
|
29248 => 0
|
||||||
|
29247 => 0
|
||||||
|
29000 => 0
|
||||||
|
28999 => 0
|
||||||
|
28998 => 0
|
||||||
|
28997 => 0
|
||||||
|
28996 => 0
|
||||||
|
28995 => 0
|
||||||
|
28994 => 0
|
||||||
|
28993 => 0
|
||||||
|
28992 => 0
|
||||||
|
28991 => 0
|
||||||
|
28743 => 0
|
||||||
|
28742 => 0
|
||||||
|
28741 => 0
|
||||||
|
28740 => 0
|
||||||
|
28739 => 0
|
||||||
|
28738 => 0
|
||||||
|
28737 => 0
|
||||||
|
28736 => 0
|
||||||
|
28735 => 0
|
||||||
|
28488 => 0
|
||||||
|
28487 => 0
|
||||||
|
28486 => 0
|
||||||
|
28485 => 0
|
||||||
|
28484 => 0
|
||||||
|
28483 => 0
|
||||||
|
28482 => 0
|
||||||
|
28481 => 0
|
||||||
|
28480 => 0
|
||||||
|
28479 => 0
|
||||||
|
IsCoastTile() done
|
||||||
|
Count(): 40
|
||||||
|
ListDump:
|
||||||
|
28998 => 1
|
||||||
|
28997 => 1
|
||||||
|
28743 => 1
|
||||||
|
28742 => 1
|
||||||
|
29256 => 0
|
||||||
|
29255 => 0
|
||||||
|
29254 => 0
|
||||||
|
29253 => 0
|
||||||
|
29252 => 0
|
||||||
|
29251 => 0
|
||||||
|
29250 => 0
|
||||||
|
29249 => 0
|
||||||
|
29248 => 0
|
||||||
|
29247 => 0
|
||||||
|
29000 => 0
|
||||||
|
28999 => 0
|
||||||
|
28996 => 0
|
||||||
|
28995 => 0
|
||||||
|
28994 => 0
|
||||||
|
28993 => 0
|
||||||
|
28992 => 0
|
||||||
|
28991 => 0
|
||||||
|
28744 => 0
|
||||||
|
28741 => 0
|
||||||
|
28740 => 0
|
||||||
|
28739 => 0
|
||||||
|
28738 => 0
|
||||||
|
28737 => 0
|
||||||
|
28736 => 0
|
||||||
|
28735 => 0
|
||||||
|
28488 => 0
|
||||||
|
28487 => 0
|
||||||
|
28486 => 0
|
||||||
|
28485 => 0
|
||||||
|
28484 => 0
|
||||||
|
28483 => 0
|
||||||
|
28482 => 0
|
||||||
|
28481 => 0
|
||||||
|
28480 => 0
|
||||||
|
28479 => 0
|
||||||
|
|
||||||
--TileList_IndustryAccepting--
|
--TileList_IndustryAccepting--
|
||||||
Count(): 47
|
Count(): 47
|
||||||
|
@ -9099,12 +9272,12 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetLocation(): 33417
|
GetLocation(): 33417
|
||||||
GetEngineType(): 153
|
GetEngineType(): 153
|
||||||
GetUnitNumber(): 1
|
GetUnitNumber(): 1
|
||||||
GetAge(): 0
|
GetAge(): 1
|
||||||
GetMaxAge(): 5490
|
GetMaxAge(): 5490
|
||||||
GetAgeLeft(): 5490
|
GetAgeLeft(): 5489
|
||||||
GetCurrentSpeed(): 7
|
GetCurrentSpeed(): 7
|
||||||
GetRunningCost(): 421
|
GetRunningCost(): 421
|
||||||
GetProfitThisYear(): 0
|
GetProfitThisYear(): -1
|
||||||
GetProfitLastYear(): 0
|
GetProfitLastYear(): 0
|
||||||
GetCurrentValue(): 5947
|
GetCurrentValue(): 5947
|
||||||
GetVehicleType(): 1
|
GetVehicleType(): 1
|
||||||
|
@ -9114,7 +9287,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
IsInDepot(): false
|
IsInDepot(): false
|
||||||
GetNumWagons(): 1
|
GetNumWagons(): 1
|
||||||
GetWagonEngineType(): 153
|
GetWagonEngineType(): 153
|
||||||
GetWagonAge(): 0
|
GetWagonAge(): 1
|
||||||
GetLength(): 8
|
GetLength(): 8
|
||||||
GetOwner(): 1
|
GetOwner(): 1
|
||||||
BuildVehicle(): 14
|
BuildVehicle(): 14
|
||||||
|
@ -9139,9 +9312,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetNumWagons(): 3
|
GetNumWagons(): 3
|
||||||
GetLength(): 24
|
GetLength(): 24
|
||||||
GetWagonEngineType(): 9
|
GetWagonEngineType(): 9
|
||||||
GetWagonAge(): 1
|
GetWagonAge(): 0
|
||||||
GetWagonEngineType(): 27
|
GetWagonEngineType(): 27
|
||||||
GetWagonAge(): 1
|
GetWagonAge(): 0
|
||||||
GetWagonEngineType(): 27
|
GetWagonEngineType(): 27
|
||||||
GetWagonAge(): 0
|
GetWagonAge(): 0
|
||||||
GetWagonEngineType(): 65535
|
GetWagonEngineType(): 65535
|
||||||
|
@ -9187,11 +9360,11 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
14 => 1
|
14 => 1
|
||||||
12 => 1
|
12 => 1
|
||||||
Age ListDump:
|
Age ListDump:
|
||||||
17 => 1
|
|
||||||
16 => 1
|
|
||||||
14 => 1
|
|
||||||
13 => 1
|
13 => 1
|
||||||
12 => 1
|
12 => 1
|
||||||
|
17 => 0
|
||||||
|
16 => 0
|
||||||
|
14 => 0
|
||||||
MaxAge ListDump:
|
MaxAge ListDump:
|
||||||
16 => 10980
|
16 => 10980
|
||||||
14 => 10980
|
14 => 10980
|
||||||
|
@ -9199,9 +9372,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
13 => 5490
|
13 => 5490
|
||||||
12 => 5490
|
12 => 5490
|
||||||
AgeLeft ListDump:
|
AgeLeft ListDump:
|
||||||
16 => 10979
|
16 => 10980
|
||||||
14 => 10979
|
14 => 10980
|
||||||
17 => 7319
|
17 => 7320
|
||||||
13 => 5489
|
13 => 5489
|
||||||
12 => 5489
|
12 => 5489
|
||||||
CurrentSpeed ListDump:
|
CurrentSpeed ListDump:
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
* \li AINewGRF
|
* \li AINewGRF
|
||||||
* \li AINewGRFList
|
* \li AINewGRFList
|
||||||
* \li AIGroup::GetNumVehicles
|
* \li AIGroup::GetNumVehicles
|
||||||
|
* \li AIMarine::BT_LOCK
|
||||||
|
* \li AIMarine::BT_CANAL
|
||||||
|
* \li AITile::IsSeaTile
|
||||||
|
* \li AITile::IsRiverTile
|
||||||
|
* \li AITile::BT_CLEAR_WATER
|
||||||
*
|
*
|
||||||
* \b 1.11.0
|
* \b 1.11.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
* API additions:
|
* API additions:
|
||||||
* \li GSNewGRF
|
* \li GSNewGRF
|
||||||
* \li GSNewGRFList
|
* \li GSNewGRFList
|
||||||
|
* \li GSMarine::BT_LOCK
|
||||||
|
* \li GSMarine::BT_CANAL
|
||||||
|
* \li GSTile::IsSeaTile
|
||||||
|
* \li GSTile::IsRiverTile
|
||||||
|
* \li GSTile::BT_CLEAR_WATER
|
||||||
*
|
*
|
||||||
* \b 1.11.0
|
* \b 1.11.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -167,6 +167,8 @@
|
||||||
case BT_DOCK: return ::GetPrice(PR_BUILD_STATION_DOCK, 1, nullptr);
|
case BT_DOCK: return ::GetPrice(PR_BUILD_STATION_DOCK, 1, nullptr);
|
||||||
case BT_DEPOT: return ::GetPrice(PR_BUILD_DEPOT_SHIP, 1, nullptr);
|
case BT_DEPOT: return ::GetPrice(PR_BUILD_DEPOT_SHIP, 1, nullptr);
|
||||||
case BT_BUOY: return ::GetPrice(PR_BUILD_WAYPOINT_BUOY, 1, nullptr);
|
case BT_BUOY: return ::GetPrice(PR_BUILD_WAYPOINT_BUOY, 1, nullptr);
|
||||||
|
case BT_LOCK: return ::GetPrice(PR_BUILD_LOCK, 1, nullptr);
|
||||||
|
case BT_CANAL: return ::GetPrice(PR_BUILD_CANAL, 1, nullptr);
|
||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ public:
|
||||||
BT_DOCK, ///< Build a dock
|
BT_DOCK, ///< Build a dock
|
||||||
BT_DEPOT, ///< Build a ship depot
|
BT_DEPOT, ///< Build a ship depot
|
||||||
BT_BUOY, ///< Build a buoy
|
BT_BUOY, ///< Build a buoy
|
||||||
|
BT_LOCK, ///< Build a lock
|
||||||
|
BT_CANAL, ///< Build a canal
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,6 +58,20 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ bool ScriptTile::IsSeaTile(TileIndex tile)
|
||||||
|
{
|
||||||
|
if (!::IsValidTile(tile)) return false;
|
||||||
|
|
||||||
|
return ::IsTileType(tile, MP_WATER) && ::IsSea(tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ bool ScriptTile::IsRiverTile(TileIndex tile)
|
||||||
|
{
|
||||||
|
if (!::IsValidTile(tile)) return false;
|
||||||
|
|
||||||
|
return ::IsTileType(tile, MP_WATER) && ::IsRiver(tile);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ bool ScriptTile::IsWaterTile(TileIndex tile)
|
/* static */ bool ScriptTile::IsWaterTile(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (!::IsValidTile(tile)) return false;
|
if (!::IsValidTile(tile)) return false;
|
||||||
|
@ -320,6 +334,7 @@
|
||||||
case BT_CLEAR_ROCKY: return ::GetPrice(PR_CLEAR_ROCKS, 1, nullptr);
|
case BT_CLEAR_ROCKY: return ::GetPrice(PR_CLEAR_ROCKS, 1, nullptr);
|
||||||
case BT_CLEAR_FIELDS: return ::GetPrice(PR_CLEAR_FIELDS, 1, nullptr);
|
case BT_CLEAR_FIELDS: return ::GetPrice(PR_CLEAR_FIELDS, 1, nullptr);
|
||||||
case BT_CLEAR_HOUSE: return ::GetPrice(PR_CLEAR_HOUSE, 1, nullptr);
|
case BT_CLEAR_HOUSE: return ::GetPrice(PR_CLEAR_HOUSE, 1, nullptr);
|
||||||
|
case BT_CLEAR_WATER: return ::GetPrice(PR_CLEAR_WATER, 1, nullptr);
|
||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ public:
|
||||||
BT_CLEAR_ROCKY, ///< Clear a tile with rocks
|
BT_CLEAR_ROCKY, ///< Clear a tile with rocks
|
||||||
BT_CLEAR_FIELDS, ///< Clear a tile with farm fields
|
BT_CLEAR_FIELDS, ///< Clear a tile with farm fields
|
||||||
BT_CLEAR_HOUSE, ///< Clear a tile with a house
|
BT_CLEAR_HOUSE, ///< Clear a tile with a house
|
||||||
|
BT_CLEAR_WATER, ///< Clear a tile with either river or sea
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,11 +159,28 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool IsBuildableRectangle(TileIndex tile, uint width, uint height);
|
static bool IsBuildableRectangle(TileIndex tile, uint width, uint height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given tile is actually a sea tile.
|
||||||
|
* @param tile The tile to check on.
|
||||||
|
* @pre ScriptMap::IsValidTile(tile).
|
||||||
|
* @return True if and only if the tile is a sea tile.
|
||||||
|
*/
|
||||||
|
static bool IsSeaTile(TileIndex tile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given tile is actually a river tile.
|
||||||
|
* @param tile The tile to check on.
|
||||||
|
* @pre ScriptMap::IsValidTile(tile).
|
||||||
|
* @return True if and only if the tile is a river tile.
|
||||||
|
*/
|
||||||
|
static bool IsRiverTile(TileIndex tile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given tile is actually a water tile.
|
* Checks whether the given tile is actually a water tile.
|
||||||
* @param tile The tile to check on.
|
* @param tile The tile to check on.
|
||||||
* @pre ScriptMap::IsValidTile(tile).
|
* @pre ScriptMap::IsValidTile(tile).
|
||||||
* @return True if and only if the tile is a water tile.
|
* @return True if and only if the tile is a water tile.
|
||||||
|
* @note Returns false when a buoy is on the tile.
|
||||||
*/
|
*/
|
||||||
static bool IsWaterTile(TileIndex tile);
|
static bool IsWaterTile(TileIndex tile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue