OpenTTD
|
Scanner to find the unique IDs of scenarios. More...
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. | |
![]() | |
SmallVector (const SmallVector &other) | |
Copy constructor. | |
SmallVector (const SmallVector< ScenarioIdentifier, X > &other) | |
Generic copy constructor. | |
SmallVector & | operator= (const SmallVector &other) |
Assignment. | |
SmallVector & | operator= (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. | |
ScenarioIdentifier * | Append (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 ScenarioIdentifier * | Find (const ScenarioIdentifier &item) const |
Search for the first occurrence of an item. | |
ScenarioIdentifier * | Find (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 ScenarioIdentifier * | Begin () const |
Get the pointer to the first item (const) | |
ScenarioIdentifier * | Begin () |
Get the pointer to the first item. | |
const ScenarioIdentifier * | End () const |
Get the pointer behind the last valid item (const) | |
ScenarioIdentifier * | End () |
Get the pointer behind the last valid item. | |
const ScenarioIdentifier * | Get (uint index) const |
Get the pointer to item "number" (const) | |
ScenarioIdentifier * | Get (uint index) |
Get the pointer to item "number". | |
const ScenarioIdentifier & | operator[] (uint index) const |
Get item "number" (const) | |
ScenarioIdentifier & | operator[] (uint index) |
Get item "number". |
Private Attributes | |
bool | scanned |
Whether we've already scanned. |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
ScenarioIdentifier * | data |
The pointer to the first item. | |
uint | items |
The number of items stored. | |
uint | capacity |
The available space for storing items. |
|
inlinevirtual |
Add a file with the given filename.
filename | the full path to the file to read |
basepath_length | amount of characters to chop of before to get a filename relative to the search path. |
tar_filename | the name of the tar file the file is read from. |
< filename without the extension.
Implements FileScanner.
Definition at line 698 of file fios.cpp.
References FioFCloseFile(), FioFOpenFile(), lastof, SCENARIO_DIR, and strecpy().
|
inline |
Scan, but only if it's needed.
rescan | whether to force scanning even when it's not necessary |
Definition at line 690 of file fios.cpp.
References FileScanner::Scan(), and SCENARIO_DIR.
Referenced by FindScenario(), and ScanScenarios().