diff --git a/projects/mtg/include/PrecompiledHeader.h b/projects/mtg/include/PrecompiledHeader.h index dfae3dc8a..3b7cc0ffa 100644 --- a/projects/mtg/include/PrecompiledHeader.h +++ b/projects/mtg/include/PrecompiledHeader.h @@ -21,9 +21,11 @@ #include "GameOptions.h" +#ifndef WP8 #include +#endif -#if defined (IOS) || defined (ANDROID) || defined (QT_CONFIG) || defined (SDL_CONFIG) +#if defined (WP8) || defined (IOS) || defined (ANDROID) || defined (QT_CONFIG) || defined (SDL_CONFIG) #define TOUCH_ENABLED #endif diff --git a/projects/mtg/include/WFont.h b/projects/mtg/include/WFont.h index ee7d9d680..84485b1ea 100644 --- a/projects/mtg/include/WFont.h +++ b/projects/mtg/include/WFont.h @@ -173,8 +173,7 @@ protected: int *mGBCode; int mCurr; - u32 * mCharBuffer; - + PIXEL_TYPE* mCharBuffer; virtual int PreCacheChar(const u8 *ch); }; diff --git a/projects/mtg/include/WResource_Fwd.h b/projects/mtg/include/WResource_Fwd.h index 86e00237b..139c08e01 100644 --- a/projects/mtg/include/WResource_Fwd.h +++ b/projects/mtg/include/WResource_Fwd.h @@ -1,8 +1,12 @@ #ifndef WRESOURCE_FWD_H #define WRESOURCE_FWD_H +#ifndef WP8 #include - typedef boost::shared_ptr JQuadPtr; +#else +#include +typedef std::shared_ptr JQuadPtr; +#endif #endif diff --git a/projects/mtg/include/config.h b/projects/mtg/include/config.h index fe33e92ca..e25b8e557 100644 --- a/projects/mtg/include/config.h +++ b/projects/mtg/include/config.h @@ -1,7 +1,7 @@ #ifndef _DEBUG_H_ #define _DEBUG_H_ -#if (defined WIN32) && (!defined QT_CONFIG) +#if ((defined WIN32) || (defined WP8)) && (!defined QT_CONFIG) #define snprintf sprintf_s #endif diff --git a/projects/mtg/include/utils.h b/projects/mtg/include/utils.h index 3bf94dc77..2029f3219 100644 --- a/projects/mtg/include/utils.h +++ b/projects/mtg/include/utils.h @@ -136,4 +136,8 @@ template istream& operator>>(istream& in, T& p) return in; } */ + +/* replace_all ... replacement to avoid depending on boost for that */ +void ReplaceString(std::string& subject, const std::string& search, const std::string& replace); + #endif diff --git a/projects/mtg/src/AbilityParser.cpp b/projects/mtg/src/AbilityParser.cpp index 057b1fa4d..cc245d639 100644 --- a/projects/mtg/src/AbilityParser.cpp +++ b/projects/mtg/src/AbilityParser.cpp @@ -2,7 +2,6 @@ #include "AbilityParser.h" #include "utils.h" -#include using std::string; using std::vector; @@ -46,7 +45,7 @@ void AutoLineMacro::parse(const string& stringMacro) mResult = s.substr(firstSpace + 1); } - boost::replace_all(mResult, "\\n", "\n"); + ReplaceString(mResult, "\\n", "\n"); } string AutoLineMacro::process(const string& s) @@ -55,7 +54,7 @@ string AutoLineMacro::process(const string& s) if (!mParams.size()) { //no params, simple macro - boost::replace_all(temp, mName, mResult); + ReplaceString(temp, mName, mResult); return temp; } @@ -81,7 +80,7 @@ string AutoLineMacro::process(const string& s) string tempResult = mResult; for (size_t i = 0; i < vParams.size(); ++i) { - boost::replace_all(tempResult, mParams[i], vParams[i]); + ReplaceString(tempResult, mParams[i], vParams[i]); } result.append(tempResult); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 937fc3233..e146f3c8c 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1,7 +1,6 @@ #include "PrecompiledHeader.h" #include "AllAbilities.h" #include "Translate.h" -#include //display a text animation, this is not a real ability. @@ -5501,7 +5500,7 @@ ATutorialMessage::ATutorialMessage(GameObserver* observer, MTGCardInstance * sou else { mMessage = _(message); //translate directly here, remove this and translate at rendering time if it bites us - boost::replace_all(mMessage, "\\n", "\n"); + ReplaceString(mMessage, "\\n", "\n"); } } diff --git a/projects/mtg/src/Closest.cpp b/projects/mtg/src/Closest.cpp index 22f1e34e1..3081e18eb 100644 --- a/projects/mtg/src/Closest.cpp +++ b/projects/mtg/src/Closest.cpp @@ -1,5 +1,7 @@ #ifndef _CLOSEST_H_ #define _CLOSEST_H_ +#include "PrecompiledHeader.h" +#include "CardSelector.h" template static inline Target* closest(vector& cards, Limitor* limitor, Target* ref) diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index 40919b4b3..f88bdc363 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -1,5 +1,4 @@ #include "PrecompiledHeader.h" -#include #include "ManaCost.h" #include "ManaCostHybrid.h" #include "ExtraCost.h" @@ -8,7 +7,6 @@ #include "Player.h" #include "WEvent.h" #include "MTGAbility.h" - #include "iterator" SUPPORT_OBJECT_ANALYTICS(ManaCost) @@ -95,7 +93,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan } //switch on the first letter. If two costs share their first letter, add an "if" within the switch - boost::algorithm::to_lower(value); + std::transform(value.begin(), value.end(), value.begin(), ::tolower); switch (value[0]) { case 'x': diff --git a/projects/mtg/src/WFont.cpp b/projects/mtg/src/WFont.cpp index fc8ccd414..aaf83c118 100644 --- a/projects/mtg/src/WFont.cpp +++ b/projects/mtg/src/WFont.cpp @@ -205,7 +205,7 @@ WFBFont::WFBFont(int inFontID, const char *fontname, int lineheight, bool) : mGBCode = NEW int[mCacheSize]; #if !defined (PSP) - mCharBuffer = NEW u32[mFontSize*mFontSize]; + mCharBuffer = NEW PIXEL_TYPE[mFontSize*mFontSize]; #endif mTexture = mRenderer->CreateTexture(mCacheImageWidth, mCacheImageHeight, true); @@ -359,7 +359,7 @@ int WFBFont::PreCacheChar(const u8 *ch) #else x = (int)mSprites[index]->mX; y = (int)mSprites[index]->mY; - glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer); + mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer); #endif return index; } @@ -645,7 +645,7 @@ WGBKFont::WGBKFont(int inFontID, const char *fontname, int lineheight, bool) : mGBCode = NEW int[mCacheSize]; #if !defined (PSP) - mCharBuffer = NEW u32[mFontSize*mFontSize]; + mCharBuffer = NEW PIXEL_TYPE[mFontSize*mFontSize]; #endif mTexture = mRenderer->CreateTexture(mCacheImageWidth, mCacheImageHeight, true); @@ -758,7 +758,7 @@ int WGBKFont::PreCacheChar(const u8 *ch) #else x = (int)mSprites[index]->mX; y = (int)mSprites[index]->mY; - glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer); + mTexture->UpdateBits(x, y, mFontSize, mFontSize, mCharBuffer); #endif return index; } diff --git a/projects/mtg/src/utils.cpp b/projects/mtg/src/utils.cpp index e690412a7..7a31822bd 100644 --- a/projects/mtg/src/utils.cpp +++ b/projects/mtg/src/utils.cpp @@ -390,3 +390,12 @@ std::string ensureFolder(const std::string & folderName) } return result; } + +void ReplaceString(std::string& subject, const std::string& search, const std::string& replace) { + size_t pos = 0; + while ((pos = subject.find(search, pos)) != std::string::npos) { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } +} +