OpenTTD
Public Member Functions | Private Attributes
ScenarioScanner Class Reference

Scanner to find the unique IDs of scenarios. More...

Inheritance diagram for ScenarioScanner:
FileScanner SmallVector< ScenarioIdentifier, 8 >

Public Member Functions

 ScenarioScanner ()
 Initialise.
void Scan (bool rescan)
 Scan, but only if it's needed.
bool AddFile (const char *filename, size_t basepath_length, const char *tar_filename)
 Add a file with the given filename.
- Public Member Functions inherited from SmallVector< ScenarioIdentifier, 8 >
 SmallVector (const SmallVector &other)
 Copy constructor.
 SmallVector (const SmallVector< ScenarioIdentifier, X > &other)
 Generic copy constructor.
SmallVectoroperator= (const SmallVector &other)
 Assignment.
SmallVectoroperator= (const SmallVector< ScenarioIdentifier, X > &other)
 Generic assignment.
void Assign (const SmallVector< ScenarioIdentifier, X > &other)
 Assign items from other vector.
void Clear ()
 Remove all items from the list.
void Reset ()
 Remove all items from the list and free allocated memory.
void Compact ()
 Compact the list down to the smallest block size boundary.
ScenarioIdentifierAppend (uint to_add=1)
 Append an item and return it.
void Resize (uint num_items)
 Set the size of the vector, effectively truncating items from the end or appending uninitialised ones.
const ScenarioIdentifierFind (const ScenarioIdentifier &item) const
 Search for the first occurrence of an item.
ScenarioIdentifierFind (const ScenarioIdentifier &item)
 Search for the first occurrence of an item.
int FindIndex (const ScenarioIdentifier &item) const
 Search for the first occurrence of an item.
bool Contains (const ScenarioIdentifier &item) const
 Tests whether a item is present in the vector.
void Erase (ScenarioIdentifier *item)
 Removes given item from this vector.
void ErasePreservingOrder (uint pos, uint count=1)
 Remove items from the vector while preserving the order of other items.
bool Include (const ScenarioIdentifier &item)
 Tests whether a item is present in the vector, and appends it to the end if not.
uint Length () const
 Get the number of items in the list.
const ScenarioIdentifierBegin () const
 Get the pointer to the first item (const)
ScenarioIdentifierBegin ()
 Get the pointer to the first item.
const ScenarioIdentifierEnd () const
 Get the pointer behind the last valid item (const)
ScenarioIdentifierEnd ()
 Get the pointer behind the last valid item.
const ScenarioIdentifierGet (uint index) const
 Get the pointer to item "number" (const)
ScenarioIdentifierGet (uint index)
 Get the pointer to item "number".
const ScenarioIdentifieroperator[] (uint index) const
 Get item "number" (const)
ScenarioIdentifieroperator[] (uint index)
 Get item "number".

Private Attributes

bool scanned
 Whether we've already scanned.

Additional Inherited Members

- Protected Member Functions inherited from FileScanner
virtual ~FileScanner ()
 Destruct the proper one...
uint Scan (const char *extension, Subdirectory sd, bool tars=true, bool recursive=true)
 Scan for files with the given extension in the given search path.
uint Scan (const char *extension, const char *directory, bool recursive=true)
 Scan for files with the given extension in the given search path.
- Protected Attributes inherited from SmallVector< ScenarioIdentifier, 8 >
ScenarioIdentifierdata
 The pointer to the first item.
uint items
 The number of items stored.
uint capacity
 The available space for storing items.

Detailed Description

Scanner to find the unique IDs of scenarios.

Definition at line 614 of file fios.cpp.

Member Function Documentation

bool ScenarioScanner::AddFile ( const char *  filename,
size_t  basepath_length,
const char *  tar_filename 
)
inlinevirtual

Add a file with the given filename.

Parameters
filenamethe full path to the file to read
basepath_lengthamount of characters to chop of before to get a filename relative to the search path.
tar_filenamethe name of the tar file the file is read from.
Returns
true if the file is added.

< filename without the extension.

Implements FileScanner.

Definition at line 632 of file fios.cpp.

References FioFCloseFile(), FioFOpenFile(), lastof, SCENARIO_DIR, and strecpy().

void ScenarioScanner::Scan ( bool  rescan)
inline

Scan, but only if it's needed.

Parameters
rescanwhether to force scanning even when it's not necessary

Definition at line 624 of file fios.cpp.

References FileScanner::Scan(), and SCENARIO_DIR.

Referenced by FindScenario(), and ScanScenarios().


The documentation for this class was generated from the following file: