Skip to content

Commit

Permalink
AttackDistanceHint to SetShootBorders param
Browse files Browse the repository at this point in the history
  • Loading branch information
cvet committed Dec 13, 2024
1 parent 8f4b9fe commit 3b18a29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Source/Client/MapView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2928,7 +2928,7 @@ void MapView::PrepareFogToDraw()
int hx = base_hx;
int hy = base_hy;
const int chosen_dir = chosen->GetDir();
const auto dist_shoot = chosen->GetAttackDistanceHint();
const auto dist_shoot = _shootBordersDist;
const auto half_hw = _engine->Settings.MapHexWidth / 2;
const auto half_hh = _engine->Settings.MapHexHeight / 2;

Expand Down Expand Up @@ -4466,12 +4466,13 @@ void MapView::FindSetCenter(int cx, int cy)
RebuildMap(hx, hy);
}

void MapView::SetShootBorders(bool enabled)
void MapView::SetShootBorders(bool enabled, uint dist)
{
STACK_TRACE_ENTRY();

if (_drawShootBorders != enabled) {
_drawShootBorders = enabled;
_shootBordersDist = dist;
RebuildFog();
}
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Client/MapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class MapView final : public ClientEntity, public EntityWithProto, public MapPro
void RebuildMapOffset(int ox, int oy);
void RefreshMap() { RebuildMap(_screenHexX, _screenHexY); }
void RebuildFog() { _rebuildFog = true; }
void SetShootBorders(bool enabled);
void SetShootBorders(bool enabled, uint dist);
auto MeasureMapBorders(const Sprite* spr, int ox, int oy) -> bool;
auto MeasureMapBorders(const ItemHexView* item) -> bool;
void RecacheHexFlags(uint16 hx, uint16 hy);
Expand Down Expand Up @@ -405,6 +405,7 @@ class MapView final : public ClientEntity, public EntityWithProto, public MapPro
bool _rebuildFog {};
bool _drawLookBorders {true};
bool _drawShootBorders {};
uint _shootBordersDist {};
vector<PrimitivePoint> _fogLookPoints {};
vector<PrimitivePoint> _fogShootPoints {};

Expand Down
2 changes: 0 additions & 2 deletions Source/Common/EntityProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,6 @@ class CritterProperties : public EntityProperties
///@ ExportProperty
ENTITY_PROPERTY(Protected, uint, LookDistance);
///@ ExportProperty
ENTITY_PROPERTY(PrivateClient, uint, AttackDistanceHint);
///@ ExportProperty
ENTITY_PROPERTY(Public, uint, TalkDistance);
///@ ExportProperty
ENTITY_PROPERTY(PrivateServer, uint, MaxTalkers);
Expand Down
4 changes: 2 additions & 2 deletions Source/Scripting/ClientMapScriptMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@
}

///@ ExportMethod
[[maybe_unused]] void Client_Map_SetShootBorders(MapView* self, bool enabled)
[[maybe_unused]] void Client_Map_SetShootBorders(MapView* self, bool enabled, uint dist)
{
self->SetShootBorders(enabled);
self->SetShootBorders(enabled, dist);
}

///@ ExportMethod
Expand Down

0 comments on commit 3b18a29

Please sign in to comment.