From 52291013e4cb8cbe8f02789c555521f39cb8c785 Mon Sep 17 00:00:00 2001 From: Tim Goya Date: Thu, 8 Mar 2007 15:01:58 +0000 Subject: [PATCH] Make a nice default gradient when there isn't already a background or gradient, issue 0000188 SVN-Revision: 4941 --- src/sector.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sector.cpp b/src/sector.cpp index 125d18648..362f183de 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -177,6 +177,7 @@ Sector::parse_object(const std::string& name, const lisp::Lisp& reader) void Sector::parse(const lisp::Lisp& sector) { + bool has_background = false; lisp::ListIterator iter(§or); while(iter.next()) { const std::string& token = iter.item(); @@ -202,11 +203,22 @@ Sector::parse(const lisp::Lisp& sector) } else { GameObject* object = parse_object(token, *(iter.lisp())); if(object) { + if(dynamic_cast(object)) { + has_background = true; + } else if(dynamic_cast(object)) { + has_background = true; + } add_object(object); } } } + if(!has_background) { + Gradient* gradient = new Gradient(); + gradient->set_gradient(Color(0.3, 0.4, 0.75), Color(1, 1, 1)); + add_object(gradient); + } + update_game_objects(); if(solid_tilemaps.size() < 1) log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl; -- 2.11.0