From 2b2ff9fb3fde834ccee58557217c71e318fb4a11 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Tue, 4 Feb 2014 11:46:06 -0500 Subject: [PATCH] abstract hardcoded URLs for now --- include/llmr/platform/platform.hpp | 3 +++ src/map/map.cpp | 2 +- src/map/tile.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/llmr/platform/platform.hpp b/include/llmr/platform/platform.hpp index 2f0de333f..f729c4e21 100644 --- a/include/llmr/platform/platform.hpp +++ b/include/llmr/platform/platform.hpp @@ -5,6 +5,9 @@ #include #include +#define kTileURL "http://localhost:3333/gl/tiles/plain/%d-%d-%d.vector.pbf" +#define kSpriteURL "http://localhost:3333/gl/debug/img/sprite" + namespace llmr { class Tile; diff --git a/src/map/map.cpp b/src/map/map.cpp index 0327a2951..fabf26c08 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -18,7 +18,7 @@ Map::Map(Settings& settings) // TODO: Extract that information from the stylesheet instead of hard coding style.sprite = std::make_shared(); - style.sprite->load("http://localhost:3333/gl/debug/img/sprite"); + style.sprite->load(kSpriteURL); } Map::~Map() { diff --git a/src/map/tile.cpp b/src/map/tile.cpp index 67bcc5a03..dccde9383 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -65,7 +65,7 @@ void Tile::request() { state = Tile::loading; // Create http request - std::string url = util::sprintf("http://localhost:3333/gl/tiles/plain/%d-%d-%d.vector.pbf", + std::string url = util::sprintf(kTileURL, id.z, id.x, id.y); // Note: Somehow this feels slower than the change to request_http()