This is a fork of Zandronum Beta for Mac Os (Silicon and Intel)
修订版 | 983234fe42553bb6e26d3689a0fb9d11284c6072 (tree) |
---|---|
时间 | 2022-01-29 08:43:29 |
作者 | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Fixed: the server rejected backup weapon select commands that used different weapon network indices but had the same client gametic.
@@ -2029,6 +2029,7 @@ | ||
2029 | 2029 | g_aClients[lClient].lLastPacketLossTick = 0; |
2030 | 2030 | g_aClients[lClient].lLastMoveTick = 0; |
2031 | 2031 | g_aClients[lClient].lLastMoveTickProcess = 0; |
2032 | + g_aClients[lClient].usLastWeaponNetworkIndex = 0; | |
2032 | 2033 | g_aClients[lClient].lOverMovementLevel = 0; |
2033 | 2034 | g_aClients[lClient].bRunEnterScripts = false; |
2034 | 2035 | g_aClients[lClient].bSuspicious = false; |
@@ -5222,8 +5223,13 @@ | ||
5222 | 5223 | { |
5223 | 5224 | if ( recentCMDs->getOldestEntry( i ) == ulClientTic ) |
5224 | 5225 | { |
5225 | - delete cmd; | |
5226 | - return false; | |
5226 | + // [AK] Non-move (i.e. weapon select) commands with the same client gametic but | |
5227 | + // different weapon net ids are not duplicates, so don't delete them. | |
5228 | + if (( bIsMoveCMD ) || ( cmd->getWeaponNetworkIndex( ) == g_aClients[g_lCurrentClient].usLastWeaponNetworkIndex )) | |
5229 | + { | |
5230 | + delete cmd; | |
5231 | + return false; | |
5232 | + } | |
5227 | 5233 | } |
5228 | 5234 | } |
5229 | 5235 |
@@ -5231,6 +5237,10 @@ | ||
5231 | 5237 | recentCMDs->put( ulClientTic ); |
5232 | 5238 | } |
5233 | 5239 | |
5240 | + // [AK] Save the net id of the weapon sent last if this is a non-move (i.e. weapon select) command. | |
5241 | + if ( bIsMoveCMD == false ) | |
5242 | + g_aClients[g_lCurrentClient].usLastWeaponNetworkIndex = cmd->getWeaponNetworkIndex( ); | |
5243 | + | |
5234 | 5244 | if ( sv_useticbuffer ) |
5235 | 5245 | { |
5236 | 5246 | if ( ulClientTic != 0 ) |
@@ -285,6 +285,11 @@ | ||
285 | 285 | { |
286 | 286 | return 0; |
287 | 287 | } |
288 | + | |
289 | + virtual unsigned short getWeaponNetworkIndex ( ) const | |
290 | + { | |
291 | + return 0; | |
292 | + } | |
288 | 293 | }; |
289 | 294 | |
290 | 295 | //***************************************************************************** |
@@ -307,6 +312,11 @@ | ||
307 | 312 | return moveCmd.ulGametic; |
308 | 313 | } |
309 | 314 | |
315 | + virtual unsigned short getWeaponNetworkIndex ( ) const | |
316 | + { | |
317 | + return moveCmd.usWeaponNetworkIndex; | |
318 | + } | |
319 | + | |
310 | 320 | void setClientTic( ULONG ulTic ) |
311 | 321 | { |
312 | 322 | moveCmd.ulGametic = ulTic; |
@@ -321,6 +331,11 @@ | ||
321 | 331 | ClientWeaponSelectCommand ( BYTESTREAM_s *pByteStream ); |
322 | 332 | |
323 | 333 | bool process ( const ULONG ulClient ) const; |
334 | + | |
335 | + virtual unsigned short getWeaponNetworkIndex ( ) const | |
336 | + { | |
337 | + return usActorNetworkIndex; | |
338 | + } | |
324 | 339 | }; |
325 | 340 | |
326 | 341 | //***************************************************************************** |
@@ -431,6 +446,9 @@ | ||
431 | 446 | // [AK] The last movement command we received from this client. |
432 | 447 | ClientMoveCommand *LastMoveCMD; |
433 | 448 | |
449 | + // [AK] The network index the client sent with their last weapon select command. | |
450 | + USHORT usLastWeaponNetworkIndex; | |
451 | + | |
434 | 452 | // We keep track of how many extra movement commands we get from the client. If it |
435 | 453 | // exceeds a certain level over time, we kick him. |
436 | 454 | LONG lOverMovementLevel; |