Permalink
Browse files

Merge pull request #281 from JonnyH/WIP/string-insert-remove-fix

UString insert()/remove() fix
  • Loading branch information...
JonnyH committed Dec 1, 2017
2 parents d044f22 + 1481a87 commit 2395be282b69e4423dcd8d94a31d5b14ebb4555f
@@ -152,6 +152,7 @@
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -143,6 +143,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -20,9 +20,9 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="miniz\miniz.c" />
<ClCompile Include="miniz\miniz_zip.c" />
<ClCompile Include="miniz\miniz_tinfl.c" />
<ClCompile Include="miniz\miniz_tdef.c" />
<ClCompile Include="miniz\miniz_zip.c" />
<ClCompile Include="miniz\miniz_tinfl.c" />
<ClCompile Include="miniz\miniz_tdef.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{44A12AC1-7E09-4AF7-BAC4-A264C2F814A7}</ProjectGuid>
@@ -145,6 +145,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -158,4 +159,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
@@ -18,5 +18,14 @@
<ClCompile Include="miniz\miniz.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="miniz\miniz_zip.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="miniz\miniz_tinfl.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="miniz\miniz_tdef.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -138,6 +138,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PHYSFS_SUPPORTS_ISO9660;PHYSFS_ISO9660_LOWERCASE=1;PHYSFS_ISO9660_OPENAPOC_WORKAROUND=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -183,4 +184,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
View
@@ -189,6 +189,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
View
@@ -4,11 +4,6 @@
#include "framework/image.h"
#include "library/sp.h"
// Disable automatic #pragma linking for boost - only enabled in msvc and that should provide boost
// symbols as part of the module that uses it
#define BOOST_ALL_NO_LIB
#include <boost/locale.hpp>
namespace OpenApoc
{
@@ -26,12 +21,8 @@ sp<PaletteImage> BitmapFont::getString(const UString &Text)
img = mksp<PaletteImage>(Vec2<int>{width, height});
auto u8Str = Text.str();
auto pointString = boost::locale::conv::utf_to_utf<UniChar>(u8Str);
for (size_t i = 0; i < pointString.length(); i++)
for (const auto &c : Text)
{
UniChar c = pointString[i];
auto glyph = this->getGlyph(c);
PaletteImage::blit(glyph, img, {0, 0}, {pos, 0});
pos += glyph->size.x;
@@ -45,12 +36,10 @@ sp<PaletteImage> BitmapFont::getString(const UString &Text)
int BitmapFont::getFontWidth(const UString &Text)
{
int textlen = 0;
auto u8Str = Text.str();
auto pointString = boost::locale::conv::utf_to_utf<UniChar>(u8Str);
for (size_t i = 0; i < Text.length(); i++)
for (const auto &c : Text)
{
auto glyph = this->getGlyph(pointString[i]);
auto glyph = this->getGlyph(c);
textlen += glyph->size.x;
}
return textlen;
@@ -252,6 +252,7 @@
<PreprocessorDefinitions>WIN32;GLESWRAP_PLATFORM_WGL;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
View
@@ -169,6 +169,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -191,4 +192,4 @@
<Error Condition="!Exists('..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets'))" />
<Error Condition="!Exists('..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets'))" />
</Target>
</Project>
</Project>
@@ -765,7 +765,7 @@ class BattleUnit : public StateObject, public std::enable_shared_from_this<Battl
// Updates unit's movement
// Return true if retreated or destroyed and we must halt immediately
void updateMovement(GameState &state, unsigned int &moveTicksRemaining, bool &wasUsingLift);
// Updates unit's àôñøòï trainsition and acquires new target àôñøòï
// Updates unit's trainsition and acquires new target
void updateTurning(GameState &state, unsigned int &turnTicksRemaining,
unsigned int const handsTicksRemaining);
// Updates unit's displayed item (which one will draw in unit's hands on screen)
@@ -795,7 +795,7 @@ class BattleUnit : public StateObject, public std::enable_shared_from_this<Battl
sp<TileObjectShadow> shadowObject;
/*
- curr. mind state (controlled/berserk/…)
- curr. mind state (controlled/berserk/)
- ref. to psi attacker (who is controlling it/...)
*/
private:
@@ -355,7 +355,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
View
@@ -289,6 +289,7 @@ gen_version_win.bat</Command>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -321,4 +322,4 @@ gen_version_win.bat</Command>
<Error Condition="!Exists('..\..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets'))" />
<Error Condition="!Exists('..\..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets'))" />
</Target>
</Project>
</Project>
@@ -172,6 +172,10 @@
<ClCompile Include="base\recruitscreen.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="general\aequipmentsheet.cpp" />
<ClCompile Include="general\agentsheet.cpp" />
<ClCompile Include="general\loadingscreen.cpp" />
<ClCompile Include="general\vehiclesheet.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="base\basescreen.h">
@@ -316,5 +320,8 @@
<ClInclude Include="base\recruitscreen.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="general\aequipmentsheet.h" />
<ClInclude Include="general\agentsheet.h" />
<ClInclude Include="general\vehiclesheet.h" />
</ItemGroup>
</Project>
</Project>
View
@@ -162,6 +162,7 @@
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -197,4 +198,4 @@
<Error Condition="!Exists('..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.v140.redist.2.0.4\build\native\sdl2.v140.redist.targets'))" />
<Error Condition="!Exists('..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.v140.2.0.4\build\native\sdl2.v140.targets'))" />
</Target>
</Project>
</Project>
View
@@ -2,8 +2,6 @@
#include "dependencies/tinyformat/tinyformat.h"
#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/locale.hpp>
#include <cstdint>
#include <fstream>
#include <glm/glm.hpp>
Oops, something went wrong.

0 comments on commit 2395be2

Please sign in to comment.