Browse Source

Use Torque-native HashMap instead of std::unordered_map which is very sad inside of Torque2D's existing linux platform.

Bump Linux compile to -std=c++14 and optimization level from -O0 to -Og.

Fix a bug in types.gcc.h which uses the wrong capitalization of the LINUX symbol.

Fix a bug in guiMLTextCtrl stemming from the changes to 128750d883ae7c04da0cb6d88da8ebdee082324e.

Closes #42.
Casey Doran 3 years ago
parent
commit
ee345f38a3

+ 2 - 2
engine/compilers/Make-32bit/Torque2D.mk

@@ -65,7 +65,7 @@ SOURCES := $(2D_SOURCES) + \
 LDFLAGS := -g -m32
 LDLIBS := -lstdc++ -lm -ldl -lpthread -lrt -lX11 -lXft -lSDL -lopenal
 
-CFLAGS := -std=gnu++11 -MMD -I. -Wfatal-errors -Wunused -m32 -msse -march=i686 -pipe
+CFLAGS := -std=c++14 -MMD -I. -Wfatal-errors -Wunused -m32 -msse -march=i686 -pipe
 
 CFLAGS += -I/usr/include
 CFLAGS += -I/usr/include/freetype2
@@ -88,7 +88,7 @@ CFLAGS_DEBUG += -DTORQUE_DEBUG
 CFLAGS_DEBUG += -DTORQUE_DEBUG_GUARD
 CFLAGS_DEBUG += -DTORQUE_NET_STATS
 
-CFLAGS += -O0
+CFLAGS += -Og
 
 NASMFLAGS := -f elf -D LINUX
 

+ 2 - 2
engine/compilers/Make-64bit/Torque2D.mk

@@ -63,7 +63,7 @@ SOURCES := $(2D_SOURCES) + \
 LDFLAGS := -g -m64
 LDLIBS := -lstdc++ -lm -ldl -lpthread -lrt -lX11 -lXft -lSDL -lopenal
 
-CFLAGS := -std=gnu++11 -MMD -I. -Wfatal-errors -Wunused -m64 -msse -march=x86-64 -pipe
+CFLAGS := -std=c++14 -MMD -I. -Wfatal-errors -Wunused -m64 -msse -march=x86-64 -pipe
 
 CFLAGS += -I/usr/include
 CFLAGS += -I/usr/include/freetype2
@@ -87,7 +87,7 @@ CFLAGS_DEBUG += -DTORQUE_DEBUG
 CFLAGS_DEBUG += -DTORQUE_DEBUG_GUARD
 CFLAGS_DEBUG += -DTORQUE_NET_STATS
 
-CFLAGS += -O0
+CFLAGS += -Og
 
 NASMFLAGS := -f elf64 -D LINUX
 

+ 1 - 1
engine/source/gui/guiMLTextCtrl.cc

@@ -516,7 +516,7 @@ void GuiMLTextCtrl::getCursorPositionAndColor(Point2I &cursorTop, Point2I &curso
 {
    S32 x = 0;
    S32 y = 0;
-   S32 height = mProfile->mFont->getHeight();
+   S32 height = mProfile->getFont(mFontSizeAdjust)->getHeight();
    color = mProfile->mCursorColor;
    for(Line *walk = mLineList; walk; walk = walk->next)
    {

+ 5 - 2
engine/source/gui/guiTypes.h

@@ -60,7 +60,10 @@
 #endif
 
 #include "graphics/gFont.h"
-#include <unordered_map>
+
+#ifndef _HASHTABLE_H
+#include "collection/hashTable.h"
+#endif
 
 class GBitmap;
 
@@ -249,7 +252,7 @@ public:
    inline StringTableEntry getImageAsset( void ) const { return mImageAssetID; }
 
 private:
-	std::unordered_map<S32, GFont*> mFontMap;
+	HashMap<S32, GFont*> mFontMap;
 	S32 getFontSize(F32 fontAdjust);
 	void addFont(S32 fontSize);
 

+ 1 - 1
engine/source/platform/types.gcc.h

@@ -74,7 +74,7 @@ typedef unsigned long long  U64;
 #  define TORQUE_OS_STRING "Emscripten"
 #  define TORQUE_OS_EMSCRIPTEN
 #  include "platform/types.posix.h"
-#elif defined(linux)
+#elif defined(LINUX)
 #  define TORQUE_OS_STRING "Linux"
 #  define TORQUE_OS_LINUX
 // Don't use assembly when building linux.