/** ** Check missile visibility in a given viewport. ** ** @param vp Viewport to be checked. ** @param missile Missile pointer to check if visible. ** ** @return Returns true if visible, false otherwise. */ static int MissileVisibleInViewport(const CViewport &vp, const Missile &missile) { Vec2i boxmin; Vec2i boxmax; GetMissileMapArea(missile, boxmin, boxmax); if (!vp.AnyMapAreaVisibleInViewport(boxmin, boxmax)) { return 0; } Vec2i pos; for (pos.x = boxmin.x; pos.x <= boxmax.x; ++pos.x) { for (pos.y = boxmin.y; pos.y <= boxmax.y; ++pos.y) { if (ReplayRevealMap || Map.Field(pos)->playerInfo.IsTeamVisible(*ThisPlayer)) { return 1; } } } return 0; }
/** ** Check missile visibility in a given viewport. ** ** @param vp Viewport to be checked. ** @param missile Missile pointer to check if visible. ** ** @return Returns true if visible, false otherwise. */ static int MissileVisibleInViewport(const CViewport *vp, const Missile *missile) { int min_x; int max_x; int min_y; int max_y; GetMissileMapArea(missile, &min_x, &min_y, &max_x, &max_y); if (!vp->AnyMapAreaVisibleInViewport(min_x, min_y, max_x, max_y)) { return 0; } for (int x = min_x; x <= max_x; ++x) { for (int y = min_y; y <= max_y; ++y) { if (ReplayRevealMap || Map.IsFieldVisible(ThisPlayer, x, y)) { return 1; } } } return 0; }