Skip to content

Commit c552bc8

Browse files
committed
Update the value of CGameServer::cheating also when running a demo
1 parent c8ece26 commit c552bc8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

rts/Game/GameServer.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,21 @@ bool CGameServer::SendDemoData(int targetFrameNum)
518518
// never send these from demos
519519
break;
520520
}
521-
521+
case NETMSG_CCOMMAND: {
522+
if (!AdjustPlayerNumber(buf ,3))
523+
continue;
524+
try {
525+
CommandMessage msg(rpkt);
526+
const Action& action = msg.GetAction();
527+
if (msg.GetPlayerID() == SERVER_PLAYER && action.command == "cheat")
528+
SetBoolArg(cheating, action.extra);
529+
} catch (const netcode::UnpackPacketException& ex) {
530+
Message(str(format("Warning: Discarding invalid command message packet in demo: %s") %ex.what()));
531+
continue;
532+
}
533+
Broadcast(rpkt);
534+
break;
535+
}
522536
default: {
523537
Broadcast(rpkt);
524538
break;

0 commit comments

Comments
 (0)