add tile state 'loaded'

This commit is contained in:
Justin R. Miller
2014-02-25 15:34:32 -08:00
parent 78ab66b06c
commit 0406a82299
2 changed files with 4 additions and 2 deletions

View File

@@ -76,7 +76,8 @@ void Tile::request() {
// Note: Somehow this feels slower than the change to request_http()
std::shared_ptr<Tile> tile = shared_from_this();
platform::request_http_tile(url, tile, [=](platform::Response& res) {
if (res.code == 200) {
if (res.code == 200 && tile->state != obsolete) {
tile->state = Tile::loaded;
tile->data.swap(res.body);
tile->parse();
} else {
@@ -99,7 +100,7 @@ void Tile::cancel() {
bool Tile::parse() {
// std::lock_guard<std::mutex> lock(mtx);
if (state == obsolete) {
if (state != loaded) {
return false;
}