- Removed dependencies on Boost/string in mtg sources
- Removes dependencies on Boost/shared_ptr in mtg sources only for WP8 for the moment - Various compilation fixes on WP8
This commit is contained in:
@@ -21,9 +21,11 @@
|
||||
|
||||
#include "GameOptions.h"
|
||||
|
||||
#ifndef WP8
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#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
|
||||
|
||||
|
||||
@@ -173,8 +173,7 @@ protected:
|
||||
int *mGBCode;
|
||||
int mCurr;
|
||||
|
||||
u32 * mCharBuffer;
|
||||
|
||||
PIXEL_TYPE* mCharBuffer;
|
||||
virtual int PreCacheChar(const u8 *ch);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#ifndef WRESOURCE_FWD_H
|
||||
#define WRESOURCE_FWD_H
|
||||
|
||||
#ifndef WP8
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
typedef boost::shared_ptr<JQuad> JQuadPtr;
|
||||
#else
|
||||
#include <memory>
|
||||
typedef std::shared_ptr<JQuad> JQuadPtr;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -136,4 +136,8 @@ template <class T> 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
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "AbilityParser.h"
|
||||
#include "utils.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "AllAbilities.h"
|
||||
#include "Translate.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
|
||||
//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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef _CLOSEST_H_
|
||||
#define _CLOSEST_H_
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "CardSelector.h"
|
||||
|
||||
template<typename T, typename Target>
|
||||
static inline Target* closest(vector<Target*>& cards, Limitor* limitor, Target* ref)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#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':
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user