OpenTTD
|
Container for all important information about a piece of content. More...
#include <tcp_content.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 | |
ContentInfo () | |
Clear everything in the struct. | |
~ContentInfo () | |
Free everything allocated. | |
void | TransferFrom (ContentInfo *other) |
Copy data from other ContentInfo and take ownership of allocated stuff. | |
size_t | Size () const |
Get the size of the data as send over the network. | |
bool | IsSelected () const |
Is the state either selected or autoselected? | |
bool | IsValid () const |
Is the information from this content info valid? | |
const char * | GetTextfile (TextfileType type) const |
Search a textfile file next to this file in the content list. |
Data Fields | |
ContentType | type |
Type of content. | |
ContentID | id |
Unique (server side) ID for the content. | |
uint32 | filesize |
Size of the file. | |
char | filename [48] |
Filename (for the .tar.gz; only valid on download) | |
char | name [32] |
Name of the content. | |
char | version [16] |
Version of the content. | |
char | url [96] |
URL related to the content. | |
char | description [512] |
Description of the content. | |
uint32 | unique_id |
Unique ID; either GRF ID or shortname. | |
byte | md5sum [16] |
The MD5 checksum. | |
uint8 | dependency_count |
Number of dependencies. | |
ContentID * | dependencies |
Malloced array of dependencies (unique server side ids) | |
uint8 | tag_count |
Number of tags. | |
char(* | tags )[32] |
Malloced array of tags (strings) | |
State | state |
Whether the content info is selected (for download) | |
bool | upgrade |
This item is an upgrade. |
Container for all important information about a piece of content.
Definition at line 58 of file tcp_content.h.
enum ContentInfo::State |
The state the content can be in.
Definition at line 60 of file tcp_content.h.
const char * 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. |
NULL
otherwise. Definition at line 105 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< MusicSet >::GetAvailableSets(), BaseMedia< GraphicsSet >::GetAvailableSets(), BaseMedia< SoundsSet >::GetAvailableSets(), GetContentInfoSubDir(), Game::GetScannerInfo(), AI::GetScannerInfo(), Game::GetScannerLibrary(), AI::GetScannerLibrary(), INVALID, md5sum, state, TryGetBaseSetFile(), and unique_id.
bool ContentInfo::IsSelected | ( | ) | const |
Is the state either selected or autoselected?
Definition at line 77 of file tcp_content.cpp.
References ALREADY_HERE, AUTOSELECTED, SELECTED, and state.
Referenced by ClientNetworkContentSocketHandler::CheckDependencyState(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), NetworkContentListWindow::DrawDetails(), ClientNetworkContentSocketHandler::Unselect(), and ClientNetworkContentSocketHandler::UnselectAll().
bool ContentInfo::IsValid | ( | ) | const |
Is the information from this content info valid?
Definition at line 94 of file tcp_content.cpp.
References CONTENT_TYPE_BEGIN, CONTENT_TYPE_END, INVALID, state, and type.
Referenced by ClientNetworkContentSocketHandler::BeforeDownload().
size_t ContentInfo::Size | ( | ) | const |
Get the size of the data as send over the network.
Definition at line 61 of file tcp_content.cpp.
References dependencies, dependency_count, tag_count, and tags.
void ContentInfo::TransferFrom | ( | ContentInfo * | other | ) |
Copy data from other ContentInfo and take ownership of allocated stuff.
other | Source to copy from. dependencies and tags will be NULLed. |
Definition at line 46 of file tcp_content.cpp.
References dependencies, free(), and tags.