Skip to content

Commit

Permalink
Use Torque-native HashMap instead of std::unordered_map which is very…
Browse files Browse the repository at this point in the history
… 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 guiMLTextCtrl stemming from the changes to 128750d.

Closes TorqueGameEngines#42.
  • Loading branch information
elementc committed May 17, 2022
1 parent 2855390 commit ab02cff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions engine/compilers/Make-32bit/Torque2D.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions engine/compilers/Make-64bit/Torque2D.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion engine/source/gui/guiMLTextCtrl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 5 additions & 2 deletions engine/source/gui/guiTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
#endif

#include "graphics/gFont.h"
#include <unordered_map>

#ifndef _HASHTABLE_H
#include "collection/hashTable.h"
#endif

class GBitmap;

Expand Down Expand Up @@ -249,7 +252,7 @@ class GuiControlProfile : public SimObject
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);

Expand Down

0 comments on commit ab02cff

Please sign in to comment.