From e31a45b229761864e9cc3c155d0ee2b49d6f1710 Mon Sep 17 00:00:00 2001 From: Jan Mrna Date: Sat, 27 Sep 2025 14:34:52 +0200 Subject: [PATCH] Move tile implementation to tile.cpp --- cpp/Makefile | 2 +- cpp/src/tile.cpp | 8 ++++++++ cpp/src/tile.hpp | 10 ++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cpp/Makefile b/cpp/Makefile index 88d2071..449f090 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -3,7 +3,7 @@ all: test pathfinding # TODO linter? pathfinding: - g++ -Wall -ggdb3 -lSDL3 -lSDL3_image -std=c++23 -lGLEW -lGL -o pathfinding src/main.cpp src/sprite.cpp src/entities.cpp src/gameloop.cpp src/map.cpp src/pathfindingdemo.cpp + g++ -Wall -ggdb3 -lSDL3 -lSDL3_image -std=c++23 -lGLEW -lGL -o pathfinding src/main.cpp src/sprite.cpp src/entities.cpp src/gameloop.cpp src/map.cpp src/pathfindingdemo.cpp src/tile.cpp test: src/test.cpp src/array.hpp g++ -Wall -Wextra -Wpedantic -ggdb3 -std=c++23 -lgtest -o test src/test.cpp diff --git a/cpp/src/tile.cpp b/cpp/src/tile.cpp index e69de29..98e7b6a 100644 --- a/cpp/src/tile.cpp +++ b/cpp/src/tile.cpp @@ -0,0 +1,8 @@ +#include "tile.hpp" + +const std::map tile_types = { + {"Grass", {1.0, 0, 200, 0, 255}}, + {"Mud", {2.0, 100, 100, 100, 255}}, + {"Road", {0.5, 200, 200, 200, 255}}, + {"Water", {10.0, 0, 50, 200, 255}}, +}; diff --git a/cpp/src/tile.hpp b/cpp/src/tile.hpp index 6fbe7f6..7799fec 100644 --- a/cpp/src/tile.hpp +++ b/cpp/src/tile.hpp @@ -1,18 +1,12 @@ #pragma once +#include #include #include -#include struct Tile { float cost; uint8_t R, G, B, A; }; -static const std::map tile_types = { - {"Grass", {1.0, 0, 200, 0, 255}}, - {"Mud", {2.0, 100, 100, 100, 255}}, - {"Road", {0.5, 200, 200, 200, 255}}, - {"Water", {10.0, 0, 50, 200, 255}}, -}; - +extern const std::map tile_types;