launcher/demo.cpp

changeset 64
c55e46b7ddeb
parent 63
d10a6be4d99e
--- a/launcher/demo.cpp	Sun Nov 14 21:45:45 2021 +0200
+++ b/launcher/demo.cpp	Sun Nov 28 23:45:30 2021 +0200
@@ -160,6 +160,7 @@
 	quint8 respawnOnFire;
 	quint8 ticsPerUpdate;
 	quint8 connectionType;
+	quint8 colorset;
 };
 
 //
@@ -197,6 +198,7 @@
 	quint16 zanversionID, numWads;
 	quint32 longSink;
 	QString zanversion;
+	QString dateversion = "00000000";
 	QStringList wads;
 	UserInfo userinfo;
 
@@ -250,6 +252,10 @@
 				stream >> a;
 				buildID = (BuildType) a;
 			}
+			if (zanversion.contains("-r"))
+			{
+				dateversion = zanversion.split("-r").last();
+			}
 
 			// The demo wads header accidentally changed in 1.3. :(
 			if (zanversion.left(1).toInt() >= 2 or zanversion.startsWith ("1.3"))
@@ -261,6 +267,12 @@
 		{
 			userinfo.netname = readString (stream);
 			stream >> userinfo.gender;
+			// Zandronum commit 507a744e69c4 added support for colorsets and versions since that
+			// write a byte for the colorset in the userinfo.
+			if (dateversion >= "210307-0319")
+			{
+				stream >> userinfo.colorset;
+			}
 			stream >> userinfo.color;
 			stream >> userinfo.aimdist;
 			userinfo.skin = readString (stream);

mercurial