From 4e482d925e79ede40563d19cf84b542a1db1f0fa Mon Sep 17 00:00:00 2001 From: "spartanj@gmail.com" Date: Sun, 31 Jul 2011 17:11:32 -0300 Subject: [PATCH] Small fixes. --- src/gaming/clightmanager.cpp | 9 +++++++++ src/gaming/cmap.cpp | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gaming/clightmanager.cpp b/src/gaming/clightmanager.cpp index c7fea211c..c5b5ba708 100644 --- a/src/gaming/clightmanager.cpp +++ b/src/gaming/clightmanager.cpp @@ -229,11 +229,16 @@ cLightManager::LightsList& cLightManager::GetLights() { cLight * cLightManager::GetLightOver( const eeVector2f& OverPos, cLight * LightCurrent ) { cLight * PivotLight = NULL; cLight * LastLight = NULL; + cLight * FirstLight = NULL; for ( LightsList::reverse_iterator it = mLights.rbegin(); it != mLights.rend(); it++ ) { cLight * Light = (*it); if ( Contains( Light->GetAABB(), OverPos ) ) { + if ( NULL == FirstLight ) { + FirstLight = Light; + } + if ( NULL != LightCurrent ) { if ( Light != LightCurrent ) { PivotLight = Light; @@ -250,6 +255,10 @@ cLight * cLightManager::GetLightOver( const eeVector2f& OverPos, cLight * LightC } } + if ( LastLight == LightCurrent && NULL != FirstLight ) { + return FirstLight; + } + if ( NULL == PivotLight && NULL != LightCurrent && Contains( LightCurrent->GetAABB(), OverPos ) ) { return LightCurrent; } diff --git a/src/gaming/cmap.cpp b/src/gaming/cmap.cpp index c8e83cf6f..58cc29e26 100644 --- a/src/gaming/cmap.cpp +++ b/src/gaming/cmap.cpp @@ -1098,11 +1098,13 @@ void cMap::SaveToStream( cIOStream& IOS ) { } void cMap::Save( const std::string& path ) { - cIOStreamFile IOS( path, std::ios::out | std::ios::binary ); + if ( !IsDirectory( path ) ) { + cIOStreamFile IOS( path, std::ios::out | std::ios::binary ); - SaveToStream( IOS ); + SaveToStream( IOS ); - mPath = path; + mPath = path; + } } std::vector cMap::GetShapeGroups() {