Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/client/attachableobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class AttachableObject : public LuaObject
bool detachEffect(const AttachedEffectPtr& obj);
AttachedEffectPtr getAttachedEffectById(uint16_t id);

virtual void onStartAttachEffect(const AttachedEffectPtr& effect) { };
virtual void onDispatcherAttachEffect(const AttachedEffectPtr& effect) { };
virtual void onStartDetachEffect(const AttachedEffectPtr& effect) { };
virtual void onStartAttachEffect(const AttachedEffectPtr& /*effect*/) { };
virtual void onDispatcherAttachEffect(const AttachedEffectPtr& /*effect*/) { };
virtual void onStartDetachEffect(const AttachedEffectPtr& /*effect*/) { };

bool isOwnerHidden() { return m_ownerHidden > 0; }

Expand Down
2 changes: 1 addition & 1 deletion src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool Client::isUsingProtobuf()
return g_game.isUsingProtobuf();
}

void Client::onLoadingAsyncTextureChanged(bool loadingAsync)
void Client::onLoadingAsyncTextureChanged(bool /*loadingAsync*/)
{
g_sprites.reload();
}
6 changes: 3 additions & 3 deletions src/client/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Creature::onCreate() {
callLuaField("onCreate");
}

void Creature::draw(const Point& dest, bool drawThings, const LightViewPtr& lightView)
void Creature::draw(const Point& dest, bool drawThings, const LightViewPtr& /*lightView*/)
{
if (!canBeSeen() || !canDraw())
return;
Expand Down Expand Up @@ -1013,7 +1013,7 @@ uint16_t Creature::getCurrentAnimationPhase(const bool mount)
return isDisabledWalkAnimation() ? 0 : m_walkAnimationPhase;
}

int Creature::getExactSize(int layer, int xPattern, int yPattern, int zPattern, int animationPhase)
int Creature::getExactSize(int layer, int /*xPattern*/, int yPattern, int zPattern, int /*animationPhase*/)
{
if (m_exactSize > 0)
return m_exactSize;
Expand All @@ -1029,7 +1029,7 @@ int Creature::getExactSize(int layer, int xPattern, int yPattern, int zPattern,
if (yPattern > 0 && !(m_outfit.getAddons() & (1 << (yPattern - 1))))
continue;

for (int layer = 0; layer < layers; ++layer)
for (layer = 0; layer < layers; ++layer)
exactSize = std::max<int>(exactSize, Thing::getExactSize(layer, 0, yPattern, zPattern, 0));
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/client/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Item : public Thing

void updatePatterns();
int calculateAnimationPhase();
int getExactSize(int layer = 0, int xPattern = 0, int yPattern = 0, int zPattern = 0, int animationPhase = 0) override {
int getExactSize(int layer = 0, int /*xPattern*/ = 0, int /*yPattern*/ = 0, int /*zPattern*/ = 0, int /*animationPhase*/ = 0) override {
return Thing::getExactSize(layer, m_numPatternX, m_numPatternY, m_numPatternZ, calculateAnimationPhase());
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/lightview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <framework/core/asyncdispatcher.h>
#include <framework/graphics/drawpoolmanager.h>

LightView::LightView(const Size& size, const uint16_t tileSize) : m_pool(g_drawPool.get(DrawPoolType::LIGHT)) {
LightView::LightView(const Size& size) : m_pool(g_drawPool.get(DrawPoolType::LIGHT)) {
g_mainDispatcher.addEvent([this, size] {
m_texture = std::make_shared<Texture>(size);
m_texture->setSmooth(true);
Expand Down
2 changes: 1 addition & 1 deletion src/client/lightview.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class LightView : public LuaObject
{
public:
LightView(const Size& size, const uint16_t tileSize);
LightView(const Size& size);
~LightView() { m_texture = nullptr; }

void resize(const Size& size, uint16_t tileSize);
Expand Down
2 changes: 1 addition & 1 deletion src/client/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ void Map::updateAttachedWidgets(const MapViewPtr& mapView)
const auto& newWidgetRect = Rect(p, widgetRect.width(), widgetRect.height());

widget->disableUpdateTemporarily();
widget->setRect(newWidgetRect, false);
widget->setRect(newWidgetRect);
}
}

Expand Down
15 changes: 5 additions & 10 deletions src/client/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <framework/graphics/shadermanager.h>
#include <framework/platform/platformwindow.h>

MapView::MapView() : m_pool(g_drawPool.get(DrawPoolType::MAP)), m_lightView(std::make_unique<LightView>(Size(), g_gameConfig.getSpriteSize()))
MapView::MapView() : m_pool(g_drawPool.get(DrawPoolType::MAP)), m_lightView(std::make_unique<LightView>(Size()))
{
m_floors.resize(g_gameConfig.getMapMaxZ() + 1);

Expand Down Expand Up @@ -116,11 +116,6 @@ void MapView::preLoad() {
g_map.updateAttachedWidgets(static_self_cast<MapView>());
}

void MapView::draw(const Rect& rect)
{
drawFloor();
}

void MapView::drawFloor()
{
const auto& cameraPosition = m_posInfo.camera;
Expand Down Expand Up @@ -149,7 +144,7 @@ void MapView::drawFloor()
g_drawPool.setOpacity(inRange ? .16 : .7);
}

tile->draw(transformPositionTo2D(tile->getPosition()), m_posInfo, tileFlags);
tile->draw(transformPositionTo2D(tile->getPosition()), tileFlags);

if (alwaysTransparent)
g_drawPool.resetOpacity();
Expand Down Expand Up @@ -268,20 +263,20 @@ void MapView::drawForeground(const Rect& rect)
p += rect.topLeft();
animatedText->drawText(p, rect);
}

#ifndef BOT_PROTECTION
g_drawPool.scale(1.f);
for (const auto& tile : m_foregroundTiles) {
const auto& dest = transformPositionTo2D(tile->getPosition());
#ifndef BOT_PROTECTION

Point p = dest - m_posInfo.drawOffset;
p.x *= m_posInfo.horizontalStretchFactor;
p.y *= m_posInfo.verticalStretchFactor;
p += rect.topLeft();
p.y += 5;

tile->drawTexts(p);
#endif
}
#endif
}

void MapView::updateVisibleTiles()
Expand Down
1 change: 0 additions & 1 deletion src/client/mapview.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class MapView : public LuaObject

MapView();
~MapView() override;
void draw(const Rect& rect);
void drawForeground(const Rect& rect);
void drawCreatureInformation();
void preLoad();
Expand Down
6 changes: 3 additions & 3 deletions src/client/protocolgameparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3675,9 +3675,9 @@ void ProtocolGame::parseImbuementWindow(const InputMessagePtr& msg)
for (uint32_t i = 0; i < neededItemsSize; i++) {
const uint16_t needItemId = msg->getU16();
const uint16_t count = msg->getU16();
const ItemPtr& item = Item::create(needItemId);
item->setCount(count);
needItems.push_back(item);
const auto& needItem = Item::create(needItemId);
needItem->setCount(count);
needItems.push_back(needItem);
}

g_lua.callGlobalField("g_game", "onImbuementWindow", itemId, slot, activeSlots, imbuements, needItems);
Expand Down
2 changes: 1 addition & 1 deletion src/client/thing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <framework/core/graphicalapplication.h>
#include <framework/graphics/shadermanager.h>

void Thing::setPosition(const Position& position, uint8_t stackPos, bool hasElevation)
void Thing::setPosition(const Position& position, uint8_t /*stackPos*/, bool /*hasElevation*/)
{
if (m_position == position)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/client/thing.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class Thing : public AttachableObject
{
public:
virtual void draw(const Point& /*dest*/, bool drawThings = true, const LightViewPtr & = nullptr) {}
virtual void draw(const Point& /*dest*/, bool /*drawThings*/ = true, const LightViewPtr & = nullptr) {}
virtual void drawLight(const Point& /*dest*/, const LightViewPtr&) {}

LuaObjectPtr attachedObjectToLuaObject() override { return asLuaObject(); }
Expand Down
8 changes: 4 additions & 4 deletions src/client/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void drawThing(const ThingPtr& thing, const Point& dest, int flags, uint8_t& dra
updateElevation(thing, drawElevation);
}

void Tile::draw(const Point& dest, const MapPosInfo& mapRect, int flags, const LightViewPtr& lightView)
void Tile::draw(const Point& dest, int flags, const LightViewPtr& lightView)
{
m_drawElevation = 0;
m_lastDrawDest = dest;
Expand Down Expand Up @@ -82,12 +82,12 @@ void Tile::draw(const Point& dest, const MapPosInfo& mapRect, int flags, const L
// after we render 2x2 lying corpses, we must redraw previous creatures/ontop above them
if (m_tilesRedraw) {
for (const auto& tile : *m_tilesRedraw) {
tile->drawCreature(tile->m_lastDrawDest, mapRect, flags, true);
tile->drawCreature(tile->m_lastDrawDest, flags, true);
tile->drawTop(tile->m_lastDrawDest, flags, true);
}
}

drawCreature(dest, mapRect, flags, false);
drawCreature(dest, flags, false);
drawTop(dest, flags, false);
drawAttachedEffect(dest, lightView, true);
drawAttachedParticlesEffect(dest);
Expand All @@ -109,7 +109,7 @@ void Tile::drawLight(const Point& dest, const LightViewPtr& lightView) {
drawAttachedLightEffect(dest, lightView);
}

void Tile::drawCreature(const Point& dest, const MapPosInfo& mapRect, int flags, bool forceDraw)
void Tile::drawCreature(const Point& dest, int flags, bool forceDraw)
{
if (!forceDraw && !m_drawTopAndCreature)
return;
Expand Down
6 changes: 3 additions & 3 deletions src/client/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Tile : public AttachableObject
bool isTile() override { return true; }

void onAddInMapView();
void draw(const Point& dest, const MapPosInfo& mapRect, int flags, const LightViewPtr& lightView = nullptr);
void draw(const Point& dest, int flags, const LightViewPtr& lightView = nullptr);
void drawLight(const Point& dest, const LightViewPtr& lightView);

void clean();
Expand Down Expand Up @@ -217,7 +217,7 @@ class Tile : public AttachableObject
private:
void updateThingStackPos();
void drawTop(const Point& dest, int flags, bool forceDraw);
void drawCreature(const Point& dest, const MapPosInfo& mapRect, int flags, bool forceDraw);
void drawCreature(const Point& dest, int flags, bool forceDraw);

void setThingFlag(const ThingPtr& thing);

Expand All @@ -230,7 +230,7 @@ class Tile : public AttachableObject

bool hasThingWithElevation() const { return hasElevation() && m_thingTypeFlag & TileThingType::HAS_THING_WITH_ELEVATION; }
void markHighlightedThing(const Color& color) {
if (m_highlightThingStackPos > -1 && m_highlightThingStackPos < m_things.size()) {
if (m_highlightThingStackPos > -1 && m_highlightThingStackPos < static_cast<int8_t>(m_things.size())) {
m_things[m_highlightThingStackPos]->setMarked(color);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/client/uiitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "uiitem.h"
#include "lightview.h"
#include <framework/graphics/fontmanager.h>

UIItem::UIItem() { setProp(PropDraggable, true, false); }
Expand Down
5 changes: 3 additions & 2 deletions src/client/uimap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void UIMap::drawSelf(DrawPoolType drawPane)
if (drawPane == DrawPoolType::MAP) {
g_drawPool.preDraw(drawPane, [this, &mapRect] {
m_mapView->registerEvents();
m_mapView->draw(mapRect);
m_mapView->drawFloor();
}, m_mapView->m_posInfo.rect, m_mapView->m_posInfo.srcRect, Color::black);
} else if (drawPane == DrawPoolType::LIGHT) {
g_drawPool.preDraw(drawPane, [this] {
Expand Down Expand Up @@ -146,7 +146,8 @@ void UIMap::setVisibleDimension(const Size& visibleDimension)

void UIMap::setKeepAspectRatio(bool enable)
{
if (m_keepAspectRatio = enable)
m_keepAspectRatio = enable;
if (enable)
m_aspectRatio = getVisibleDimension().ratio();

updateMapSize();
Expand Down
14 changes: 7 additions & 7 deletions src/framework/core/resourcemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,9 @@ bool ResourceManager::launchCorrect(std::vector<std::string>& args) { // curentl
continue;

if (entry.path().extension() == m_binaryPath.extension()) {
std::error_code ec;
auto writeTime = std::filesystem::last_write_time(entry.path(), ec);
if (!ec && writeTime > lastWrite) {
std::error_code _ec;
auto writeTime = std::filesystem::last_write_time(entry.path(), _ec);
if (!_ec && writeTime > lastWrite) {
lastWrite = writeTime;
binary = entry.path();
}
Expand All @@ -715,8 +715,8 @@ bool ResourceManager::launchCorrect(std::vector<std::string>& args) { // curentl
if (entry.path().extension() == m_binaryPath.extension()) {
if (binary == entry.path())
continue;
std::error_code ec;
std::filesystem::remove(entry.path(), ec);
std::error_code _ec;
std::filesystem::remove(entry.path(), _ec);
}
}

Expand All @@ -728,10 +728,10 @@ bool ResourceManager::launchCorrect(std::vector<std::string>& args) { // curentl
#endif
}

std::string ResourceManager::createArchive(const std::unordered_map<std::string, std::string>& files) { return ""; }
std::string ResourceManager::createArchive(const std::unordered_map<std::string, std::string>& /*files*/) { return ""; }

std::unordered_map<std::string, std::string> ResourceManager::decompressArchive(std::string dataOrPath)
{
std::unordered_map<std::string, std::string> ret;
return ret;
}
}
12 changes: 6 additions & 6 deletions src/framework/graphics/bitmapfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void BitmapFont::fillTextCoords(const CoordsBufferPtr& coords, const std::string
}
}

void BitmapFont::fillTextColorCoords(std::vector<std::pair<Color, CoordsBufferPtr>>& colorCoords, const std::string_view text,
void BitmapFont::fillTextColorCoords(std::vector<std::pair<Color, CoordsBufferPtr>>& colorCoords, const std::string_view text,
const std::vector<std::pair<int, Color>> textColors,
const Size& textBoxSize, Fw::AlignmentFlag align,
const Rect& screenCoords, const std::vector<Point>& glyphsPositions) const
Expand All @@ -267,7 +267,7 @@ void BitmapFont::fillTextColorCoords(std::vector<std::pair<Color, CoordsBufferPt

const int textLenght = text.length();
const int textColorsSize = textColors.size();

std::map<uint32_t, CoordsBufferPtr> colorCoordsMap;
uint32_t curColorRgba;
int32_t nextColorIndex = 0;
Expand All @@ -291,7 +291,7 @@ void BitmapFont::fillTextColorCoords(std::vector<std::pair<Color, CoordsBufferPt

coords = colorCoordsMap[curColorRgba];
}

const int glyph = static_cast<uint8_t>(text[i]);

// skip invalid glyphs
Expand Down Expand Up @@ -354,8 +354,8 @@ void BitmapFont::fillTextColorCoords(std::vector<std::pair<Color, CoordsBufferPt
coords->addRect(glyphScreenCoords, glyphTextureCoords);
}

for (auto& [rgba, coords] : colorCoordsMap) {
colorCoords.emplace_back(Color(rgba), coords);
for (auto& [rgba, crds] : colorCoordsMap) {
colorCoords.emplace_back(Color(rgba), crds);
}
}

Expand Down Expand Up @@ -546,4 +546,4 @@ void BitmapFont::updateColors(std::vector<std::pair<int, Color>>* colors, int po
it.first += newTextLen;
}
}
}
}
11 changes: 6 additions & 5 deletions src/framework/graphics/drawpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,22 @@ class DrawPool
struct DrawObject
{
DrawObject(std::function<void()> action) : action(std::move(action)) {}
DrawObject(PoolState&& state) : state(std::move(state)), coords(std::make_unique<CoordsBuffer>()) {}
DrawObject(PoolState&& state) : coords(std::make_unique<CoordsBuffer>()), state(std::move(state)) {}
DrawObject(const DrawMode drawMode, PoolState&& state, DrawMethod&& method) :
drawMode(drawMode), state(std::move(state)) { methods.emplace_back(std::move(method)); }
state(std::move(state)), drawMode(drawMode) { methods.emplace_back(std::move(method)); }

void addMethod(DrawMethod&& method)
{
drawMode = DrawMode::TRIANGLES;
methods.emplace_back(std::move(method));
}

DrawMode drawMode{ DrawMode::TRIANGLES };
std::unique_ptr<CoordsBuffer> coords;
PoolState state;
std::vector<DrawMethod> methods;
std::function<void()> action{ nullptr };
std::unique_ptr<CoordsBuffer> coords;

PoolState state;
DrawMode drawMode{ DrawMode::TRIANGLES };
};

struct DrawObjectState
Expand Down
Loading