# HG changeset patch # User jasoka@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1215249261 0 # Node ID 61fdc090b0d41170bbfa72025f751ad16bae579f # Parent 427bb0de3e2913a5147a59e9d4894ca3f61e2022 both techdemo maps are now loaded correctly. Still segfaulting when scripts end diff -r 427bb0de3e29 -r 61fdc090b0d4 clients/rio_de_hola/maps/shrine.xml --- a/clients/rio_de_hola/maps/shrine.xml Fri Jul 04 19:02:53 2008 +0000 +++ b/clients/rio_de_hola/maps/shrine.xml Sat Jul 05 09:14:21 2008 +0000 @@ -57,7 +57,7 @@ - + @@ -5166,7 +5166,7 @@ - + @@ -6102,10 +6102,12 @@ + + - + - + diff -r 427bb0de3e29 -r 61fdc090b0d4 clients/rio_de_hola/settings.py --- a/clients/rio_de_hola/settings.py Fri Jul 04 19:02:53 2008 +0000 +++ b/clients/rio_de_hola/settings.py Sat Jul 05 09:14:21 2008 +0000 @@ -6,7 +6,7 @@ SDLRemoveFakeAlpha = 1 ScreenWidth = 1024 ScreenHeight = 768 -MapFile = 'maps/testmap3.xml' +MapFile = 'maps/shrine.xml' Font = 'fonts/samanata.ttf' FontGlyphs = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"" diff -r 427bb0de3e29 -r 61fdc090b0d4 engine/core/model/structures/layer.cpp --- a/engine/core/model/structures/layer.cpp Fri Jul 04 19:02:53 2008 +0000 +++ b/engine/core/model/structures/layer.cpp Sat Jul 05 09:14:21 2008 +0000 @@ -119,35 +119,39 @@ } void Layer::getMinMaxCoordinates(ModelCoordinate& min, ModelCoordinate& max, const Layer* layer) const { - - if(layer == 0) { + if (!layer) { layer = this; } - min = m_instances.front()->getLocationRef().getLayerCoordinates(layer); - max = min; - - for(std::vector::const_iterator i = m_instances.begin(); - i != m_instances.end(); - ++i) { - - ModelCoordinate coord = (*i)->getLocationRef().getLayerCoordinates(layer); - - if(coord.x < min.x) { - min.x = coord.x; + bool first_found = false; + for (std::vector::const_iterator i = m_instances.begin(); i != m_instances.end(); ++i) { + if (!first_found) { + min = m_instances.front()->getLocationRef().getLayerCoordinates(layer); + max = min; + first_found = true; + } else { + ModelCoordinate coord = (*i)->getLocationRef().getLayerCoordinates(layer); + + if(coord.x < min.x) { + min.x = coord.x; + } + + if(coord.x > max.x) { + max.x = coord.x; + } + + if(coord.y < min.y) { + min.y = coord.y; + } + + if(coord.y > max.y) { + max.y = coord.y; + } } - - if(coord.x > max.x) { - max.x = coord.x; - } - - if(coord.y < min.y) { - min.y = coord.y; - } - - if(coord.y > max.y) { - max.y = coord.y; - } + } + if (!first_found) { + min = ModelCoordinate(); + max = min; } }