/** ** Draw additional informations of a unit. ** ** @param unit Unit pointer of drawn unit. ** @param type Unit-type pointer. ** @param screenPos screen pixel (top left) position of unit. ** ** @todo FIXME: The different styles should become a function call. */ static void DrawInformations(const CUnit &unit, const CUnitType &type, const PixelPos &screenPos) { #if 0 && DEBUG // This is for showing vis counts and refs. char buf[10]; sprintf(buf, "%d%c%c%d", unit.VisCount[ThisPlayer->Index], unit.Seen.ByPlayer & (1 << ThisPlayer->Index) ? 'Y' : 'N', unit.Seen.Destroyed & (1 << ThisPlayer->Index) ? 'Y' : 'N', unit.Refs); CLabel(GetSmallFont()).Draw(screenPos.x + 10, screenPos.y + 10, buf); #endif const CUnitStats &stats = *unit.Stats; // For debug draw sight, react and attack range! if (IsOnlySelected(unit)) { const PixelPos center(screenPos + type.GetPixelSize() / 2); if (Preference.ShowSightRange) { const int value = stats.Variables[SIGHTRANGE_INDEX].Max; const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2; if (value) { // Radius -1 so you can see all ranges Video.DrawCircleClip(ColorGreen, center.x, center.y, radius - 1); } } if (type.CanAttack) { if (Preference.ShowReactionRange) { const int value = (unit.Player->Type == PlayerPerson) ? type.ReactRangePerson : type.ReactRangeComputer; const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2; if (value) { Video.DrawCircleClip(ColorBlue, center.x, center.y, radius); } } if (Preference.ShowAttackRange) { const int value = stats.Variables[ATTACKRANGE_INDEX].Max; const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2; if (value) { // Radius +1 so you can see all ranges Video.DrawCircleClip(ColorGreen, center.x, center.y, radius - 1); } } } } // FIXME: johns: ugly check here, should be removed! if (unit.CurrentAction() != UnitActionDie && (unit.IsVisible(*ThisPlayer) || ReplayRevealMap)) { DrawDecoration(unit, type, screenPos); } }