2
0
Эх сурвалжийг харах

replaced extern SDL_Surface* X; all over the code with single header

stopiccot 12 жил өмнө
parent
commit
f2309d70dd

+ 1 - 2
client/BattleInterface/CBattleInterface.cpp

@@ -31,6 +31,7 @@
 
 #include "../UIFramework/CCursorHandler.h"
 #include "../UIFramework/CGuiHandler.h"
+#include "../CMT.h"
 
 #ifndef __GNUC__
 const double M_PI = 3.14159265358979323846;
@@ -54,8 +55,6 @@ const time_t CBattleInterface::HOVER_ANIM_DELTA = 1;
  *
  */
 
-extern SDL_Surface * screen;
-
 CondSh<bool> CBattleInterface::animsAreDisplayed;
 
 struct CMP_stack2

+ 1 - 1
client/CHeroWindow.cpp

@@ -25,6 +25,7 @@
 
 #include "UIFramework/CGuiHandler.h"
 #include "UIFramework/CIntObjectClasses.h"
+#include "CMT.h"
 
 #undef min
 
@@ -38,7 +39,6 @@
  *
  */
 
-extern SDL_Surface * screen;
 using namespace boost::assign;
 
 const TBonusListPtr CHeroWithMaybePickedArtifact::getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root /*= NULL*/, const std::string &cachingStr /*= ""*/) const

+ 1 - 2
client/CKingdomInterface.cpp

@@ -16,6 +16,7 @@
 #include "CPlayerInterface.h" //LOCPLINT
 #include "UIFramework/CGuiHandler.h"
 #include "UIFramework/CIntObjectClasses.h"
+#include "CMT.h"
 
 /*
  * CKingdomInterface.cpp, part of VCMI engine
@@ -27,8 +28,6 @@
  *
  */
 
-extern SDL_Surface *screenBuf;
-
 InfoBox::InfoBox(Point position, InfoPos Pos, InfoSize Size, IInfoBoxData *Data):
 	size(Size),
 	infoPos(Pos),

+ 5 - 0
client/CMT.h

@@ -0,0 +1,5 @@
+#pragma once
+
+extern SDL_Surface *screen;      // main screen surface
+extern SDL_Surface *screen2;     // and hlp surface (used to store not-active interfaces layer)
+extern SDL_Surface *screenBuf; // points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed

+ 0 - 2
client/CMessage.cpp

@@ -23,8 +23,6 @@
  *
  */
 
-//extern SDL_Surface * screen;
-
 const int COMPONENT_TO_SUBTITLE = 17;
 const int BETWEEN_COMPS_ROWS = 10;
 const int BEFORE_COMPONENTS = 30;

+ 1 - 2
client/CSpellWindow.cpp

@@ -19,6 +19,7 @@
 #include "../lib/BattleState.h"
 #include "../lib/GameConstants.h"
 #include "UIFramework/CGuiHandler.h"
+#include "CMT.h"
 
 /*
  * CSpellWindow.cpp, part of VCMI engine
@@ -30,8 +31,6 @@
  *
  */
 
-extern SDL_Surface * screen;
-
 SpellbookInteractiveArea::SpellbookInteractiveArea(const SDL_Rect & myRect, boost::function<void()> funcL,
 	const std::string & textR, boost::function<void()> funcHon, boost::function<void()> funcHoff, CPlayerInterface * _myInt)
 {

+ 1 - 2
client/UIFramework/CCursorHandler.cpp

@@ -5,6 +5,7 @@
 #include "SDL_Extensions.h"
 #include "../CAnimation.h"
 #include "CGuiHandler.h"
+#include "../CMT.h"
 
 /*
  * CCursorHandler.cpp, part of VCMI engine
@@ -16,8 +17,6 @@
  *
  */
 
-extern SDL_Surface * screen;
-
 void CCursorHandler::initCursor()
 {
 	xpos = ypos = 0;

+ 1 - 1
client/UIFramework/CGuiHandler.cpp

@@ -7,8 +7,8 @@
 #include "CCursorHandler.h"
 #include "../../lib/CThreadHelper.h"
 #include "../../lib/CConfigHandler.h"
+#include "../CMT.h"
 
-extern SDL_Surface * screenBuf, * screen2, * screen;
 extern std::queue<SDL_Event> events;
 extern boost::mutex eventsM;
 

+ 1 - 2
client/UIFramework/Geometries.cpp

@@ -1,7 +1,6 @@
 #include "StdInc.h"
 #include "Geometries.h"
-
-extern SDL_Surface * screen;
+#include "../CMT.h"
 
 Rect Rect::createCentered( int w, int h )
 {

+ 1 - 1
client/mapHandler.cpp

@@ -15,6 +15,7 @@
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/GameConstants.h"
 #include "../lib/CStopWatch.h"
+#include "CMT.h"
 
 /*
  * mapHandler.cpp, part of VCMI engine
@@ -29,7 +30,6 @@
 const bool MARK_BLOCKED_POSITIONS = false;
 const bool MARK_VISITABLE_POSITIONS = false;
 
-extern SDL_Surface * screen;
 #define ADVOPT (conf.go()->ac)
 
 std::string nameFromType (int typ)