OpenTTD: ScenarioScanner Class Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Private Attributes
ScenarioScanner Class Reference

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

Inheritance diagram for ScenarioScanner:

## 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.
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
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 >
ScenarioIdentifier * | data
| 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

  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.

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

  rescan | whether 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:

- src/fios.cpp