From 277157b3e06b2deeacbdbc8bf6190de19f88169d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 23 Oct 2024 16:09:47 +0200 Subject: more refactoring / preparation for pathfinding --- TileColorFactory.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'TileColorFactory.cpp') diff --git a/TileColorFactory.cpp b/TileColorFactory.cpp index 7c5b080..22738f6 100644 --- a/TileColorFactory.cpp +++ b/TileColorFactory.cpp @@ -2,18 +2,14 @@ using namespace std; -Color TileColorFactory::get_color(string type) { - auto & type_map = TileColorFactory::get_collection(); - - if (type_map.contains(type)) - return type_map.at(type); +const Color & TileColorFactory::get_color(const string & type) { + if (this->collection.contains(type)) + return this->collection.at(type); return TileColorFactory::default_color; } -void TileColorFactory::register_color(string type, Color color) { - auto & type_map = TileColorFactory::get_collection(); - - type_map[type] = color; +void TileColorFactory::register_color(const string & type, const Color & color) { + this->collection[type] = color; } -- cgit v1.2.3