fix crash on cursor coordinate send if a control is issued without a player viewport open

Sven Eberhardt 2010-04-11 13:42:07 +02:00
parent 0767e3608e
commit 7e1a041b32
1 changed files with 1 additions and 0 deletions

View File

@ -1145,6 +1145,7 @@ bool C4PlayerControl::GetCurrentPlayerCursorPos(int32_t *x_out, int32_t *y_out)
C4Object *cursor_obj = plr->Cursor;
if (!cursor_obj) return false;
C4Viewport *vp = GraphicsSystem.GetViewport(iPlr);
if (!vp) return false;
int32_t game_x = cursor_obj->GetX(), game_y=cursor_obj->GetY();
// game coordinate to screen coordinates...
float screen_x = (float(game_x) - vp->last_game_draw_cgo.TargetX - vp->last_game_draw_cgo.X) * vp->Zoom;