OpenTTD Source  1.11.2
tcp_content_type.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
12 #ifndef NETWORK_CORE_TCP_CONTENT_TYPE_H
13 #define NETWORK_CORE_TCP_CONTENT_TYPE_H
14 
29 };
30 
41 };
42 
44 enum ContentID {
45  INVALID_CONTENT_ID = UINT32_MAX,
46 };
47 
49 struct ContentInfo {
51  enum State {
58  };
59 
62  uint32 filesize;
63  char filename[48];
64  char name[32];
65  char version[16];
66  char url[96];
67  char description[512];
68  uint32 unique_id;
69  byte md5sum[16];
72  uint8 tag_count;
73  char (*tags)[32];
75  bool upgrade;
76 
77  ContentInfo();
78  ~ContentInfo();
79 
80  void TransferFrom(ContentInfo *other);
81 
82  size_t Size() const;
83  bool IsSelected() const;
84  bool IsValid() const;
85 #ifndef OPENTTD_MSU
86  const char *GetTextfile(TextfileType type) const;
87 #endif /* OPENTTD_MSU */
88 };
89 
90 #endif /* NETWORK_CORE_TCP_CONTENT_TYPE_H */
ContentInfo::IsSelected
bool IsSelected() const
Is the state either selected or autoselected?
Definition: tcp_content.cpp:73
ContentInfo::tag_count
uint8 tag_count
Number of tags.
Definition: tcp_content_type.h:72
ContentInfo::~ContentInfo
~ContentInfo()
Free everything allocated.
Definition: tcp_content.cpp:32
ContentInfo::GetTextfile
const char * GetTextfile(TextfileType type) const
Search a textfile file next to this file in the content list.
Definition: tcp_content.cpp:101
ContentInfo::type
ContentType type
Type of content.
Definition: tcp_content_type.h:60
CONTENT_TYPE_GAME_LIBRARY
@ CONTENT_TYPE_GAME_LIBRARY
The content consists of a GS library.
Definition: tcp_content_type.h:27
ContentInfo::upgrade
bool upgrade
This item is an upgrade.
Definition: tcp_content_type.h:75
ContentInfo::DOES_NOT_EXIST
@ DOES_NOT_EXIST
The content does not exist in the content system.
Definition: tcp_content_type.h:56
ContentInfo::tags
char(* tags)[32]
Malloced array of tags (strings)
Definition: tcp_content_type.h:73
CONTENT_TYPE_NEWGRF
@ CONTENT_TYPE_NEWGRF
The content consists of a NewGRF.
Definition: tcp_content_type.h:19
PACKET_CONTENT_SERVER_CONTENT
@ PACKET_CONTENT_SERVER_CONTENT
Reply with the content of the given ID.
Definition: tcp_content_type.h:39
ContentInfo::State
State
The state the content can be in.
Definition: tcp_content_type.h:51
INVALID_CONTENT_ID
@ INVALID_CONTENT_ID
Sentinel for invalid content.
Definition: tcp_content_type.h:45
CONTENT_TYPE_END
@ CONTENT_TYPE_END
Helper to mark the end of the types.
Definition: tcp_content_type.h:28
PACKET_CONTENT_CLIENT_INFO_EXTID_MD5
@ PACKET_CONTENT_CLIENT_INFO_EXTID_MD5
Queries the content server for information about a list of external IDs and MD5.
Definition: tcp_content_type.h:36
ContentInfo::filename
char filename[48]
Filename (for the .tar.gz; only valid on download)
Definition: tcp_content_type.h:63
ContentInfo::IsValid
bool IsValid() const
Is the information from this content info valid?
Definition: tcp_content.cpp:90
ContentType
ContentType
The values in the enum are important; they are used as database 'keys'.
Definition: tcp_content_type.h:16
PacketContentType
PacketContentType
Enum with all types of TCP content packets.
Definition: tcp_content_type.h:32
ContentInfo::TransferFrom
void TransferFrom(ContentInfo *other)
Copy data from other ContentInfo and take ownership of allocated stuff.
Definition: tcp_content.cpp:42
PACKET_CONTENT_END
@ PACKET_CONTENT_END
Must ALWAYS be on the end of this list!! (period)
Definition: tcp_content_type.h:40
CONTENT_TYPE_GAME
@ CONTENT_TYPE_GAME
The content consists of a game script.
Definition: tcp_content_type.h:26
ContentInfo::UNSELECTED
@ UNSELECTED
The content has not been selected.
Definition: tcp_content_type.h:52
PACKET_CONTENT_CLIENT_INFO_ID
@ PACKET_CONTENT_CLIENT_INFO_ID
Queries the content server for information about a list of internal IDs.
Definition: tcp_content_type.h:34
ContentInfo
Container for all important information about a piece of content.
Definition: tcp_content_type.h:49
ContentInfo::md5sum
byte md5sum[16]
The MD5 checksum.
Definition: tcp_content_type.h:69
ContentInfo::SELECTED
@ SELECTED
The content has been manually selected.
Definition: tcp_content_type.h:53
PACKET_CONTENT_CLIENT_CONTENT
@ PACKET_CONTENT_CLIENT_CONTENT
Request a content file given an internal ID.
Definition: tcp_content_type.h:38
ContentInfo::url
char url[96]
URL related to the content.
Definition: tcp_content_type.h:66
ContentInfo::description
char description[512]
Description of the content.
Definition: tcp_content_type.h:67
PACKET_CONTENT_CLIENT_INFO_EXTID
@ PACKET_CONTENT_CLIENT_INFO_EXTID
Queries the content server for information about a list of external IDs.
Definition: tcp_content_type.h:35
CONTENT_TYPE_AI
@ CONTENT_TYPE_AI
The content consists of an AI.
Definition: tcp_content_type.h:20
CONTENT_TYPE_BASE_GRAPHICS
@ CONTENT_TYPE_BASE_GRAPHICS
The content consists of base graphics.
Definition: tcp_content_type.h:18
ContentInfo::ALREADY_HERE
@ ALREADY_HERE
The content is already at the client side.
Definition: tcp_content_type.h:55
ContentInfo::AUTOSELECTED
@ AUTOSELECTED
The content has been selected as dependency.
Definition: tcp_content_type.h:54
CONTENT_TYPE_AI_LIBRARY
@ CONTENT_TYPE_AI_LIBRARY
The content consists of an AI library.
Definition: tcp_content_type.h:21
ContentInfo::Size
size_t Size() const
Get the size of the data as send over the network.
Definition: tcp_content.cpp:57
ContentID
ContentID
Unique identifier for the content.
Definition: tcp_content_type.h:44
ContentInfo::ContentInfo
ContentInfo()
Clear everything in the struct.
Definition: tcp_content.cpp:26
CONTENT_TYPE_BEGIN
@ CONTENT_TYPE_BEGIN
Helper to mark the begin of the types.
Definition: tcp_content_type.h:17
ContentInfo::dependency_count
uint8 dependency_count
Number of dependencies.
Definition: tcp_content_type.h:70
PACKET_CONTENT_SERVER_INFO
@ PACKET_CONTENT_SERVER_INFO
Reply of content server with information about content.
Definition: tcp_content_type.h:37
ContentInfo::version
char version[16]
Version of the content.
Definition: tcp_content_type.h:65
ContentInfo::state
State state
Whether the content info is selected (for download)
Definition: tcp_content_type.h:74
CONTENT_TYPE_BASE_SOUNDS
@ CONTENT_TYPE_BASE_SOUNDS
The content consists of base sounds.
Definition: tcp_content_type.h:24
ContentInfo::unique_id
uint32 unique_id
Unique ID; either GRF ID or shortname.
Definition: tcp_content_type.h:68
PACKET_CONTENT_CLIENT_INFO_LIST
@ PACKET_CONTENT_CLIENT_INFO_LIST
Queries the content server for a list of info of a given content type.
Definition: tcp_content_type.h:33
CONTENT_TYPE_SCENARIO
@ CONTENT_TYPE_SCENARIO
The content consists of a scenario.
Definition: tcp_content_type.h:22
TextfileType
TextfileType
Additional text files accompanying Tar archives.
Definition: textfile_type.h:14
ContentInfo::name
char name[32]
Name of the content.
Definition: tcp_content_type.h:64
ContentInfo::INVALID
@ INVALID
The content's invalid.
Definition: tcp_content_type.h:57
ContentInfo::dependencies
ContentID * dependencies
Malloced array of dependencies (unique server side ids)
Definition: tcp_content_type.h:71
ContentInfo::id
ContentID id
Unique (server side) ID for the content.
Definition: tcp_content_type.h:61
CONTENT_TYPE_HEIGHTMAP
@ CONTENT_TYPE_HEIGHTMAP
The content consists of a heightmap.
Definition: tcp_content_type.h:23
ContentInfo::filesize
uint32 filesize
Size of the file.
Definition: tcp_content_type.h:62
CONTENT_TYPE_BASE_MUSIC
@ CONTENT_TYPE_BASE_MUSIC
The content consists of base music.
Definition: tcp_content_type.h:25