summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-02-28 20:25:03 +0000
committerfrosch <frosch@openttd.org>2010-02-28 20:25:03 +0000
commit333249ce501085405afabac8eb61a2c3ed599c0f (patch)
tree1892303233cef8b6bf22b985f142c9ef3d2bfbe6
parentac1a08ef4ad2414491b050b374714d7313373c1f (diff)
downloadopenttd-333249ce501085405afabac8eb61a2c3ed599c0f.tar.xz
(svn r19294) -Change: [NoAI] Remove HasNext() from all lists/iterators and add IsEnd() instead.
-rw-r--r--bin/ai/compat_0.7.nut36
-rw-r--r--bin/ai/compat_1.0.nut37
-rw-r--r--bin/ai/regression/regression.nut224
-rw-r--r--bin/ai/regression/regression.txt2
-rw-r--r--src/ai/api/ai_abstractlist.cpp46
-rw-r--r--src/ai/api/ai_abstractlist.hpp11
-rw-r--r--src/ai/api/ai_abstractlist.hpp.sq2
-rw-r--r--src/ai/api/ai_changelog.hpp6
8 files changed, 222 insertions, 142 deletions
diff --git a/bin/ai/compat_0.7.nut b/bin/ai/compat_0.7.nut
index db56fdaee..4c45e4fdb 100644
--- a/bin/ai/compat_0.7.nut
+++ b/bin/ai/compat_0.7.nut
@@ -274,3 +274,39 @@ AIRoad.BuildDriveThroughRoadStation <- function(tile, front, road_veh_type, stat
return AIRoad._BuildDriveThroughRoadStation(tile, front, road_veh_type, station_id);
}
+
+AIAbstractList.HasNext <-
+AIBridgeList.HasNext <-
+AIBridgeList_Length.HasNext <-
+AICargoList.HasNext <-
+AICargoList_IndustryAccepting.HasNext <-
+AICargoList_IndustryProducing.HasNext <-
+AIDepotList.HasNext <-
+AIEngineList.HasNext <-
+AIGroupList.HasNext <-
+AIIndustryList.HasNext <-
+AIIndustryList_CargoAccepting.HasNext <-
+AIIndustryList_CargoProducing.HasNext <-
+AIIndustryTypeList.HasNext <-
+AIList.HasNext <-
+AIRailTypeList.HasNext <-
+AISignList.HasNext <-
+AIStationList.HasNext <-
+AIStationList_Vehicle.HasNext <-
+AISubsidyList.HasNext <-
+AITileList.HasNext <-
+AITileList_IndustryAccepting.HasNext <-
+AITileList_IndustryProducing.HasNext <-
+AITileList_StationType.HasNext <-
+AITownList.HasNext <-
+AIVehicleList.HasNext <-
+AIVehicleList_DefaultGroup.HasNext <-
+AIVehicleList_Group.HasNext <-
+AIVehicleList_SharedOrders.HasNext <-
+AIVehicleList_Station.HasNext <-
+AIWaypointList.HasNext <-
+AIWaypointList_Vehicle.HasNext <-
+function()
+{
+ return !this.IsEnd();
+}
diff --git a/bin/ai/compat_1.0.nut b/bin/ai/compat_1.0.nut
index 77ae2525a..c28f33531 100644
--- a/bin/ai/compat_1.0.nut
+++ b/bin/ai/compat_1.0.nut
@@ -24,3 +24,40 @@ AIRoad.BuildDriveThroughRoadStation <- function(tile, front, road_veh_type, stat
return AIRoad._BuildDriveThroughRoadStation(tile, front, road_veh_type, station_id);
}
+
+AIAbstractList.HasNext <-
+AIBridgeList.HasNext <-
+AIBridgeList_Length.HasNext <-
+AICargoList.HasNext <-
+AICargoList_IndustryAccepting.HasNext <-
+AICargoList_IndustryProducing.HasNext <-
+AIDepotList.HasNext <-
+AIEngineList.HasNext <-
+AIGroupList.HasNext <-
+AIIndustryList.HasNext <-
+AIIndustryList_CargoAccepting.HasNext <-
+AIIndustryList_CargoProducing.HasNext <-
+AIIndustryTypeList.HasNext <-
+AIList.HasNext <-
+AIRailTypeList.HasNext <-
+AISignList.HasNext <-
+AIStationList.HasNext <-
+AIStationList_Vehicle.HasNext <-
+AISubsidyList.HasNext <-
+AITileList.HasNext <-
+AITileList_IndustryAccepting.HasNext <-
+AITileList_IndustryProducing.HasNext <-
+AITileList_StationType.HasNext <-
+AITownList.HasNext <-
+AIVehicleList.HasNext <-
+AIVehicleList_DefaultGroup.HasNext <-
+AIVehicleList_Depot.HasNext <-
+AIVehicleList_Group.HasNext <-
+AIVehicleList_SharedOrders.HasNext <-
+AIVehicleList_Station.HasNext <-
+AIWaypointList.HasNext <-
+AIWaypointList_Vehicle.HasNext <-
+function()
+{
+ return !this.IsEnd();
+}
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut
index c27929d6b..eb9b9667f 100644
--- a/bin/ai/regression/regression.nut
+++ b/bin/ai/regression/regression.nut
@@ -35,7 +35,7 @@ function Regression::TestInit()
list.AddItem(35, 40);
list.AddItem(40, 40);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.RemoveItem(i - 10);
list.RemoveItem(i - 5);
list.RemoveItem(i);
@@ -48,12 +48,12 @@ function Regression::TestInit()
list.AddItem(40, 40);
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.SetValue(i, 2);
print(" " + i);
}
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
@@ -70,7 +70,7 @@ function Regression::TestInit()
list.AddItem(35, 40);
list.AddItem(40, 40);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.RemoveItem(i + 10);
list.RemoveItem(i + 5);
list.RemoveItem(i);
@@ -83,12 +83,12 @@ function Regression::TestInit()
list.AddItem(40, 40);
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.SetValue(i, 50);
print(" " + i);
}
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
@@ -105,7 +105,7 @@ function Regression::TestInit()
list.AddItem(35, 40);
list.AddItem(40, 40);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.RemoveItem(i - 10);
list.RemoveItem(i - 5);
list.RemoveItem(i);
@@ -118,12 +118,12 @@ function Regression::TestInit()
list.AddItem(40, 40);
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.SetValue(i, 2);
print(" " + i);
}
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
@@ -140,7 +140,7 @@ function Regression::TestInit()
list.AddItem(35, 40);
list.AddItem(40, 40);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.RemoveItem(i + 10);
list.RemoveItem(i + 5);
list.RemoveItem(i);
@@ -153,12 +153,12 @@ function Regression::TestInit()
list.AddItem(40, 40);
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
list.SetValue(i, 50);
print(" " + i);
}
print("");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
@@ -283,22 +283,22 @@ function Regression::BridgeList()
print(" Count(): " + list.Count());
list.Valuate(AIBridge.GetMaxSpeed);
print(" MaxSpeed ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIBridge.GetPrice, 5);
print(" Price ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIBridge.GetMaxLength);
print(" MaxLength ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIBridge.GetMinLength);
print(" MinLength ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -309,12 +309,12 @@ function Regression::BridgeList()
print(" Count(): " + list.Count());
list.Valuate(AIBridge.GetMaxSpeed);
print(" MaxSpeed ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIBridge.GetPrice, 14);
print(" Price ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
@@ -347,13 +347,13 @@ function Regression::CargoList()
print(" Count(): " + list.Count());
list.Valuate(AICargo.IsFreight);
print(" IsFreight ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AICargo.GetCargoIncome, 100, 100);
print(" CargoIncomes(100, 100) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -362,7 +362,7 @@ function Regression::CargoList()
print("--CargoList_IndustryAccepting--");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
@@ -371,7 +371,7 @@ function Regression::CargoList()
print("--CargoList_IndustryProducing--");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i);
}
}
@@ -479,27 +479,27 @@ function Regression::EngineList()
print(" Count(): " + list.Count());
list.Valuate(AIEngine.GetCargoType);
print(" CargoType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIEngine.GetCapacity);
print(" Capacity ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIEngine.GetReliability);
print(" Reliability ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIEngine.GetMaxSpeed);
print(" MaxSpeed ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIEngine.GetPrice);
print(" Price ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
@@ -586,7 +586,7 @@ function Regression::Industry()
print(" GetIndustryCount(): " + AIIndustry.GetIndustryCount());
local list = AIIndustryList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
if (AIIndustry.IsValidIndustry(i)) j++;
print(" Industry " + i);
print(" IsValidIndustry(): " + AIIndustry.IsValidIndustry(i));
@@ -595,7 +595,7 @@ function Regression::Industry()
print(" IsCargoAccepted(): " + AIIndustry.IsCargoAccepted(i, 1));
local cargo_list = AICargoList();
- for (local j = cargo_list.Begin(); cargo_list.HasNext(); j = cargo_list.Next()) {
+ for (local j = cargo_list.Begin(); !cargo_list.IsEnd(); j = cargo_list.Next()) {
if (AIIndustry.IsCargoAccepted(i, j) || AIIndustry.GetLastMonthProduction(i,j) >= 0) {
print(" GetLastMonthProduction(): " + AIIndustry.GetLastMonthProduction(i, j));
print(" GetLastMonthTransported(): " + AIIndustry.GetLastMonthTransported(i, j));
@@ -616,27 +616,27 @@ function Regression::IndustryList()
print(" Count(): " + list.Count());
list.Valuate(AIIndustry.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIIndustry.GetDistanceManhattanToTile, 30000);
print(" DistanceManhattanToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIIndustry.GetDistanceSquareToTile, 30000);
print(" DistanceSquareToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIIndustry.GetAmountOfStationsAround);
print(" GetAmountOfStationsAround(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIIndustry.IsCargoAccepted, 1);
print(" CargoAccepted(1) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -645,7 +645,7 @@ function Regression::IndustryList()
print(" Count(): " + list.Count());
list.Valuate(AIIndustry.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -654,7 +654,7 @@ function Regression::IndustryList()
print(" Count(): " + list.Count());
list.Valuate(AIIndustry.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
@@ -668,7 +668,7 @@ function Regression::IndustryTypeList()
print(" Count(): " + list.Count());
list.Valuate(AIIndustry.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" Id: " + i);
print(" IsRawIndustry(): " + AIIndustryType.IsRawIndustry(i));
print(" ProductionCanIncrease(): " + AIIndustryType.ProductionCanIncrease(i));
@@ -709,43 +709,43 @@ function Regression::List()
print(" IsEmpty(): " + list.IsEmpty());
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
print(" List Dump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(CustomValuator);
print(" Custom ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(function (a) { return a * 42; });
print(" Custom ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIBase.RandItem);
print(" Randomize ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.KeepTop(10);
print(" KeepTop(10):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.KeepBottom(8);
print(" KeepBottom(8):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.RemoveBottom(2);
print(" RemoveBottom(2):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.RemoveTop(2);
print(" RemoveTop(2):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -754,13 +754,13 @@ function Regression::List()
list2.AddItem(1004, 0);
list.RemoveList(list2);
print(" RemoveList({1003, 1004}):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list2.AddItem(1005, 0);
list.KeepList(list2);
print(" KeepList({1003, 1004, 1005}):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list2.Clear();
@@ -770,7 +770,7 @@ function Regression::List()
list2.AddItem(1005, 1005);
list.AddList(list2);
print(" AddList({1005, 4000, 4001, 4002}):");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list[4000] = 50;
@@ -791,27 +791,27 @@ function Regression::List()
}
local it = list.Begin();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
list.Sort(list.SORT_BY_VALUE, list.SORT_ASCENDING);
it = list.Next();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
it = list.Begin();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
list.SetValue(it + 1, -5);
it = list.Next();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
list.RemoveValue(list.GetValue(it) + 1);
it = list.Next();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
list.RemoveAboveValue(list.GetValue(it));
it = list.Next();
- print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")");
+ print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
- while (list.HasNext()) {
+ while (!list.IsEnd()) {
it = list.Next();
print(" " + it + " => " + list.GetValue(it));
}
@@ -879,11 +879,11 @@ function Regression::Marine()
print("--AIWaypointList(BUOY)--");
print(" Count(): " + list.Count());
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + AIWaypoint.GetLocation(i));
}
print(" HasWaypointType:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_RAIL) + " " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_BUOY) + " " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_ANY));
}
print("");
@@ -966,37 +966,37 @@ function Regression::Order()
print(" Count(): " + list.Count());
list.Valuate(AIStation.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetCargoWaiting, 0);
print(" CargoWaiting(0) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetCargoWaiting, 1);
print(" CargoWaiting(1) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetCargoRating, 1);
print(" CargoRating(1) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetDistanceManhattanToTile, 30000);
print(" DistanceManhattanToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetDistanceSquareToTile, 30000);
print(" DistanceSquareToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.IsWithinTownInfluence, 0);
print(" IsWithinTownInfluence(0) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1007,7 +1007,7 @@ function Regression::Order()
print(" Count(): " + list.Count());
list.Valuate(AIVehicle.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" foreach():");
@@ -1024,7 +1024,7 @@ function Regression::RailTypeList()
print("--RailTypeList--");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" RailType: " + i);
print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
}
@@ -1059,7 +1059,7 @@ function Regression::Rail()
print(" Count(): " + list.Count());
list.Valuate(AITile.GetDistanceManhattanToTile, 0);
print(" Depot distance from (0,0) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" RemoveDepot(): " + AITile.DemolishTile(33411));
@@ -1137,7 +1137,7 @@ function Regression::Road()
print(" Count(): " + list.Count());
list.Valuate(AITile.GetDistanceManhattanToTile, 0);
print(" Depot distance from (0,0) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" RemoveRoadDepot(): " + AIRoad.RemoveRoadDepot(33411));
@@ -1196,7 +1196,7 @@ function Regression::Sign()
print("");
local list = AISignList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
j++;
print(" Sign " + i);
print(" IsValidSign(): " + AISign.IsValidSign(i));
@@ -1246,17 +1246,17 @@ function Regression::Station()
print(" Count(): " + list.Count());
list.Valuate(AIStation.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetCargoWaiting, 0);
print(" CargoWaiting(0) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIStation.GetCargoWaiting, 1);
print(" CargoWaiting(1) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
@@ -1297,7 +1297,7 @@ function Regression::TileList()
print(" Slope(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
print(" " + i + " => " + AITile.GetComplementSlope(list.GetValue(i)));
print(" " + i + " => " + AITile.IsSteepSlope(list.GetValue(i)));
@@ -1315,7 +1315,7 @@ function Regression::TileList()
print(" Height(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1323,7 +1323,7 @@ function Regression::TileList()
print(" CornerHeight(North): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1331,7 +1331,7 @@ function Regression::TileList()
print(" MinHeight(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1339,7 +1339,7 @@ function Regression::TileList()
print(" MaxHeight(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1349,7 +1349,7 @@ function Regression::TileList()
print(" KeepValue(0): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1363,27 +1363,27 @@ function Regression::TileList()
list.Valuate(AITile.IsBuildableRectangle, 3, 3);
print(" BuildableRectangle(3, 3) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetDistanceManhattanToTile, 30000);
print(" DistanceManhattanToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetDistanceSquareToTile, 30000);
print(" DistanceSquareToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetOwner);
print(" GetOwner() ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITile.GetClosestTown);
print(" GetClosestTown() ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1393,7 +1393,7 @@ function Regression::TileList()
print(" KeepAboveValue(10): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1403,7 +1403,7 @@ function Regression::TileList()
print(" KeepValue(1): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1413,7 +1413,7 @@ function Regression::TileList()
print(" KeepValue(1): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1422,7 +1422,7 @@ function Regression::TileList()
print(" Water(): done");
print(" Count(): " + list.Count());
print(" ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1432,7 +1432,7 @@ function Regression::TileList()
print(" Count(): " + list.Count());
list.Valuate(AITile.GetCargoAcceptance, 3, 1, 1, 3);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1442,7 +1442,7 @@ function Regression::TileList()
print(" Count(): " + list.Count());
list.Valuate(AITile.GetCargoProduction, 7, 1, 1, 3);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1451,7 +1451,7 @@ function Regression::TileList()
print("--TileList_StationType--");
print(" Count(): " + list.Count());
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
@@ -1465,7 +1465,7 @@ function Regression::Town()
print(" GetTownCount(): " + AITown.GetTownCount());
local list = AITownList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
if (AITown.IsValidTown(i)) j++;
print(" Town " + i);
print(" IsValidTown(): " + AITown.IsValidTown(i));
@@ -1488,27 +1488,27 @@ function Regression::TownList()
print(" Count(): " + list.Count());
list.Valuate(AITown.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITown.GetDistanceManhattanToTile, 30000);
print(" DistanceManhattanToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITown.GetDistanceSquareToTile, 30000);
print(" DistanceSquareToTile(30000) ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITown.IsWithinTownInfluence, AITown.GetLocation(0));
print(" IsWithinTownInfluence(" + AITown.GetLocation(0) + ") ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITown.GetAllowedNoise);
print(" GetAllowedNoise() ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AITown.GetPopulation);
@@ -1516,7 +1516,7 @@ function Regression::TownList()
print(" KeepAboveValue(500): done");
print(" Count(): " + list.Count());
print(" Population ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
@@ -1665,77 +1665,77 @@ function Regression::Vehicle()
print(" Count(): " + list.Count());
list.Valuate(AIVehicle.GetLocation);
print(" Location ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetEngineType);
print(" EngineType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetUnitNumber);
print(" UnitNumber ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetAge);
print(" Age ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetMaxAge);
print(" MaxAge ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetAgeLeft);
print(" AgeLeft ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetCurrentSpeed);
print(" CurrentSpeed ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetRunningCost);
print(" RunningCost ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetProfitThisYear);
print(" ProfitThisYear ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetProfitLastYear);
print(" ProfitLastYear ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetCurrentValue);
print(" CurrentValue ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetVehicleType);
print(" VehicleType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetRoadType);
print(" RoadType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetCapacity, 10);
print(" VehicleType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
list.Valuate(AIVehicle.GetCargoLoad, 10);
print(" VehicleType ListDump:");
- for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
+ for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt
index 2b499f62c..da92f64f1 100644
--- a/bin/ai/regression/regression.txt
+++ b/bin/ai/regression/regression.txt
@@ -571,7 +571,7 @@
IsEmpty(): true
0 => 5 (true)
ERROR: Next() is invalid as Begin() is never called
-ERROR: HasNext() is invalid as Begin() is never called
+ERROR: IsEnd() is invalid as Begin() is never called
0 => 5 (false)
0 => 5 (true)
2 => 6 (true)
diff --git a/src/ai/api/ai_abstractlist.cpp b/src/ai/api/ai_abstractlist.cpp
index 9aeff4fc4..e169f5ef6 100644
--- a/src/ai/api/ai_abstractlist.cpp
+++ b/src/ai/api/ai_abstractlist.cpp
@@ -42,9 +42,9 @@ public:
virtual int32 Next() = 0;
/**
- * See if there is a next item of the sorter.
+ * See if the sorter has reached the end.
*/
- virtual bool HasNext() = 0;
+ virtual bool IsEnd() = 0;
/**
* Callback from the list if an item gets removed.
@@ -114,7 +114,7 @@ public:
int32 Next()
{
- if (!this->HasNext()) return 0;
+ if (this->IsEnd()) return 0;
int32 item_current = this->item_next;
FindNext();
@@ -123,7 +123,7 @@ public:
void Remove(int item)
{
- if (!this->HasNext()) return;
+ if (this->IsEnd()) return;
/* If we remove the 'next' item, skip to the next */
if (item == this->item_next) {
@@ -132,9 +132,9 @@ public:
}
}
- bool HasNext()
+ bool IsEnd()
{
- return !(this->list->buckets.empty() || this->has_no_more_items);
+ return this->list->buckets.empty() || this->has_no_more_items;
}
};
@@ -208,7 +208,7 @@ public:
int32 Next()
{
- if (!this->HasNext()) return 0;
+ if (this->IsEnd()) return 0;
int32 item_current = this->item_next;
FindNext();
@@ -217,7 +217,7 @@ public:
void Remove(int item)
{
- if (!this->HasNext()) return;
+ if (this->IsEnd()) return;
/* If we remove the 'next' item, skip to the next */
if (item == this->item_next) {
@@ -226,9 +226,9 @@ public:
}
}
- bool HasNext()
+ bool IsEnd()
{
- return !(this->list->buckets.empty() || this->has_no_more_items);
+ return this->list->buckets.empty() || this->has_no_more_items;
}
};
@@ -278,7 +278,7 @@ public:
int32 Next()
{
- if (!this->HasNext()) return 0;
+ if (this->IsEnd()) return 0;
int32 item_current = this->item_next;
FindNext();
@@ -287,7 +287,7 @@ public:
void Remove(int item)
{
- if (!this->HasNext()) return;
+ if (this->IsEnd()) return;
/* If we remove the 'next' item, skip to the next */
if (item == this->item_next) {
@@ -296,9 +296,9 @@ public:
}
}
- bool HasNext()
+ bool IsEnd()
{
- return !(this->list->items.empty() || this->has_no_more_items);
+ return this->list->items.empty() || this->has_no_more_items;
}
};
@@ -349,7 +349,7 @@ public:
int32 Next()
{
- if (!this->HasNext()) return 0;
+ if (this->IsEnd()) return 0;
int32 item_current = this->item_next;
FindNext();
@@ -358,7 +358,7 @@ public:
void Remove(int item)
{
- if (!this->HasNext()) return;
+ if (this->IsEnd()) return;
/* If we remove the 'next' item, skip to the next */
if (item == this->item_next) {
@@ -367,9 +367,9 @@ public:
}
}
- bool HasNext()
+ bool IsEnd()
{
- return !(this->list->items.empty() || this->has_no_more_items);
+ return this->list->items.empty() || this->has_no_more_items;
}
};
@@ -448,13 +448,13 @@ bool AIAbstractList::IsEmpty()
return this->items.empty();
}
-bool AIAbstractList::HasNext()
+bool AIAbstractList::IsEnd()
{
if (this->initialized == false) {
- DEBUG(ai, 0, "HasNext() is invalid as Begin() is never called");
- return false;
+ DEBUG(ai, 0, "IsEnd() is invalid as Begin() is never called");
+ return true;
}
- return this->sorter->HasNext();
+ return this->sorter->IsEnd();
}
int32 AIAbstractList::Count()
@@ -748,7 +748,7 @@ SQInteger AIAbstractList::_nexti(HSQUIRRELVM vm)
sq_getinteger(vm, 2, &idx);
int val = this->Next();
- if (!this->HasNext()) {
+ if (this->IsEnd()) {
sq_pushnull(vm);
return 1;
}
diff --git a/src/ai/api/ai_abstractlist.hpp b/src/ai/api/ai_abstractlist.hpp
index bf4c9897d..ab3b4925a 100644
--- a/src/ai/api/ai_abstractlist.hpp
+++ b/src/ai/api/ai_abstractlist.hpp
@@ -86,13 +86,14 @@ public:
/**
* Go to the beginning of the list.
* @return the item value of the first item.
+ * @note returns 0 if beyond end-of-list. Use IsEnd() to check for end-of-list.
*/
int32 Begin();
/**
* Go to the next item in the list.
* @return the item value of the next item.
- * @note returns 0 if beyond end-of-list. Use HasNext() to check for end-of-list.
+ * @note returns 0 if beyond end-of-list. Use IsEnd() to check for end-of-list.
*/
int32 Next();
@@ -103,11 +104,11 @@ public:
bool IsEmpty();
/**
- * Check if there is a next element. In other words, if this is true,
- * Next() will return a valid item.
- * @return true if there is a next item.
+ * Check if there is a element left. In other words, if this is false,
+ * the last call to Begin() or Next() returned a valid item.
+ * @return true if the current item is beyond end-of-list.
*/
- bool HasNext();
+ bool IsEnd();
/**
* Returns the amount of items in the list.
diff --git a/src/ai/api/ai_abstractlist.hpp.sq b/src/ai/api/ai_abstractlist.hpp.sq
index 22b8977c7..aaa8503a1 100644
--- a/src/ai/api/ai_abstractlist.hpp.sq
+++ b/src/ai/api/ai_abstractlist.hpp.sq
@@ -41,7 +41,7 @@ void SQAIAbstractList_Register(Squirrel *engine)
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Begin, "Begin", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Next, "Next", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::IsEmpty, "IsEmpty", 1, "x");
- SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::HasNext, "HasNext", 1, "x");
+ SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::IsEnd, "IsEnd", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Count, "Count", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::GetValue, "GetValue", 2, "xi");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::SetValue, "SetValue", 3, "xii");
diff --git a/src/ai/api/ai_changelog.hpp b/src/ai/api/ai_changelog.hpp
index 16b9505b7..4c0f7f876 100644
--- a/src/ai/api/ai_changelog.hpp
+++ b/src/ai/api/ai_changelog.hpp
@@ -18,6 +18,12 @@
*
* 1.1.0 is not yet released. The following changes are not set in stone yet.
*
+ * API additions:
+ * \li IsEnd for all lists.
+ *
+ * API removals:
+ * \li HasNext for all lists.
+ *
* Other changes:
* \li AIRoad::BuildRoadStation now allows overbuilding
* \li AIRoad::BuildDriveThroughRoadStation now allows overbuilding