88 read_uint8 ,
99 read_uint16 ,
1010 read_uint32 ,
11+ read_uint64 ,
1112)
1213from ..wire .tcp import TCPProtocol
1314from ..wire .write import (
1920 write_uint8 ,
2021 write_uint16 ,
2122 write_uint32 ,
23+ write_uint64 ,
2224)
2325
2426log = logging .getLogger (__name__ )
@@ -136,9 +138,12 @@ def receive_PACKET_COORDINATOR_SERVER_UPDATE(source, data):
136138
137139 game_info_version , data = read_uint8 (data )
138140
139- if game_info_version < 1 or game_info_version > 6 :
141+ if game_info_version < 1 or game_info_version > 7 :
140142 raise PacketInvalidData ("unknown game info version: " , game_info_version )
141143
144+ if game_info_version >= 7 :
145+ ticks_playing , data = read_uint64 (data )
146+
142147 if game_info_version >= 6 :
143148 newgrf_serialization_type , data = read_uint8 (data )
144149
@@ -213,6 +218,10 @@ def receive_PACKET_COORDINATOR_SERVER_UPDATE(source, data):
213218
214219 is_dedicated , data = read_uint8 (data )
215220
221+ # Estimate, where possible, for older versions.
222+ if game_info_version < 7 :
223+ ticks_playing = max (0 , (start_date - game_date ) * 74 )
224+
216225 if len (data ) != 0 :
217226 raise PacketInvalidData ("more bytes than expected in SERVER_UPDATE; remaining: " , len (data ))
218227
@@ -237,6 +246,7 @@ def receive_PACKET_COORDINATOR_SERVER_UPDATE(source, data):
237246 "map_type" : map_type ,
238247 "gamescript_version" : gamescript_version ,
239248 "gamescript_name" : gamescript_name ,
249+ "ticks_playing" : ticks_playing ,
240250 }
241251
242252 @staticmethod
@@ -248,7 +258,7 @@ def receive_PACKET_COORDINATOR_CLIENT_LISTING(source, data):
248258
249259 game_info_version , data = read_uint8 (data )
250260
251- if game_info_version < 1 or game_info_version > 6 :
261+ if game_info_version < 1 or game_info_version > 7 :
252262 raise PacketInvalidData ("unknown game info version: " , game_info_version )
253263
254264 openttd_version , data = read_string (data )
@@ -433,6 +443,9 @@ async def send_PACKET_COORDINATOR_GC_LISTING(
433443 write_string (data , server .connection_string )
434444 write_uint8 (data , game_info_version )
435445
446+ if game_info_version >= 7 :
447+ write_uint64 (data , server .info ["ticks_playing" ])
448+
436449 if game_info_version >= 6 :
437450 write_uint8 (data , NewGRFSerializationType .NST_LOOKUP_ID )
438451
0 commit comments