mirror of
https://github.com/vcmi/vcmi.git
synced 2026-05-22 09:55:17 +02:00
38bfd1c7e5
Many quoted local includes had an incorrect ../ depth and resolved to
non-existent files from the including file's directory.
This was easy to miss because normal target include directories and PCH
usage masked some failures, and several stale paths lived in files that
are only compiled in optional test configurations. As a result, the
problem mostly surfaced in stricter or broader fresh builds.
Audit all C++ and header local includes, keep them relative, and adjust
paths so each include resolves to an existing in-tree header. For
headers that were renamed or moved, update includes to their current
relative location instead of switching to include-root form.
A few legacy ERM tests also used dynamic_ptr_cast at call sites where we
had to replace stale headers. The helper/header path they relied on is
no longer present after 81af66d35b, so
those downcasts are now explicit dynamic_cast calls with the same intent.
174 lines
6.0 KiB
C++
174 lines
6.0 KiB
C++
/*
|
|
* MapRendererContext.h, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include "IMapRendererContext.h"
|
|
|
|
#include "../../lib/GameConstants.h"
|
|
#include "../../lib/int3.h"
|
|
#include "../../lib/spells/ViewSpellInt.h"
|
|
|
|
struct MapRendererContextState;
|
|
|
|
class MapRendererBaseContext : public IMapRendererContext
|
|
{
|
|
public:
|
|
const MapRendererContextState & viewState;
|
|
bool settingsSessionSpectate = false;
|
|
|
|
explicit MapRendererBaseContext(const MapRendererContextState & viewState);
|
|
|
|
uint32_t getObjectRotation(ObjectInstanceID objectID) const;
|
|
|
|
int3 getMapSize() const override;
|
|
bool isInMap(const int3 & coordinates) const override;
|
|
bool isVisible(const int3 & coordinates) const override;
|
|
bool tileAnimated(const int3 & coordinates) const override;
|
|
|
|
bool isActiveHero(const CGObjectInstance* obj) const override;
|
|
int attackedMonsterDirection(const CGObjectInstance * wanderingMonster) const override;
|
|
|
|
const TerrainTile & getMapTile(const int3 & coordinates) const override;
|
|
const MapObjectsList & getObjects(const int3 & coordinates) const override;
|
|
const CGObjectInstance * getObject(ObjectInstanceID objectID) const override;
|
|
const CGPath * currentPath() const override;
|
|
|
|
size_t objectGroupIndex(ObjectInstanceID objectID) const override;
|
|
Point objectImageOffset(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
double objectTransparency(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
size_t objectImageIndex(ObjectInstanceID objectID, size_t groupSize) const override;
|
|
size_t terrainImageIndex(size_t groupSize) const override;
|
|
size_t overlayImageIndex(const int3 & coordinates) const override;
|
|
std::string overlayText(const int3 & coordinates) const override;
|
|
ColorRGBA overlayTextColor(const int3 & coordinates) const override;
|
|
|
|
double viewTransitionProgress() const override;
|
|
bool filterGrayscale() const override;
|
|
bool showRoads() const override;
|
|
bool showRivers() const override;
|
|
bool showBorder() const override;
|
|
bool showImageOverlay() const override;
|
|
bool showTextOverlay() const override;
|
|
bool showGrid() const override;
|
|
bool showVisitable() const override;
|
|
bool showBlocked() const override;
|
|
bool showInvisible() const override;
|
|
bool showSpellRange(const int3 & position) const override;
|
|
};
|
|
|
|
class MapRendererAdventureContext : public MapRendererBaseContext
|
|
{
|
|
public:
|
|
uint32_t animationTime = 0;
|
|
bool settingShowGrid = false;
|
|
bool settingShowVisitable = false;
|
|
bool settingShowBlocked = false;
|
|
bool settingShowInvisible = false;
|
|
bool settingTextOverlay = false;
|
|
bool settingsAdventureObjectAnimation = true;
|
|
bool settingsAdventureTerrainAnimation = true;
|
|
|
|
explicit MapRendererAdventureContext(const MapRendererContextState & viewState);
|
|
|
|
const CGPath * currentPath() const override;
|
|
size_t objectImageIndex(ObjectInstanceID objectID, size_t groupSize) const override;
|
|
size_t terrainImageIndex(size_t groupSize) const override;
|
|
std::string overlayText(const int3 & coordinates) const override;
|
|
ColorRGBA overlayTextColor(const int3 & coordinates) const override;
|
|
|
|
bool showBorder() const override;
|
|
bool showGrid() const override;
|
|
bool showVisitable() const override;
|
|
bool showBlocked() const override;
|
|
bool showInvisible() const override;
|
|
bool showTextOverlay() const override;
|
|
|
|
bool showSpellRange(const int3 & position) const override;
|
|
};
|
|
|
|
class MapRendererAdventureTransitionContext : public MapRendererAdventureContext
|
|
{
|
|
public:
|
|
double progress = 0;
|
|
|
|
explicit MapRendererAdventureTransitionContext(const MapRendererContextState & viewState);
|
|
|
|
double viewTransitionProgress() const override;
|
|
};
|
|
|
|
class MapRendererAdventureFadingContext : public MapRendererAdventureContext
|
|
{
|
|
public:
|
|
ObjectInstanceID target;
|
|
double progress;
|
|
|
|
explicit MapRendererAdventureFadingContext(const MapRendererContextState & viewState);
|
|
|
|
bool tileAnimated(const int3 & coordinates) const override;
|
|
double objectTransparency(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
};
|
|
|
|
class MapRendererAdventureMovingContext : public MapRendererAdventureContext
|
|
{
|
|
public:
|
|
ObjectInstanceID target;
|
|
int3 tileFrom;
|
|
int3 tileDest;
|
|
double progress;
|
|
|
|
explicit MapRendererAdventureMovingContext(const MapRendererContextState & viewState);
|
|
|
|
bool tileAnimated(const int3 & coordinates) const override;
|
|
size_t objectGroupIndex(ObjectInstanceID objectID) const override;
|
|
Point objectImageOffset(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
size_t objectImageIndex(ObjectInstanceID objectID, size_t groupSize) const override;
|
|
};
|
|
|
|
class MapRendererWorldViewContext : public MapRendererBaseContext
|
|
{
|
|
protected:
|
|
size_t selectOverlayImageForObject(const ObjectPosInfo & object) const;
|
|
|
|
public:
|
|
explicit MapRendererWorldViewContext(const MapRendererContextState & viewState);
|
|
|
|
size_t overlayImageIndex(const int3 & coordinates) const override;
|
|
bool showImageOverlay() const override;
|
|
};
|
|
|
|
class MapRendererSpellViewContext : public MapRendererWorldViewContext
|
|
{
|
|
public:
|
|
std::vector<ObjectPosInfo> additionalOverlayIcons;
|
|
bool showAllTerrain = false;
|
|
|
|
explicit MapRendererSpellViewContext(const MapRendererContextState & viewState);
|
|
|
|
bool isVisible(const int3 & coordinates) const override;
|
|
double objectTransparency(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
size_t overlayImageIndex(const int3 & coordinates) const override;
|
|
};
|
|
|
|
class MapRendererPuzzleMapContext : public MapRendererBaseContext
|
|
{
|
|
public:
|
|
std::unique_ptr<CGPath> grailPos;
|
|
|
|
explicit MapRendererPuzzleMapContext(const MapRendererContextState & viewState);
|
|
~MapRendererPuzzleMapContext();
|
|
|
|
const CGPath * currentPath() const override;
|
|
double objectTransparency(ObjectInstanceID objectID, const int3 & coordinates) const override;
|
|
bool isVisible(const int3 & coordinates) const override;
|
|
bool filterGrayscale() const override;
|
|
bool showRoads() const override;
|
|
bool showRivers() const override;
|
|
};
|