# HG changeset patch # User unc0rr # Date 1259421748 0 # Node ID 89aa2aa89066aa82c773dfe57a59ddc8b38aafd0 # Parent 52b7c4776af9b0ae2123a439e22eca87e009f8da Fix bug with cursor coordinates sent via net (or demo/save file) diff -r 52b7c4776af9 -r 89aa2aa89066 hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Sat Nov 28 02:46:15 2009 +0000 +++ b/hedgewars/CCHandlers.inc Sat Nov 28 15:22:28 2009 +0000 @@ -518,6 +518,11 @@ TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; end; SendIPCXY('p', TargetPoint.X, TargetPoint.Y); + end + else + begin + TargetPoint.X:= putX; + TargetPoint.Y:= putY end; {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} State:= State and not gstHHChooseTarget; diff -r 52b7c4776af9 -r 89aa2aa89066 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Sat Nov 28 02:46:15 2009 +0000 +++ b/hedgewars/uIO.pas Sat Nov 28 15:22:28 2009 +0000 @@ -261,6 +261,7 @@ procedure NetGetNextCmd; var tmpflag: boolean; s: shortstring; + x16, y16: SmallInt; begin tmpflag:= true; @@ -307,16 +308,16 @@ {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} end; 'p': begin - TargetPoint.X:= SDLNet_Read16(@(headcmd^.X)); - TargetPoint.Y:= SDLNet_Read16(@(headcmd^.Y)); - doPut(TargetPoint.X, TargetPoint.Y, true) + x16:= SDLNet_Read16(@(headcmd^.X)); + y16:= SDLNet_Read16(@(headcmd^.Y)); + doPut(x16, y16, false) end; 'P': begin // these are equations solved for CursorPoint // SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx; // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy; - CursorPoint.X:= SDLNet_Read16(@(headcmd^.X)) + WorldDx; - CursorPoint.Y:= cScreenHeight - SDLNet_Read16(@(headcmd^.Y)) - WorldDy; + CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X))) + WorldDx; + CursorPoint.Y:= cScreenHeight - SmallInt(SDLNet_Read16(@(headcmd^.Y))) - WorldDy; end; 'w': ParseCommand('setweap ' + headcmd^.str[2], true); 't': ParseCommand('taunt ' + headcmd^.str[2], true);