Skip to content

Commit

Permalink
Add: support filtering content entries for patchpacks
Browse files Browse the repository at this point in the history
This changes nothing for us, but allows patchpacks to add the
right pieces of code to start filtering content entries on patchpack
only entries.
  • Loading branch information
TrueBrain committed Sep 10, 2021
1 parent 9e85f40 commit 8d57e4c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/network/core/tcp_content.h
Expand Up @@ -26,7 +26,11 @@ class NetworkContentSocketHandler : public NetworkTCPSocketHandler {
/**
* Client requesting a list of content info:
* byte type
* uint32 openttd version
* uint32 openttd version (or 0xFFFFFFFF if using a list)
* Only if the above value is 0xFFFFFFFF:
* uint8 count
* string branch-name ("official" for upstream OpenTTD)
* string release version (like "12.0")
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
Expand Down
15 changes: 14 additions & 1 deletion src/network/network_content.cpp
Expand Up @@ -207,7 +207,20 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentType type)

Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_LIST);
p->Send_uint8 ((byte)type);
p->Send_uint32(_openttd_newgrf_version);
p->Send_uint32(0xffffffff);
p->Send_uint8 (1);
p->Send_string("vanilla");
p->Send_string(_openttd_content_version);

/* Patchpacks can extend the list with one. In BaNaNaS metadata you can
* add a branch in the 'compatibility' list, to filter on this. If you want
* your patchpack to be mentioned in the BaNaNaS web-interface, create an
* issue on https://github.com/OpenTTD/bananas-api asking for this.
p->Send_string("patchpack"); // Or what-ever the name of your patchpack is.
p->Send_string(_openttd_content_version_patchpack);
*/

this->SendPacket(p);
}
Expand Down
7 changes: 7 additions & 0 deletions src/rev.cpp.in
Expand Up @@ -72,6 +72,13 @@ const byte _openttd_revision_modified = ${REV_MODIFIED};
*/
const byte _openttd_revision_tagged = ${REV_ISTAG};

/**
* To check compatibility of BaNaNaS content, this version string is used.
* It should never contain things like "beta", but only the release version
* we are compatible with.
*/
const char _openttd_content_version[] = "12.0";

/**
* The NewGRF revision of OTTD:
* bits meaning.
Expand Down
1 change: 1 addition & 0 deletions src/rev.h
Expand Up @@ -16,6 +16,7 @@ extern const char _openttd_revision_hash[];
extern const char _openttd_revision_year[];
extern const byte _openttd_revision_modified;
extern const byte _openttd_revision_tagged;
extern const char _openttd_content_version[];
extern const uint32 _openttd_newgrf_version;

bool IsReleasedVersion();
Expand Down

0 comments on commit 8d57e4c

Please sign in to comment.