|
From: <dv...@us...> - 2008-04-30 02:02:55
|
Revision: 213
http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=213&view=rev
Author: dvalin
Date: 2008-04-29 19:02:51 -0700 (Tue, 29 Apr 2008)
Log Message:
-----------
improve spinlock for getGuiPic & getObjPic
Modified Paths:
--------------
branches/dunks/include/DataCache.h
branches/dunks/src/DataCache.cpp
Modified: branches/dunks/include/DataCache.h
===================================================================
--- branches/dunks/include/DataCache.h 2008-04-30 01:45:01 UTC (rev 212)
+++ branches/dunks/include/DataCache.h 2008-04-30 02:02:51 UTC (rev 213)
@@ -154,6 +154,7 @@
typedef enum {
UI_RadarAnimation,
UI_CursorShape,
+ UI_MouseCursor,
UI_CreditsDigits,
UI_GameBar,
UI_Indicator,
Modified: branches/dunks/src/DataCache.cpp
===================================================================
--- branches/dunks/src/DataCache.cpp 2008-04-30 01:45:01 UTC (rev 212)
+++ branches/dunks/src/DataCache.cpp 2008-04-30 02:02:51 UTC (rev 213)
@@ -208,6 +208,7 @@
// addGuiPic(UI_RadarAnimation, radar->getAnimationAsPictureRow());
addGuiPic(UI_CursorShape, mouse->getPictureArray(7,1,0|TILE_NORMAL,1|TILE_NORMAL,2|TILE_NORMAL,3|TILE_NORMAL,4|TILE_NORMAL,5|TILE_NORMAL,6|TILE_NORMAL));
+ addGuiPic(UI_MouseCursor, mouse->getPicture(0));
// SDL_SetColorKey(addGuiPic(UI_CursorShape][HOUSE_HARKONNEN], SDL_SRCCOLORKEY | SDL_RLEACCEL, 0);
addGuiPic(UI_CreditsDigits, shapes->getPictureArray(10,1,2|TILE_NORMAL,3|TILE_NORMAL,4|TILE_NORMAL,5|TILE_NORMAL,6|TILE_NORMAL,
7|TILE_NORMAL,8|TILE_NORMAL,9|TILE_NORMAL,10|TILE_NORMAL,11|TILE_NORMAL));
@@ -444,11 +445,13 @@
}
else
{
- ImagePtr source = m_objImg[house]->find(ID)->second;
#ifdef THREADS
- if (source == NULL)
+ // If house is harkonnen we know that there shouldn't be any other
+ // to look for and therefore must be that graphic hasn't been loaded yet.
+ if (house == HOUSE_HARKONNEN)
goto spinlock;
#endif
+ ImagePtr source = m_objImg[house]->find(ID)->second;
ImagePtr copy = source->getRecoloredByHouse(house);
m_objImg[house]->insert(std::pair<ObjPic_enum, ImagePtr>(ID, copy));
return copy;
@@ -469,12 +472,11 @@
}
else
{
-
- ImagePtr source = m_guiImg[house]->find(ID)->second;
#ifdef THREADS
- if (source == NULL)
+ if (house == HOUSE_HARKONNEN)
goto spinlock;
#endif
+ ImagePtr source = m_guiImg[house]->find(ID)->second;
ImagePtr copy = source->getRecoloredByHouse(house);
m_guiImg[house]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, copy));
return copy;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|