OpenTTD Source: ContentInfo Struct Reference

OpenTTD Source 12.2

Public Types | Public Member Functions | Data Fields
ContentInfo Struct Reference

Container for all important information about a piece of content. More...

`#include <tcp_content_type.h>`

## Public Types
enum | State { UNSELECTED, SELECTED, AUTOSELECTED, ALREADY_HERE, DOES_NOT_EXIST, INVALID }
| The state the content can be in. More...

## Public Member Functions
bool | IsSelected () const
| Is the state either selected or autoselected? More...
bool | IsValid () const
| Is the information from this content info valid? More...
const char * | GetTextfile (TextfileType type) const
| Search a textfile file next to this file in the content list. More...

## Data Fields
ContentType | type = INVALID_CONTENT_TYPE
| Type of content.
ContentID | id = INVALID_CONTENT_ID
| Unique (server side) ID for the content.
uint32 | filesize = 0
| Size of the file.
std::string | filename
| Filename (for the .tar.gz; only valid on download)
std::string | name
| Name of the content.
std::string | version
| Version of the content.
std::string | url
| URL related to the content.
std::string | description
| Description of the content.
uint32 | unique_id = 0
| Unique ID; either GRF ID or shortname.
byte | md5sum [16] = {0}
| The MD5 checksum.
std::vector< ContentID > | dependencies
| The dependencies (unique server side ids)
StringList | tags
| Tags associated with the content.
State | state = State::UNSELECTED
| Whether the content info is selected (for download)
bool | upgrade = false
| This item is an upgrade.

## Detailed Description

Container for all important information about a piece of content.

Definition at line 50 of file tcp_content_type.h.

## Member Enumeration Documentation

## ◆ State

enum ContentInfo::State

The state the content can be in.

Enumerator
UNSELECTED | The content has not been selected.
SELECTED | The content has been manually selected.
AUTOSELECTED | The content has been selected as dependency.
ALREADY_HERE | The content is already at the client side.
DOES_NOT_EXIST | The content does not exist in the content system.
INVALID | The content's invalid.

Definition at line 52 of file tcp_content_type.h.

## Member Function Documentation

## ◆ GetTextfile()

const char * ContentInfo::GetTextfile | ( | TextfileType | type | ) | const

Search a textfile file next to this file in the content list.

Parameters

  type | The type of the textfile to search for.

Returns
  The filename for the textfile, `nullptr` otherwise.

Definition at line 54 of file tcp_content.cpp.

References INVALID, and state.

## ◆ IsSelected()

bool ContentInfo::IsSelected | ( |  | ) | const

Is the state either selected or autoselected?

Returns
  true iff that's the case

Definition at line 27 of file tcp_content.cpp.

References ALREADY_HERE, AUTOSELECTED, SELECTED, and state.

Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), NetworkContentListWindow::OnReceiveContentInfo(), and ClientNetworkContentSocketHandler::Unselect().

## ◆ IsValid()

bool ContentInfo::IsValid | ( |  | ) | const

Is the information from this content info valid?

Returns
  true iff it's valid

Definition at line 44 of file tcp_content.cpp.

References CONTENT_TYPE_BEGIN, CONTENT_TYPE_END, INVALID, state, and type.

Referenced by ClientNetworkContentSocketHandler::BeforeDownload(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().

The documentation for this struct was generated from the following files:

- src/network/core/tcp_content_type.h
- src/network/core/tcp_content.cpp