summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-09-11 15:34:46 +0200
committerGitHub <noreply@github.com>2021-09-11 15:34:46 +0200
commita8641ea44a9c218a57abe84be7f38f0e19834bb3 (patch)
tree8a35898cbfa1ba2ea4a67e7ab30f53ec4333c05a /src
parent9e85f407337f47fc0b1d338229398354865f1c16 (diff)
downloadopenttd-a8641ea44a9c218a57abe84be7f38f0e19834bb3.tar.xz
Add: support filtering content entries for patchpacks (#9541)
This changes nothing for us, but allows patchpacks to add the right pieces of code to start filtering content entries on patchpack only entries.
Diffstat (limited to 'src')
-rw-r--r--src/network/core/tcp_content.h6
-rw-r--r--src/network/network_content.cpp15
-rw-r--r--src/rev.cpp.in7
-rw-r--r--src/rev.h1
4 files changed, 27 insertions, 2 deletions
diff --git a/src/network/core/tcp_content.h b/src/network/core/tcp_content.h
index d99986ef2..00e58d6f0 100644
--- a/src/network/core/tcp_content.h
+++ b/src/network/core/tcp_content.h
@@ -26,7 +26,11 @@ protected:
/**
* 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 ("vanilla" for upstream OpenTTD)
+ * string release version (like "12.0")
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index f130ffbb0..d6381a71b 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -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);
}
diff --git a/src/rev.cpp.in b/src/rev.cpp.in
index 337519ee2..3b8e68f95 100644
--- a/src/rev.cpp.in
+++ b/src/rev.cpp.in
@@ -73,6 +73,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[] = "${REV_MAJOR}.${REV_MINOR}";
+
+/**
* The NewGRF revision of OTTD:
* bits meaning.
* 24-31 major version + 16
diff --git a/src/rev.h b/src/rev.h
index 768938371..38883d1cc 100644
--- a/src/rev.h
+++ b/src/rev.h
@@ -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();