Changeset - r19685:8ccaeb42d4b3
[Not reviewed]
master
0 2 0
zuu - 12 years ago 2012-10-25 19:25:31
zuu@openttd.org
(svn r24628) -Fix: Document and enforce precondition start != end for ScriptRoad::RemoveRoad and ScriptRoad::RemoveRoadFull
2 files changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_road.cpp
Show inline comments
 
@@ -537,6 +537,7 @@ static bool NeighbourHasReachableRoad(::
 
/* static */ bool ScriptRoad::RemoveRoad(TileIndex start, TileIndex end)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
 
	EnforcePrecondition(false, start != end);
 
	EnforcePrecondition(false, ::IsValidTile(start));
 
	EnforcePrecondition(false, ::IsValidTile(end));
 
	EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
 
@@ -548,6 +549,7 @@ static bool NeighbourHasReachableRoad(::
 
/* static */ bool ScriptRoad::RemoveRoadFull(TileIndex start, TileIndex end)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
 
	EnforcePrecondition(false, start != end);
 
	EnforcePrecondition(false, ::IsValidTile(start));
 
	EnforcePrecondition(false, ::IsValidTile(end));
 
	EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
src/script/api/script_road.hpp
Show inline comments
 
@@ -418,6 +418,7 @@ public:
 
	 * Removes a road from the center of tile start to the center of tile end.
 
	 * @param start The start tile of the road.
 
	 * @param end The end tile of the road.
 
	 * @pre 'start' is not equal to 'end'.
 
	 * @pre ScriptMap::IsValidTile(start).
 
	 * @pre ScriptMap::IsValidTile(end).
 
	 * @pre 'start' and 'end' are in a straight line, i.e.
 
@@ -437,6 +438,7 @@ public:
 
	 *  included).
 
	 * @param start The start tile of the road.
 
	 * @param end The end tile of the road.
 
	 * @pre 'start' is not equal to 'end'.
 
	 * @pre ScriptMap::IsValidTile(start).
 
	 * @pre ScriptMap::IsValidTile(end).
 
	 * @pre 'start' and 'end' are in a straight line, i.e.
0 comments (0 inline, 0 general)