OpenTTD Source 20250501-master-ga30f251d05
ContentInfo Struct Reference

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

#include <tcp_content_type.h>

Public Types

enum  State : uint8_t {
  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?
 
bool IsValid () const
 Is the information from this content info valid?
 
std::optional< std::string > GetTextfile (TextfileType type) const
 Search a textfile file next to this file in the content list.
 

Data Fields

ContentType type = INVALID_CONTENT_TYPE
 Type of content.
 
ContentID id = INVALID_CONTENT_ID
 Unique (server side) ID for the content.
 
uint32_t 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_t unique_id = 0
 Unique ID; either GRF ID or shortname.
 
MD5Hash md5sum
 The MD5 checksum.
 
std::vector< ContentIDdependencies
 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 55 of file tcp_content_type.h.

Member Enumeration Documentation

◆ State

enum ContentInfo::State : uint8_t

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 57 of file tcp_content_type.h.

Member Function Documentation

◆ GetTextfile()

◆ IsSelected()

bool ContentInfo::IsSelected ( ) const

◆ IsValid()

bool ContentInfo::IsValid ( ) const

Is the information from this content info valid?

Returns
true iff it's valid

Definition at line 49 of file tcp_content.cpp.

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

Field Documentation

◆ dependencies

std::vector<ContentID> ContentInfo::dependencies

The dependencies (unique server side ids)

Definition at line 76 of file tcp_content_type.h.

Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), and NetworkContentListWindow::DrawDetails().

◆ description

std::string ContentInfo::description

Description of the content.

Definition at line 73 of file tcp_content_type.h.

Referenced by NetworkContentListWindow::DrawDetails().

◆ filename

std::string ContentInfo::filename

Filename (for the .tar.gz; only valid on download)

Definition at line 69 of file tcp_content_type.h.

Referenced by GetFullFilename(), and BaseNetworkContentDownloadStatusWindow::OnDownloadProgress().

◆ filesize

uint32_t ContentInfo::filesize = 0

Size of the file.

Definition at line 68 of file tcp_content_type.h.

Referenced by NetworkContentListWindow::DrawDetails(), and NetworkContentListWindow::OnInvalidateData().

◆ id

◆ md5sum

MD5Hash ContentInfo::md5sum

◆ name

◆ state

◆ tags

StringList ContentInfo::tags

Tags associated with the content.

Definition at line 77 of file tcp_content_type.h.

Referenced by NetworkContentListWindow::DrawDetails().

◆ type

◆ unique_id

uint32_t ContentInfo::unique_id = 0

◆ upgrade

bool ContentInfo::upgrade = false

This item is an upgrade.

Definition at line 79 of file tcp_content_type.h.

Referenced by NetworkContentListWindow::DrawDetails(), and NetworkContentListWindow::OnInvalidateData().

◆ url

std::string ContentInfo::url

◆ version

std::string ContentInfo::version

Version of the content.

Definition at line 71 of file tcp_content_type.h.

Referenced by NetworkContentListWindow::DrawDetails().


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