MinchinWeb's MetaLibrary
v.9
Library functions of OpenTTD AI writers.

Keep track of the world – match sources and destinations. More...
Public Member Functions  
function  GetVersion () 
function  GetRevision () 
function  GetDate () 
function  GetName () 
function  Reset () 
Resets the Atlas. More...  
function  AddSource (Source, Priority) 
Adds a source to the sources list with the given priority. More...  
function  AddAttraction (Attraction, Priority) 
Adds an attraction to the attraction list with the given priority. More...  
function  AddBoth (AddedTile, Priority) 
Adds to both sources and attractions. More...  
function  RunModel () 
Runs the Atlas. More...  
function  Pop () 
Pop the heap. More...  
function  Peek () 
Peek the heap. More...  
function  Count () 
Number of pairs in the heap. More...  
function  Exists () 
Check if an item exists in the heap. More...  
function  SetModel (newmodel) 
Set the model type. More...  
function  GetModel () 
Returns the current model type. More...  
function  PrintModelType (ToPrint) 
The string equivalent of the ModelType. More...  
function  SetMaxDistance (distance=1) 
Set the maximum distance the model will allow. More...  
function  SetMaxDistanceModel (newmodel) 
Set the ModelType for determining max distance. More...  
Static Public Member Functions  
function  ApplyTrafficModel (StartTile, StartPriority, EndTile, EndPriority, Model) 
Apply the Atlas model. More...  
Private Member Functions  
constructor ()  
Private Attributes  
_heap_class = import("Queue.Binary_Heap", "", 1)  
_sources = []  
'From' here... (array) More...  
_attractions = []  
'To' here (array) More...  
_pairs = null  
Heap of paired sources and attractions. More...  
_ignorepairs = []  
A list of pairs to ignore. More...  
_maxdistance = null  
This is the maximum distance between sources and attractions to include in the model. More...  
_maxdistancemodel = null  
This is how to measure distances between sources and attractions to determine weather they exceed "_maxdistance". More...  
_model = null  
Stores models selected, see ModelType. More...  
Keep track of the world – match sources and destinations.
The Atlas takes sources (departs) and attractions (destinations) and then generates a heap of pairs sorted by rating. I use this class to decide which pairs of industries or towns to service.
Ratings can be generated based on distance alone or can be altered by user defined ratings (e.g. industry productions or town populations).

inline 
function _MinchinWeb_Atlas_::AddBoth  (  AddedTile  , 
Priority  
) 

inline 

static 
Apply the Atlas model.
Given the start and end tiles, applies the traffic model and returns the weighting. Smaller weightings are considered better.
StartTile  Assumed to be a TileId 
StartPriority  Priority (weighting) assigned to Start 
EndTile  Assumed to be a TileId 
EndPriotity  Priority (weighting) assigned to End 
Model  Assumed to be one of the enum ModelType 

inline 

inline 

inline 

inline 
function _MinchinWeb_Atlas_::Pop  (  ) 
function _MinchinWeb_Atlas_::PrintModelType  (  ToPrint  ) 
function _MinchinWeb_Atlas_::Reset  (  ) 
function _MinchinWeb_Atlas_::RunModel  (  ) 
function _MinchinWeb_Atlas_::SetMaxDistance  (  distance  = 1  ) 
Set the maximum distance the model will allow.
distance  Sets the maximum distance between sources and attractions to be included in the model. Negative values remove the limit. 
function _MinchinWeb_Atlas_::SetMaxDistanceModel  (  newmodel  ) 
Set the ModelType for determining max distance.
Used to calculate the distance between the source and attraction for applying maxdistance
.
newmodel  ModelType to use 
newmodel
, ModelType .DISTANCE_NONE is invalid. Use SetMaxDistance(1)
instead. newmodel
, ModelType .ONE_OVER_T_SQUARED is invalid. function _MinchinWeb_Atlas_::SetModel  (  newmodel  ) 

private 

private 

private 

private 

private 

private 

private 

private 