From 78517a4397c0903eb0fcfd6cf54b63f70dd9a2e9 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Sat, 3 Oct 2009 10:51:05 +0000 Subject: [PATCH] * fixed previous fix * fixed bug #20 from mantis --- client/CMessage.cpp | 3 ++- client/CSpellWindow.cpp | 23 +++++++++++++++++------ client/VCMI_client.rc | 2 +- client/afxres.h | 23 ----------------------- 4 files changed, 20 insertions(+), 31 deletions(-) delete mode 100644 client/afxres.h diff --git a/client/CMessage.cpp b/client/CMessage.cpp index 8b11cdef3..cc1b56c0a 100644 --- a/client/CMessage.cpp +++ b/client/CMessage.cpp @@ -29,7 +29,8 @@ SDL_Color tytulowy = {229, 215, 123, 0}, tlo = {66, 44, 24, 0}, - zwykly = {255, 255, 255, 0}; + zwykly = {255, 255, 255, 0}, + darkTitle = {215, 175, 78, 0}; extern SDL_Surface * screen; extern TTF_Font * TNRB16, *TNR, *GEOR13; diff --git a/client/CSpellWindow.cpp b/client/CSpellWindow.cpp index 7c39dd785..b97a38964 100644 --- a/client/CSpellWindow.cpp +++ b/client/CSpellWindow.cpp @@ -26,7 +26,7 @@ */ extern SDL_Surface * screen; -extern SDL_Color tytulowy, zwykly ; +extern SDL_Color tytulowy, zwykly, darkTitle; extern TTF_Font *GEOR16; SpellbookInteractiveArea::SpellbookInteractiveArea(const SDL_Rect & myRect, boost::function funcL, const std::string & textR, boost::function funcHon, boost::function funcHoff) @@ -462,15 +462,26 @@ void CSpellWindow::show(SDL_Surface *to) //printing border (indicates level of magic school) blitAt(schoolBorders[bestSchool]->ourImages[bestslvl].bitmap, spellAreas[b]->pos.x, spellAreas[b]->pos.y, to); + SDL_Color firstLineColor, secondLineColor; + if(LOCPLINT->cb->getSpellCost(spell, myHero) > myHero->mana) //hero cannot cast this spell + { + firstLineColor = zwykly; + secondLineColor = darkTitle; + } + else + { + firstLineColor = tytulowy; + secondLineColor = zwykly; + } //printing spell's name - CSDL_Ext::printAtMiddle(spell->name, spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 70, GEORM, tytulowy, to); + CSDL_Ext::printAtMiddle(spell->name, spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 70, FONT_TIMES, firstLineColor, to); //printing lvl - CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[171 + spell->level], spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 82, GEORM, zwykly, to); + CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[171 + spell->level], spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 82, FONT_TIMES, secondLineColor, to); //printing cost std::ostringstream ss; ss<generaltexth->allTexts[387]<<": "<cb->getSpellCost(spell, myHero); - CSDL_Ext::printAtMiddle(ss.str(), spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 94, GEORM, zwykly, to); + CSDL_Ext::printAtMiddle(ss.str(), spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 94, FONT_TIMES, secondLineColor, to); } } @@ -654,11 +665,11 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState) if(!down && mySpell!=-1) { //we will cast a spell - if(LOCPLINT->battleInt) //if battle window is open + if(LOCPLINT->battleInt && LOCPLINT->cb->battleCanCastSpell() && LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero) <= owner->myHero->mana) //if battle window is open { LOCPLINT->battleInt->castThisSpell(mySpell); + owner->fexitb(); } - owner->fexitb(); } } diff --git a/client/VCMI_client.rc b/client/VCMI_client.rc index b1b0fd5bd..209710ee5 100644 --- a/client/VCMI_client.rc +++ b/client/VCMI_client.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "winresrc.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/client/afxres.h b/client/afxres.h deleted file mode 100644 index 91e7f495a..000000000 --- a/client/afxres.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _AFXRES_H -#define _AFXRES_H -#if __GNUC__ >= 3 -#pragma GCC system_header -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _WINDOWS_H -#include -#endif - -/* IDC_STATIC is documented in winuser.h, but not defined. */ -#ifndef IDC_STATIC -#define IDC_STATIC (-1) -#endif - -#ifdef __cplusplus -} -#endif -#endif