OpenTTD Source 20241224-master-gee860a5c8e
|
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? | |
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< 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. | |
Container for all important information about a piece of content.
Definition at line 52 of file tcp_content_type.h.
enum ContentInfo::State |
The state the content can be in.
Definition at line 54 of file tcp_content_type.h.
std::optional< std::string > ContentInfo::GetTextfile | ( | TextfileType | type | ) | const |
Search a textfile file next to this file in the content list.
type | The type of the textfile to search for. |
Definition at line 54 of file tcp_content.cpp.
References BSWAP32(), CONTENT_TYPE_AI, CONTENT_TYPE_AI_LIBRARY, CONTENT_TYPE_BASE_GRAPHICS, CONTENT_TYPE_BASE_MUSIC, CONTENT_TYPE_BASE_SOUNDS, CONTENT_TYPE_GAME, CONTENT_TYPE_GAME_LIBRARY, CONTENT_TYPE_HEIGHTMAP, CONTENT_TYPE_NEWGRF, CONTENT_TYPE_SCENARIO, FGCM_EXACT, GRFConfig::filename, FindGRFConfig(), ScriptScanner::FindMainScript(), FindScenario(), BaseMedia< GraphicsSet >::GetAvailableSets(), BaseMedia< MusicSet >::GetAvailableSets(), BaseMedia< SoundsSet >::GetAvailableSets(), GetContentInfoSubDir(), AI::GetScannerInfo(), Game::GetScannerInfo(), AI::GetScannerLibrary(), Game::GetScannerLibrary(), INVALID, md5sum, state, TryGetBaseSetFile(), type, and unique_id.
bool ContentInfo::IsSelected | ( | ) | const |
Is the state either selected or autoselected?
Definition at line 27 of file tcp_content.cpp.
References ALREADY_HERE, AUTOSELECTED, SELECTED, and state.
Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), NetworkContentListWindow::DrawDetails(), and ClientNetworkContentSocketHandler::Unselect().
bool ContentInfo::IsValid | ( | ) | const |
Is the information from this content info 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().
std::vector<ContentID> ContentInfo::dependencies |
The dependencies (unique server side ids)
Definition at line 73 of file tcp_content_type.h.
Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), NetworkContentListWindow::DrawDetails(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
std::string ContentInfo::description |
Description of the content.
Definition at line 70 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
std::string ContentInfo::filename |
Filename (for the .tar.gz; only valid on download)
Definition at line 66 of file tcp_content_type.h.
Referenced by GetFullFilename(), BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(), ClientNetworkContentSocketHandler::OnReceiveData(), and ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT().
uint32_t ContentInfo::filesize = 0 |
Size of the file.
Definition at line 65 of file tcp_content_type.h.
Referenced by ClientNetworkContentSocketHandler::BeforeDownload(), NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveData(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
ContentID ContentInfo::id = INVALID_CONTENT_ID |
Unique (server side) ID for the content.
Definition at line 64 of file tcp_content_type.h.
Referenced by ClientNetworkContentSocketHandler::AfterDownload(), ClientNetworkContentSocketHandler::CheckDependencyState(), NetworkContentListWindow::DrawDetails(), BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(), BootstrapAskForDownloadWindow::OnReceiveContentInfo(), ClientNetworkContentSocketHandler::OnReceiveData(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), and ClientNetworkContentSocketHandler::ToggleSelectedState().
MD5Hash ContentInfo::md5sum |
The MD5 checksum.
Definition at line 72 of file tcp_content_type.h.
Referenced by FindScenario(), GetTextfile(), HasGRFConfig(), IsSameScript(), NetworkContentListWindow::OpenExternalSearch(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ShowMissingContentWindow(), and TryGetBaseSetFile().
std::string ContentInfo::name |
Name of the content.
Definition at line 67 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::DrawMatrix(), NetworkContentListWindow::NameSorter(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ContentTextfileWindow::SetStringParameters(), and ShowMissingContentWindow().
State ContentInfo::state = State::UNSELECTED |
Whether the content info is selected (for download)
Definition at line 75 of file tcp_content_type.h.
Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::DrawMatrix(), GetTextfile(), IsSelected(), IsValid(), NetworkContentListWindow::OnClick(), ClientNetworkContentSocketHandler::OnDownloadComplete(), NetworkContentListWindow::OnInvalidateData(), NetworkContentListWindow::OpenExternalSearch(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ClientNetworkContentSocketHandler::Select(), ShowMissingContentWindow(), NetworkContentListWindow::StateSorter(), ClientNetworkContentSocketHandler::ToggleSelectedState(), and ClientNetworkContentSocketHandler::Unselect().
StringList ContentInfo::tags |
Tags associated with the content.
Definition at line 74 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
ContentType ContentInfo::type = INVALID_CONTENT_TYPE |
Type of content.
Definition at line 63 of file tcp_content_type.h.
Referenced by ClientNetworkContentSocketHandler::AfterDownload(), NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::DrawMatrix(), GetFullFilename(), GetTextfile(), IsValid(), NetworkContentDownloadStatusWindow::OnDownloadProgress(), ClientNetworkContentSocketHandler::OnReceiveData(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ShowMissingContentWindow(), and NetworkContentListWindow::TypeSorter().
uint32_t ContentInfo::unique_id = 0 |
Unique ID; either GRF ID or shortname.
Definition at line 71 of file tcp_content_type.h.
Referenced by FindScenario(), GetTextfile(), HasGRFConfig(), IsSameScript(), NetworkContentListWindow::OpenExternalSearch(), OutputContentState(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ShowMissingContentWindow(), and TryGetBaseSetFile().
bool ContentInfo::upgrade = false |
This item is an upgrade.
Definition at line 76 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::OnInvalidateData(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
std::string ContentInfo::url |
URL related to the content.
Definition at line 69 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), NetworkContentListWindow::OnClick(), NetworkContentListWindow::OnInvalidateData(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().
std::string ContentInfo::version |
Version of the content.
Definition at line 68 of file tcp_content_type.h.
Referenced by NetworkContentListWindow::DrawDetails(), and ClientNetworkContentSocketHandler::Receive_SERVER_INFO().