That might be the problem here, yes - although I have yet to see the function being called twice. I can as well add a check to see whether m_pCurrentCommand is valid or not and decide not to actually fire a bullet if it's invalid. Would be a quick solution, but it only masks the real problem here and I'm not a friend of such hacks ;) One thing I forgot to mention is that the problem seems to occur only when the server is quite crowded. Not being an expert in Source networking I could imagine that roundtrip times/jitter/packet loss are the reason why the function might get called twice. Since this is no known problem in the Source engine itself there must be something wrong in our code, like improperly predicted weapons. Any other ideas on what may be the bugger here?
Rgds, Jan -----Ursprüngliche Nachricht----- Von: hlcoders-boun...@list.valvesoftware.com [mailto:hlcoders-boun...@list.valvesoftware.com] Im Auftrag von Saul Rennison Gesendet: Sonntag, 5. Juni 2011 15:52 An: Discussion of Half-Life Programming Betreff: Re: [hlcoders] Crash during setup of lag compensation The only thing that I can imagine is happening is the function is getting called twice somehow. So then it's fine on the first call, then NULL on the second. On Sunday, 5 June 2011, Jan Hartung <j...@maennertechnik.net> wrote: > Hi list, I am facing a nasty bug which unfortunately appears randomly, so theres no clear way to reproduce it. The crash occurs when firing a weapon (where it doesnt matter which weapon it is) in player_lagcompensation.cpp on line 360, which is: int targettick = cmd->tick_count - lerpTicks; The problem here is that cmd (the current player command) is null. This is quite strange as in the stack trace it all starts here: player_command.cpp line 424 (call to RunPostThink which triggers the gun fire a few steps later in the stack) To set up lag compensation player->GetCurrentCommand() is used, which returns m_pCurrentCommand. At this point it is not a null pointer. Later on in code execution, on line 428 in player_command.cpp there is a call to FinishCommand( player ) which sets m_pCurrentCommand to null this being the only server-side line of code setting m_pCurrentCommand to null except when calling the CBasePlayer constructor. Im kinda stuck here since I just cannot figure out why m_pCurrentCommand is null when it is accessed during StartLagCompensation when it is only being set to null several lines later. Any help or hint on this issue is appreciated. Regards,Jan -- Thanks, - Saul _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders