1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Removed using namespace SDL_Ext

This commit is contained in:
Ivan Savenko 2023-02-02 21:41:39 +02:00
parent d87fb43dcd
commit 9833edcf73
4 changed files with 24 additions and 32 deletions

View File

@ -23,6 +23,7 @@
#include "gui/CursorHandler.h" #include "gui/CursorHandler.h"
#include "windows/CKingdomInterface.h" #include "windows/CKingdomInterface.h"
#include "CGameInfo.h" #include "CGameInfo.h"
#include "CMT.h"
#include "windows/CHeroWindow.h" #include "windows/CHeroWindow.h"
#include "windows/CCreatureWindow.h" #include "windows/CCreatureWindow.h"
#include "windows/CQuestLog.h" #include "windows/CQuestLog.h"
@ -67,7 +68,6 @@
#include "../lib/CGameState.h" #include "../lib/CGameState.h"
#include "gui/NotificationHandler.h" #include "gui/NotificationHandler.h"
#include "adventureMap/CInGameConsole.h" #include "adventureMap/CInGameConsole.h"
#include "renderSDL/SDL_Extensions.h"
#include <SDL_events.h> #include <SDL_events.h>
@ -88,8 +88,6 @@
return; \ return; \
RETURN_IF_QUICK_COMBAT RETURN_IF_QUICK_COMBAT
using namespace CSDL_Ext;
extern std::queue<SDL_Event> SDLEventsQueue; extern std::queue<SDL_Event> SDLEventsQueue;
extern boost::mutex eventsM; extern boost::mutex eventsM;
boost::recursive_mutex * CPlayerInterface::pim = new boost::recursive_mutex; boost::recursive_mutex * CPlayerInterface::pim = new boost::recursive_mutex;

View File

@ -42,8 +42,6 @@
#include <SDL_surface.h> #include <SDL_surface.h>
using namespace CSDL_Ext;
Graphics * graphics = nullptr; Graphics * graphics = nullptr;
void Graphics::loadPaletteAndColors() void Graphics::loadPaletteAndColors()

View File

@ -32,8 +32,6 @@
#include "../../lib/CHeroHandler.h" #include "../../lib/CHeroHandler.h"
#include "../../lib/CGameState.h" #include "../../lib/CGameState.h"
using namespace CSDL_Ext;
class CCreatureArtifactInstance; class CCreatureArtifactInstance;
class CSelectableSkill; class CSelectableSkill;
@ -519,8 +517,8 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
const CStack * battleStack = parent->info->stack; const CStack * battleStack = parent->info->stack;
morale = std::make_shared<MoraleLuckBox>(true, genRect(42, 42, 321, 110)); morale = std::make_shared<MoraleLuckBox>(true, CSDL_Ext::genRect(42, 42, 321, 110));
luck = std::make_shared<MoraleLuckBox>(false, genRect(42, 42, 375, 110)); luck = std::make_shared<MoraleLuckBox>(false, CSDL_Ext::genRect(42, 42, 375, 110));
if(battleStack != nullptr) // in battle if(battleStack != nullptr) // in battle
{ {
@ -584,7 +582,7 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
} }
expLabel = std::make_shared<CLabel>( expLabel = std::make_shared<CLabel>(
pos.x + 21, pos.y + 52, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, pos.x + 21, pos.y + 52, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE,
makeNumberShort<TExpType>(stack->experience, 6)); CSDL_Ext::makeNumberShort<TExpType>(stack->experience, 6));
} }
if(showArt) if(showArt)

View File

@ -63,8 +63,6 @@
#include "../lib/NetPacksBase.h" #include "../lib/NetPacksBase.h"
#include "../lib/StartInfo.h" #include "../lib/StartInfo.h"
using namespace CSDL_Ext;
CRecruitmentWindow::CCreatureCard::CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount) CRecruitmentWindow::CCreatureCard::CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount)
: CIntObject(LCLICK | RCLICK), : CIntObject(LCLICK | RCLICK),
parent(window), parent(window),
@ -101,9 +99,9 @@ void CRecruitmentWindow::CCreatureCard::showAll(SDL_Surface * to)
{ {
CIntObject::showAll(to); CIntObject::showAll(to);
if(selected) if(selected)
drawBorder(to, pos, Colors::RED); CSDL_Ext::drawBorder(to, pos, Colors::RED);
else else
drawBorder(to, pos, Colors::YELLOW); CSDL_Ext::drawBorder(to, pos, Colors::YELLOW);
} }
void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card) void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card)
@ -178,17 +176,17 @@ void CRecruitmentWindow::showAll(SDL_Surface * to)
CWindowObject::showAll(to); CWindowObject::showAll(to);
// recruit\total values // recruit\total values
drawBorder(to, pos.x + 172, pos.y + 222, 67, 42, Colors::YELLOW); CSDL_Ext::drawBorder(to, pos.x + 172, pos.y + 222, 67, 42, Colors::YELLOW);
drawBorder(to, pos.x + 246, pos.y + 222, 67, 42, Colors::YELLOW); CSDL_Ext::drawBorder(to, pos.x + 246, pos.y + 222, 67, 42, Colors::YELLOW);
//cost boxes //cost boxes
drawBorder(to, pos.x + 64, pos.y + 222, 99, 76, Colors::YELLOW); CSDL_Ext::drawBorder(to, pos.x + 64, pos.y + 222, 99, 76, Colors::YELLOW);
drawBorder(to, pos.x + 322, pos.y + 222, 99, 76, Colors::YELLOW); CSDL_Ext::drawBorder(to, pos.x + 322, pos.y + 222, 99, 76, Colors::YELLOW);
//buttons borders //buttons borders
drawBorder(to, pos.x + 133, pos.y + 312, 66, 34, Colors::METALLIC_GOLD); CSDL_Ext::drawBorder(to, pos.x + 133, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
drawBorder(to, pos.x + 211, pos.y + 312, 66, 34, Colors::METALLIC_GOLD); CSDL_Ext::drawBorder(to, pos.x + 211, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
drawBorder(to, pos.x + 289, pos.y + 312, 66, 34, Colors::METALLIC_GOLD); CSDL_Ext::drawBorder(to, pos.x + 289, pos.y + 312, 66, 34, Colors::METALLIC_GOLD);
} }
CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset): CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset):
@ -1137,9 +1135,9 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
{ {
primSkillAreas.push_back(std::make_shared<LRClickableAreaWTextComp>()); primSkillAreas.push_back(std::make_shared<LRClickableAreaWTextComp>());
if (qeLayout) if (qeLayout)
primSkillAreas[g]->pos = genRect(22, 152, pos.x + 324, pos.y + 12 + 26 * g); primSkillAreas[g]->pos = CSDL_Ext::genRect(22, 152, pos.x + 324, pos.y + 12 + 26 * g);
else else
primSkillAreas[g]->pos = genRect(32, 140, pos.x + 329, pos.y + 19 + 36 * g); primSkillAreas[g]->pos = CSDL_Ext::genRect(32, 140, pos.x + 329, pos.y + 19 + 36 * g);
primSkillAreas[g]->text = CGI->generaltexth->arraytxt[2+g]; primSkillAreas[g]->text = CGI->generaltexth->arraytxt[2+g];
primSkillAreas[g]->type = g; primSkillAreas[g]->type = g;
primSkillAreas[g]->bonusValue = -1; primSkillAreas[g]->bonusValue = -1;
@ -1159,7 +1157,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
int skill = hero->secSkills[g].first, int skill = hero->secSkills[g].first,
level = hero->secSkills[g].second; // <1, 3> level = hero->secSkills[g].second; // <1, 3>
secSkillAreas[b].push_back(std::make_shared<LRClickableAreaWTextComp>()); secSkillAreas[b].push_back(std::make_shared<LRClickableAreaWTextComp>());
secSkillAreas[b][g]->pos = genRect(32, 32, pos.x + 32 + g*36 + b*454 , pos.y + (qeLayout ? 83 : 88)); secSkillAreas[b][g]->pos = CSDL_Ext::genRect(32, 32, pos.x + 32 + g*36 + b*454 , pos.y + (qeLayout ? 83 : 88));
secSkillAreas[b][g]->baseType = 1; secSkillAreas[b][g]->baseType = 1;
secSkillAreas[b][g]->type = skill; secSkillAreas[b][g]->type = skill;
@ -1174,12 +1172,12 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
heroAreas[b] = std::make_shared<CHeroArea>(257 + 228*b, 13, hero); heroAreas[b] = std::make_shared<CHeroArea>(257 + 228*b, 13, hero);
specialtyAreas[b] = std::make_shared<LRClickableAreaWText>(); specialtyAreas[b] = std::make_shared<LRClickableAreaWText>();
specialtyAreas[b]->pos = genRect(32, 32, pos.x + 69 + 490*b, pos.y + (qeLayout ? 41 : 45)); specialtyAreas[b]->pos = CSDL_Ext::genRect(32, 32, pos.x + 69 + 490*b, pos.y + (qeLayout ? 41 : 45));
specialtyAreas[b]->hoverText = CGI->generaltexth->heroscrn[27]; specialtyAreas[b]->hoverText = CGI->generaltexth->heroscrn[27];
specialtyAreas[b]->text = hero->type->getSpecialtyDescriptionTranslated(); specialtyAreas[b]->text = hero->type->getSpecialtyDescriptionTranslated();
experienceAreas[b] = std::make_shared<LRClickableAreaWText>(); experienceAreas[b] = std::make_shared<LRClickableAreaWText>();
experienceAreas[b]->pos = genRect(32, 32, pos.x + 105 + 490*b, pos.y + (qeLayout ? 41 : 45)); experienceAreas[b]->pos = CSDL_Ext::genRect(32, 32, pos.x + 105 + 490*b, pos.y + (qeLayout ? 41 : 45));
experienceAreas[b]->hoverText = CGI->generaltexth->heroscrn[9]; experienceAreas[b]->hoverText = CGI->generaltexth->heroscrn[9];
experienceAreas[b]->text = CGI->generaltexth->allTexts[2]; experienceAreas[b]->text = CGI->generaltexth->allTexts[2];
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->level)); boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->level));
@ -1187,15 +1185,15 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->exp)); boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->exp));
spellPointsAreas[b] = std::make_shared<LRClickableAreaWText>(); spellPointsAreas[b] = std::make_shared<LRClickableAreaWText>();
spellPointsAreas[b]->pos = genRect(32, 32, pos.x + 141 + 490*b, pos.y + (qeLayout ? 41 : 45)); spellPointsAreas[b]->pos = CSDL_Ext::genRect(32, 32, pos.x + 141 + 490*b, pos.y + (qeLayout ? 41 : 45));
spellPointsAreas[b]->hoverText = CGI->generaltexth->heroscrn[22]; spellPointsAreas[b]->hoverText = CGI->generaltexth->heroscrn[22];
spellPointsAreas[b]->text = CGI->generaltexth->allTexts[205]; spellPointsAreas[b]->text = CGI->generaltexth->allTexts[205];
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%s", hero->getNameTranslated()); boost::algorithm::replace_first(spellPointsAreas[b]->text, "%s", hero->getNameTranslated());
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->mana)); boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->mana));
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->manaLimit())); boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->manaLimit()));
morale[b] = std::make_shared<MoraleLuckBox>(true, genRect(32, 32, 176 + 490 * b, 39), true); morale[b] = std::make_shared<MoraleLuckBox>(true, CSDL_Ext::genRect(32, 32, 176 + 490 * b, 39), true);
luck[b] = std::make_shared<MoraleLuckBox>(false, genRect(32, 32, 212 + 490 * b, 39), true); luck[b] = std::make_shared<MoraleLuckBox>(false, CSDL_Ext::genRect(32, 32, 212 + 490 * b, 39), true);
} }
quit = std::make_shared<CButton>(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), SDLK_RETURN); quit = std::make_shared<CButton>(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), SDLK_RETURN);
@ -1283,8 +1281,8 @@ void CExchangeWindow::updateWidgets()
secSkillIcons[leftRight][m]->setFrame(2 + id * 3 + level); secSkillIcons[leftRight][m]->setFrame(2 + id * 3 + level);
} }
expValues[leftRight]->setText(makeNumberShort(hero->exp)); expValues[leftRight]->setText(CSDL_Ext::makeNumberShort(hero->exp));
manaValues[leftRight]->setText(makeNumberShort(hero->mana)); manaValues[leftRight]->setText(CSDL_Ext::makeNumberShort(hero->mana));
morale[leftRight]->set(hero); morale[leftRight]->set(hero);
luck[leftRight]->set(hero); luck[leftRight]->set(hero);
@ -1377,7 +1375,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 & GrailPos, double discoveredRatio)
void CPuzzleWindow::showAll(SDL_Surface * to) void CPuzzleWindow::showAll(SDL_Surface * to)
{ {
int3 moveInt = int3(8, 9, 0); int3 moveInt = int3(8, 9, 0);
Rect mapRect = genRect(544, 591, pos.x + 8, pos.y + 7); Rect mapRect = CSDL_Ext::genRect(544, 591, pos.x + 8, pos.y + 7);
int3 topTile = grailPos - moveInt; int3 topTile = grailPos - moveInt;
MapDrawingInfo info(topTile, LOCPLINT->cb->getVisibilityMap(), mapRect); MapDrawingInfo info(topTile, LOCPLINT->cb->getVisibilityMap(), mapRect);