diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 900a2db05..eccb14d8c 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -443,7 +443,7 @@ bool afxMagicMissileData::onAdd() { // Tokenize input string and convert to Point3F array // - Vector dataBlocks(__FILE__, __LINE__); + Vector dataBlocks(__FILE__, __LINE__); // make a copy of points_string dsize_t tokCopyLen = dStrlen(wiggle_axis_string) + 1; diff --git a/Engine/source/afx/afxSpellBook.cpp b/Engine/source/afx/afxSpellBook.cpp index 15581ab32..190c01fea 100644 --- a/Engine/source/afx/afxSpellBook.cpp +++ b/Engine/source/afx/afxSpellBook.cpp @@ -258,9 +258,9 @@ void afxSpellBook::unpackUpdate(NetConnection * con, BitStream * stream) } } -#define SPELL_DATA_NOT_FOUND "\n** Spell data not found **\n\n\n\n" +#define SPELL_DATA_NOT_FOUND "\n** Spell data not found **\n\n\n\n"; -char* afxSpellBook::formatDesc(char* buffer, int len, S32 page, S32 slot) const +const char* afxSpellBook::formatDesc(char* buffer, int len, S32 page, S32 slot) const { S32 idx = mDataBlock->getPageSlotIndex(page, slot); if (idx < 0 || !mDataBlock->rpg_spells[idx]) diff --git a/Engine/source/afx/afxSpellBook.h b/Engine/source/afx/afxSpellBook.h index d802c37ce..37a564104 100644 --- a/Engine/source/afx/afxSpellBook.h +++ b/Engine/source/afx/afxSpellBook.h @@ -118,7 +118,7 @@ public: static void initPersistFields(); S32 getPageSlotIndex(S32 page, S32 slot); - char* formatDesc(char* buffer, int len, S32 page, S32 slot) const; + const char* formatDesc(char* buffer, int len, S32 page, S32 slot) const; const char* getSpellIcon(S32 page, S32 slot) const; bool isPlaceholder(S32 page, S32 slot) const; afxMagicSpellData* getSpellData(S32 page, S32 slot); diff --git a/Engine/source/afx/ui/afxSpellButton.cpp b/Engine/source/afx/ui/afxSpellButton.cpp index 76888a73a..43f054769 100644 --- a/Engine/source/afx/ui/afxSpellButton.cpp +++ b/Engine/source/afx/ui/afxSpellButton.cpp @@ -328,9 +328,9 @@ void afxSpellButton::setPage(U8 page) update_bitmap(); } -char* afxSpellButton::formatDesc(char* buffer, int len) const +const char* afxSpellButton::formatDesc(char* buffer, int len) const { - return (spellbook) ? spellbook->formatDesc(buffer, len, book_slot.x, book_slot.y) : (char*)""; + return (spellbook) ? spellbook->formatDesc(buffer, len, book_slot.x, book_slot.y) : ""; } afxMagicSpellData* afxSpellButton::getSpellDataBlock() const diff --git a/Engine/source/afx/ui/afxSpellButton.h b/Engine/source/afx/ui/afxSpellButton.h index 02db1e3cc..d261b461f 100644 --- a/Engine/source/afx/ui/afxSpellButton.h +++ b/Engine/source/afx/ui/afxSpellButton.h @@ -77,7 +77,7 @@ public: void setBitmap(const char *name, bool placholder=false); void setSpellBook(afxSpellBook*, U8 page); void setPage(U8 page); - char* formatDesc(char* buffer, int len) const; + const char* formatDesc(char* buffer, int len) const; afxMagicSpellData* getSpellDataBlock() const; afxRPGMagicSpellData* getSpellRPGDataBlock() const; diff --git a/Engine/source/afx/xm/afxXM_Oscillate.cpp b/Engine/source/afx/xm/afxXM_Oscillate.cpp index 049d84b12..6d261e4ad 100644 --- a/Engine/source/afx/xm/afxXM_Oscillate.cpp +++ b/Engine/source/afx/xm/afxXM_Oscillate.cpp @@ -225,20 +225,6 @@ afxXM_Base* afxXM_OscillateData::create(afxEffectWrapper* fx, bool on_server) //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// -inline F32 lerp(F32 t, F32 a, F32 b) -{ - return a + t * (b - a); -} - -inline Point3F lerpV(F32 t, const Point3F& a, const Point3F& b) -{ - return Point3F( a.x + t * (b.x - a.x), - a.y + t * (b.y - a.y), - a.z + t * (b.z - a.z) ); -} - -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// - afxXM_Oscillate_rot::afxXM_Oscillate_rot(afxXM_OscillateData* db, afxEffectWrapper* fxw) : afxXM_WeightedBase(db, fxw) { diff --git a/Engine/source/afx/xm/afxXM_WaveBase.h b/Engine/source/afx/xm/afxXM_WaveBase.h index e231ef2b8..0bcc7d85b 100644 --- a/Engine/source/afx/xm/afxXM_WaveBase.h +++ b/Engine/source/afx/xm/afxXM_WaveBase.h @@ -85,7 +85,7 @@ public: virtual void interpolate(F32 t, afxXM_Params& params)=0; virtual void pulse()=0; - static F32 lerp(F32 t, F32 a, F32 b) { return a + t * (b - a); } + static inline F32 lerp(F32 t, F32 a, F32 b) { return a + t * (b - a); } }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXfmMod.h b/Engine/source/afx/xm/afxXfmMod.h index 7c7eaa41d..29994793b 100644 --- a/Engine/source/afx/xm/afxXfmMod.h +++ b/Engine/source/afx/xm/afxXfmMod.h @@ -169,6 +169,19 @@ protected: public: /*C*/ afxXM_WeightedBase(afxXM_WeightedBaseData*, afxEffectWrapper*); virtual ~afxXM_WeightedBase() { } + + F32 lerp(F32 t, F32 a, F32 b) + { + return a + t * (b - a); + } + + Point3F lerpV(F32 t, const Point3F& a, const Point3F& b) + { + return Point3F( a.x + t * (b.x - a.x), + a.y + t * (b.y - a.y), + a.z + t * (b.z - a.z) ); + } + }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/console/CMDgram.y b/Engine/source/console/CMDgram.y index 0b15c0e93..c3e8846b8 100644 --- a/Engine/source/console/CMDgram.y +++ b/Engine/source/console/CMDgram.y @@ -26,7 +26,7 @@ extern int serrors; #define YY_ARGS(x) x int CMDlex(); -void CMDerror(char *, ...); +void CMDerror(const char *, ...); #ifdef alloca #undef alloca diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 787b4e845..37a5ee5c3 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -578,6 +578,9 @@ inline Token< T > MakeToken( T value, U32 lineNumber ) #include "console/cmdgram.h" +// HACK: C++17 and beyond can't use register keyword +#define register + using namespace Compiler; #define YY_NEVER_INTERACTIVE 1 @@ -626,12 +629,12 @@ void CMDSetScanBuffer(const char *sb, const char *fn); const char * CMDgetFileLine(int &lineNumber); // Error reporting -void CMDerror(char * s, ...); +void CMDerror(const char * s, ...); // Reset the parser. void CMDrestart(FILE *in); -#line 635 "CMDscan.cpp" +#line 638 "CMDscan.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -774,14 +777,14 @@ YY_MALLOC_DECL YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; -#line 105 "CMDscan.l" +#line 108 "CMDscan.l" ; -#line 785 "CMDscan.cpp" +#line 788 "CMDscan.cpp" if ( yy_init ) { @@ -823,7 +826,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -866,187 +869,187 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 107 "CMDscan.l" +#line 110 "CMDscan.l" { } YY_BREAK case 2: YY_RULE_SETUP -#line 108 "CMDscan.l" +#line 111 "CMDscan.l" { return(Sc_ScanDocBlock()); } YY_BREAK case 3: YY_RULE_SETUP -#line 109 "CMDscan.l" +#line 112 "CMDscan.l" ; YY_BREAK case 4: YY_RULE_SETUP -#line 110 "CMDscan.l" +#line 113 "CMDscan.l" ; YY_BREAK case 5: YY_RULE_SETUP -#line 111 "CMDscan.l" +#line 114 "CMDscan.l" {lineIndex++;} YY_BREAK case 6: YY_RULE_SETUP -#line 112 "CMDscan.l" +#line 115 "CMDscan.l" { return(Sc_ScanString(STRATOM)); } YY_BREAK case 7: YY_RULE_SETUP -#line 113 "CMDscan.l" +#line 116 "CMDscan.l" { return(Sc_ScanString(TAGATOM)); } YY_BREAK case 8: YY_RULE_SETUP -#line 114 "CMDscan.l" +#line 117 "CMDscan.l" { CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } YY_BREAK case 9: YY_RULE_SETUP -#line 115 "CMDscan.l" +#line 118 "CMDscan.l" { CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } YY_BREAK case 10: YY_RULE_SETUP -#line 116 "CMDscan.l" +#line 119 "CMDscan.l" { CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } YY_BREAK case 11: YY_RULE_SETUP -#line 117 "CMDscan.l" +#line 120 "CMDscan.l" { CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } YY_BREAK case 12: YY_RULE_SETUP -#line 118 "CMDscan.l" +#line 121 "CMDscan.l" { CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } YY_BREAK case 13: YY_RULE_SETUP -#line 119 "CMDscan.l" +#line 122 "CMDscan.l" { CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } YY_BREAK case 14: YY_RULE_SETUP -#line 120 "CMDscan.l" +#line 123 "CMDscan.l" { CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } YY_BREAK case 15: YY_RULE_SETUP -#line 121 "CMDscan.l" +#line 124 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } YY_BREAK case 16: YY_RULE_SETUP -#line 122 "CMDscan.l" +#line 125 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } YY_BREAK case 17: YY_RULE_SETUP -#line 123 "CMDscan.l" +#line 126 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } YY_BREAK case 18: YY_RULE_SETUP -#line 124 "CMDscan.l" +#line 127 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } YY_BREAK case 19: YY_RULE_SETUP -#line 125 "CMDscan.l" +#line 128 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } YY_BREAK case 20: YY_RULE_SETUP -#line 126 "CMDscan.l" +#line 129 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } YY_BREAK case 21: YY_RULE_SETUP -#line 127 "CMDscan.l" +#line 130 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } YY_BREAK case 22: YY_RULE_SETUP -#line 128 "CMDscan.l" +#line 131 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } YY_BREAK case 23: YY_RULE_SETUP -#line 129 "CMDscan.l" +#line 132 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } YY_BREAK case 24: YY_RULE_SETUP -#line 130 "CMDscan.l" +#line 133 "CMDscan.l" { CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } YY_BREAK case 25: YY_RULE_SETUP -#line 131 "CMDscan.l" +#line 134 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } YY_BREAK case 26: YY_RULE_SETUP -#line 132 "CMDscan.l" +#line 135 "CMDscan.l" { CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } YY_BREAK case 27: YY_RULE_SETUP -#line 133 "CMDscan.l" +#line 136 "CMDscan.l" { CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } YY_BREAK case 28: YY_RULE_SETUP -#line 134 "CMDscan.l" +#line 137 "CMDscan.l" { CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } YY_BREAK case 29: YY_RULE_SETUP -#line 135 "CMDscan.l" +#line 138 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } YY_BREAK case 30: YY_RULE_SETUP -#line 136 "CMDscan.l" +#line 139 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } YY_BREAK case 31: YY_RULE_SETUP -#line 137 "CMDscan.l" +#line 140 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } YY_BREAK case 32: YY_RULE_SETUP -#line 138 "CMDscan.l" +#line 141 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } YY_BREAK case 33: YY_RULE_SETUP -#line 139 "CMDscan.l" +#line 142 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } YY_BREAK case 34: YY_RULE_SETUP -#line 140 "CMDscan.l" +#line 143 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } YY_BREAK case 35: YY_RULE_SETUP -#line 141 "CMDscan.l" +#line 144 "CMDscan.l" { CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } YY_BREAK case 36: YY_RULE_SETUP -#line 142 "CMDscan.l" +#line 145 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } YY_BREAK case 37: YY_RULE_SETUP -#line 143 "CMDscan.l" +#line 146 "CMDscan.l" { /* this comment stops syntax highlighting from getting messed up when editing the lexer in TextPad */ int c = 0, l; for ( ; ; ) @@ -1072,222 +1075,222 @@ YY_RULE_SETUP } YY_BREAK case 38: -#line 167 "CMDscan.l" -case 39: -#line 168 "CMDscan.l" -case 40: -#line 169 "CMDscan.l" -case 41: #line 170 "CMDscan.l" -case 42: +case 39: #line 171 "CMDscan.l" -case 43: +case 40: #line 172 "CMDscan.l" -case 44: +case 41: #line 173 "CMDscan.l" -case 45: +case 42: #line 174 "CMDscan.l" -case 46: +case 43: #line 175 "CMDscan.l" -case 47: +case 44: #line 176 "CMDscan.l" -case 48: +case 45: #line 177 "CMDscan.l" -case 49: +case 46: #line 178 "CMDscan.l" -case 50: +case 47: #line 179 "CMDscan.l" -case 51: +case 48: #line 180 "CMDscan.l" -case 52: +case 49: #line 181 "CMDscan.l" -case 53: +case 50: #line 182 "CMDscan.l" -case 54: +case 51: #line 183 "CMDscan.l" -case 55: +case 52: #line 184 "CMDscan.l" -case 56: +case 53: #line 185 "CMDscan.l" -case 57: +case 54: #line 186 "CMDscan.l" -case 58: +case 55: #line 187 "CMDscan.l" -case 59: +case 56: #line 188 "CMDscan.l" -case 60: +case 57: #line 189 "CMDscan.l" +case 58: +#line 190 "CMDscan.l" +case 59: +#line 191 "CMDscan.l" +case 60: +#line 192 "CMDscan.l" case 61: YY_RULE_SETUP -#line 189 "CMDscan.l" +#line 192 "CMDscan.l" { CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } YY_BREAK case 62: YY_RULE_SETUP -#line 190 "CMDscan.l" +#line 193 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } YY_BREAK case 63: YY_RULE_SETUP -#line 191 "CMDscan.l" +#line 194 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } YY_BREAK case 64: YY_RULE_SETUP -#line 192 "CMDscan.l" +#line 195 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } YY_BREAK case 65: YY_RULE_SETUP -#line 193 "CMDscan.l" +#line 196 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } YY_BREAK case 66: YY_RULE_SETUP -#line 194 "CMDscan.l" +#line 197 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } YY_BREAK case 67: YY_RULE_SETUP -#line 195 "CMDscan.l" +#line 198 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } YY_BREAK case 68: YY_RULE_SETUP -#line 196 "CMDscan.l" +#line 199 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } YY_BREAK case 69: YY_RULE_SETUP -#line 197 "CMDscan.l" +#line 200 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } YY_BREAK case 70: YY_RULE_SETUP -#line 198 "CMDscan.l" +#line 201 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } YY_BREAK case 71: YY_RULE_SETUP -#line 199 "CMDscan.l" +#line 202 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } YY_BREAK case 72: YY_RULE_SETUP -#line 200 "CMDscan.l" +#line 203 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } YY_BREAK case 73: YY_RULE_SETUP -#line 201 "CMDscan.l" +#line 204 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } YY_BREAK case 74: YY_RULE_SETUP -#line 202 "CMDscan.l" +#line 205 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } YY_BREAK case 75: YY_RULE_SETUP -#line 203 "CMDscan.l" +#line 206 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } YY_BREAK case 76: YY_RULE_SETUP -#line 204 "CMDscan.l" +#line 207 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } YY_BREAK case 77: YY_RULE_SETUP -#line 205 "CMDscan.l" +#line 208 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } YY_BREAK case 78: YY_RULE_SETUP -#line 206 "CMDscan.l" +#line 209 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } YY_BREAK case 79: YY_RULE_SETUP -#line 207 "CMDscan.l" +#line 210 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } YY_BREAK case 80: YY_RULE_SETUP -#line 208 "CMDscan.l" +#line 211 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } YY_BREAK case 81: YY_RULE_SETUP -#line 209 "CMDscan.l" +#line 212 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } YY_BREAK case 82: YY_RULE_SETUP -#line 210 "CMDscan.l" +#line 213 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } YY_BREAK case 83: YY_RULE_SETUP -#line 211 "CMDscan.l" +#line 214 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } YY_BREAK case 84: YY_RULE_SETUP -#line 212 "CMDscan.l" +#line 215 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } YY_BREAK case 85: YY_RULE_SETUP -#line 213 "CMDscan.l" +#line 216 "CMDscan.l" { CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } YY_BREAK case 86: YY_RULE_SETUP -#line 214 "CMDscan.l" +#line 217 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } YY_BREAK case 87: YY_RULE_SETUP -#line 215 "CMDscan.l" +#line 218 "CMDscan.l" { return(Sc_ScanVar()); } YY_BREAK case 88: YY_RULE_SETUP -#line 216 "CMDscan.l" +#line 220 "CMDscan.l" { return Sc_ScanIdent(); } YY_BREAK case 89: YY_RULE_SETUP -#line 217 "CMDscan.l" +#line 221 "CMDscan.l" return(Sc_ScanHex()); YY_BREAK case 90: YY_RULE_SETUP -#line 218 "CMDscan.l" +#line 222 "CMDscan.l" { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } YY_BREAK case 91: YY_RULE_SETUP -#line 219 "CMDscan.l" +#line 223 "CMDscan.l" return Sc_ScanNum(); YY_BREAK case 92: YY_RULE_SETUP -#line 220 "CMDscan.l" +#line 224 "CMDscan.l" return(ILLEGAL_TOKEN); YY_BREAK case 93: YY_RULE_SETUP -#line 221 "CMDscan.l" +#line 225 "CMDscan.l" return(ILLEGAL_TOKEN); YY_BREAK case 94: YY_RULE_SETUP -#line 222 "CMDscan.l" +#line 226 "CMDscan.l" ECHO; YY_BREAK -#line 1291 "CMDscan.cpp" +#line 1294 "CMDscan.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1430,9 +1433,9 @@ case YY_STATE_EOF(INITIAL): static int yy_get_next_buffer() { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) @@ -1560,14 +1563,14 @@ static int yy_get_next_buffer() static yy_state_type yy_get_previous_state() { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1599,10 +1602,10 @@ static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1623,14 +1626,14 @@ yy_state_type yy_current_state; #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS -static void yyunput( int c, char *yy_bp ) +static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; -char *yy_bp; +register char *yy_bp; #endif { - char *yy_cp = yy_c_buf_p; + register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; @@ -1638,10 +1641,10 @@ char *yy_bp; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; - char *source = + register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) @@ -2095,7 +2098,7 @@ yyconst char *s2; int n; #endif { - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2147,7 +2150,7 @@ int main() return 0; } #endif -#line 222 "CMDscan.l" +#line 226 "CMDscan.l" static const char *scanBuffer; @@ -2166,7 +2169,7 @@ int CMDGetCurrentLine() extern bool gConsoleSyntaxError; -void CMDerror(char *format, ...) +void CMDerror(const char *format, ...) { Compiler::gSyntaxError = true; diff --git a/Engine/source/console/CMDscan.l b/Engine/source/console/CMDscan.l index ccf933bd7..ab2c61a72 100644 --- a/Engine/source/console/CMDscan.l +++ b/Engine/source/console/CMDscan.l @@ -32,6 +32,9 @@ inline Token< T > MakeToken( T value, U32 lineNumber ) #include "console/cmdgram.h" +// HACK: C++17 and beyond can't use register keyword +#define register + using namespace Compiler; #define YY_NEVER_INTERACTIVE 1 @@ -80,7 +83,7 @@ void CMDSetScanBuffer(const char *sb, const char *fn); const char * CMDgetFileLine(int &lineNumber); // Error reporting -void CMDerror(char * s, ...); +void CMDerror(const char * s, ...); // Reset the parser. void CMDrestart(FILE *in); @@ -238,7 +241,7 @@ int CMDGetCurrentLine() extern bool gConsoleSyntaxError; -void CMDerror(char *format, ...) +void CMDerror(const char *format, ...) { Compiler::gSyntaxError = true; diff --git a/Engine/source/console/ast.h b/Engine/source/console/ast.h index 558446534..9072c4354 100644 --- a/Engine/source/console/ast.h +++ b/Engine/source/console/ast.h @@ -352,7 +352,7 @@ struct StrConstNode : ExprNode bool tag; bool doc; // Specifies that this string is a documentation block. - static StrConstNode* alloc(S32 lineNumber, char* str, bool tag, bool doc = false); + static StrConstNode* alloc(S32 lineNumber, const char* str, bool tag, bool doc = false); U32 compile(CodeStream& codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index 50d02bcaa..5728296ad 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -243,7 +243,7 @@ FloatNode* FloatNode::alloc(S32 lineNumber, F64 value) return ret; } -StrConstNode* StrConstNode::alloc(S32 lineNumber, char* str, bool tag, bool doc) +StrConstNode* StrConstNode::alloc(S32 lineNumber, const char* str, bool tag, bool doc) { StrConstNode* ret = (StrConstNode*)consoleAlloc(sizeof(StrConstNode)); constructInPlace(ret); diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 3bf0131d6..6207010b4 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -113,7 +113,7 @@ extern int serrors; #define YY_ARGS(x) x int CMDlex(); -void CMDerror(char *, ...); +void CMDerror(const char *, ...); #ifdef alloca #undef alloca diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index d381fdc1c..427fb5765 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -116,7 +116,6 @@ struct ConsoleLogEntry }; typedef const char *StringTableEntry; -extern char *typeValueEmpty; enum ConsoleValueType { diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index 82f92ca3b..e1de30ab1 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -462,9 +462,6 @@ const char *Dictionary::tabComplete(const char *prevText, S32 baseLen, bool fFor return bestMatch; } - -char *typeValueEmpty = ""; - Dictionary::Entry::Entry(StringTableEntry in_name) { name = in_name; @@ -477,7 +474,7 @@ Dictionary::Entry::Entry(StringTableEntry in_name) ival = 0; fval = 0; - sval = typeValueEmpty; + sval = NULL; bufferLen = 0; } @@ -489,7 +486,7 @@ Dictionary::Entry::~Entry() void Dictionary::Entry::reset() { name = NULL; - if (type <= TypeInternalString && sval != typeValueEmpty) + if (type <= TypeInternalString && sval != NULL) dFree(sval); if (notify) delete notify; @@ -540,7 +537,7 @@ void Dictionary::Entry::setStringValue(const char* value) // may as well pad to the next cache line U32 newLen = ((stringLen + 1) + 15) & ~15; - if (sval == typeValueEmpty) + if (sval == NULL) sval = (char*)dMalloc(newLen); else if (newLen > bufferLen) sval = (char*)dRealloc(sval, newLen); @@ -631,7 +628,7 @@ Dictionary::Entry* Dictionary::addVariable(const char *name, Entry *ent = add(StringTable->insert(name)); - if (ent->type <= Entry::TypeInternalString && ent->sval != typeValueEmpty) + if (ent->type <= Entry::TypeInternalString && ent->sval != NULL) dFree(ent->sval); ent->mUsage = usage; diff --git a/Engine/source/console/consoleInternal.h b/Engine/source/console/consoleInternal.h index 758fd1327..9b8ab1e19 100644 --- a/Engine/source/console/consoleInternal.h +++ b/Engine/source/console/consoleInternal.h @@ -353,7 +353,7 @@ public: ival = 0; fval = 0; - sval = typeValueEmpty; + sval = NULL; bufferLen = 0; } @@ -404,10 +404,10 @@ public: { fval = (F32)val; ival = val; - if (sval != typeValueEmpty) + if (sval != NULL) { dFree(sval); - sval = typeValueEmpty; + sval = NULL; } type = TypeInternalInt; } @@ -434,10 +434,10 @@ public: { fval = val; ival = static_cast(val); - if (sval != typeValueEmpty) + if (sval != NULL) { dFree(sval); - sval = typeValueEmpty; + sval = NULL; } type = TypeInternalFloat; } diff --git a/Engine/source/console/sim.h b/Engine/source/console/sim.h index 001ace64e..8b8f41b4e 100644 --- a/Engine/source/console/sim.h +++ b/Engine/source/console/sim.h @@ -133,6 +133,11 @@ namespace Sim SimObject* findObject(const char* name); SimObject* findObject(const char* fileName, S32 declarationLine); + inline SimObject* findObject(const String& name) + { + return findObject(name.c_str()); + } + template inline bool findObject(SimObjectId iD,T*&t) { t = dynamic_cast(findObject(iD)); @@ -143,6 +148,11 @@ namespace Sim t = dynamic_cast(findObject(objectName)); return t != NULL; } + template inline bool findObject(const String& objectName, T*& t) + { + t = dynamic_cast(findObject(objectName)); + return t != NULL; + } SimObject *spawnObject(String spawnClass, String spawnDataBlock = String::EmptyString, diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index e76263fc7..7cde17c29 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -830,6 +830,14 @@ bool SimObject::registerObject(const char *name) //----------------------------------------------------------------------------- +bool SimObject::registerObject(const String& name) +{ + assignName(name.c_str()); + return registerObject(); +} + +//----------------------------------------------------------------------------- + bool SimObject::registerObject(const char *name, U32 id) { setId(id); @@ -1466,7 +1474,7 @@ SimObject* SimObject::clone() simObject->assignFieldsFrom( this ); String name = Sim::getUniqueName( getName() ); - if( !simObject->registerObject( name ) ) + if( !simObject->registerObject( name.c_str() ) ) { delete simObject; return NULL; @@ -3269,8 +3277,7 @@ DefineEngineMethod( SimObject, getDebugInfo, ArrayObject*, (),, array->push_back( "Object|Description", object->describeSelf() ); array->push_back( "Object|FileName", object->getFilename() ); array->push_back( "Object|DeclarationLine", String::ToString( object->getDeclarationLine() ) ); - array->push_back( "Object|CopySource", object->getCopySource() ? - String::ToString( "%i:%s (%s)", object->getCopySource()->getId(), object->getCopySource()->getClassName(), object->getCopySource()->getName() ) : "" ); + array->push_back( "Object|CopySource", object->getCopySource() ? String::ToString( "%i:%s (%s)", object->getCopySource()->getId(), object->getCopySource()->getClassName(), object->getCopySource()->getName() ) : String("") ); array->push_back( "Flag|EditorOnly", object->isEditorOnly() ? "true" : "false" ); array->push_back( "Flag|NameChangeAllowed", object->isNameChangeAllowed() ? "true" : "false" ); array->push_back( "Flag|AutoDelete", object->isAutoDeleted() ? "true" : "false" ); diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 05a9353dc..33c7cf5f0 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -730,6 +730,12 @@ class SimObject: public ConsoleObject, public TamlCallbacks /// @param name Name to assign to the object. bool registerObject(const char *name); + /// Register the object, assigning the name. + /// + /// @see registerObject() + /// @param name Name to assign to the object. + bool registerObject(const String& name); + /// Register the object, assigning a name and ID. /// /// @see registerObject() diff --git a/Engine/source/core/util/path.h b/Engine/source/core/util/path.h index 1f094ef5f..49875f4b6 100644 --- a/Engine/source/core/util/path.h +++ b/Engine/source/core/util/path.h @@ -72,6 +72,7 @@ public: bool operator == (const Path& path) const { return getFullPath().equal(path.getFullPath()); } bool operator != (const Path& path) const { return !(*this == path); } + bool operator != (const String& path) const { return !(getFullPath().equal(path)); } bool isEmpty() const { return getFullPath().isEmpty(); } diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index d89fa3715..35c6bd8a2 100644 --- a/Engine/source/core/util/str.cpp +++ b/Engine/source/core/util/str.cpp @@ -415,11 +415,12 @@ class String::StringData : protected StringDataImpl static StringData* Empty() { - static UTF16 emptyUTF16[ 1 ] = { 0 }; + static UTF16 emptyUTF16[1] = { 0 }; + static UTF8 emptyUTF8[1] = { 0 }; static StringDataImpl empty = { #ifdef TORQUE_DEBUG - "", // mString + emptyUTF8, // mString #endif U32_MAX, // mRefCount diff --git a/Engine/source/core/util/tList.h b/Engine/source/core/util/tList.h index 1ed9312b4..3c838d5d0 100644 --- a/Engine/source/core/util/tList.h +++ b/Engine/source/core/util/tList.h @@ -411,22 +411,14 @@ inline List::_Iterator::_Iterator(E* ptr) // recheck this and remove if fixed with VS2008 SP1 template template -#ifdef _MSC_VER -inline typename List:: _Iterator& List::_Iterator::operator++() -#else inline typename List::template _Iterator& List::_Iterator::operator++() -#endif { _link = _link->next; return *this; } template template -#ifdef _MSC_VER -inline typename List:: _Iterator List::_Iterator::operator++(int) -#else inline typename List::template _Iterator List::_Iterator::operator++(int) -#endif { _Iterator itr(*this); _link = _link->next; @@ -434,22 +426,14 @@ inline typename List::template _Iterator List::_Iterator:: } template template -#ifdef _MSC_VER -inline typename List:: _Iterator& List::_Iterator::operator--() -#else inline typename List::template _Iterator& List::_Iterator::operator--() -#endif { _link = _link->prev; return *this; } template template -#ifdef _MSC_VER -inline typename List:: _Iterator List::_Iterator::operator--(int) -#else inline typename List::template _Iterator List::_Iterator::operator--(int) -#endif { _Iterator itr(*this); _link = _link->prev; diff --git a/Engine/source/gui/controls/guiConsoleEditCtrl.cpp b/Engine/source/gui/controls/guiConsoleEditCtrl.cpp index 2b281e18f..d032b8766 100644 --- a/Engine/source/gui/controls/guiConsoleEditCtrl.cpp +++ b/Engine/source/gui/controls/guiConsoleEditCtrl.cpp @@ -134,7 +134,7 @@ bool GuiConsoleEditCtrl::onKeyDown(const GuiEvent &event) text = String::ToString( "echo(%s);", text.c_str() ); - setText( text ); + setText( text.utf8() ); } return Parent::dealWithEnter(false); diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 60db14f65..986cfba71 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3802,7 +3802,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool ) { //Check if we're a SceneObject, and pick the default icon as appropriate - if (pObject->getClassName() != String("SimGroup")) + if (pObject->getClassName() != StringTable->insert("SimGroup")) { item->mIcon = Icon31; } diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index ba04467c2..2835eb521 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -227,7 +227,7 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) { if (item->mEnabled) { - Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : ""); + Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : String("")); } } } diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index d5dc8c5bf..38d5e92b2 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -530,7 +530,7 @@ void GuiShapeEdPreview::setThreadSequence(GuiShapeEdPreview::Thread& thread, TSS const char* GuiShapeEdPreview::getThreadSequence() const { - return ( mActiveThread >= 0 ) ? mThreads[mActiveThread].seqName : ""; + return ( mActiveThread >= 0 ) ? mThreads[mActiveThread].seqName.c_str() : ""; } void GuiShapeEdPreview::refreshThreadSequences() diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 8fa7d7e28..79b08249a 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -69,7 +69,7 @@ String RenderPassData::describeSelf() const for ( U32 i=0; i < Material::MAX_TEX_PER_PASS; i++ ) { if ( mTexType[i] == Material::TexTarget ) - texName = ( mTexSlot[i].texTarget ) ? mTexSlot[i].texTarget->getName() : "null_texTarget"; + texName = ( mTexSlot[i].texTarget ) ? mTexSlot[i].texTarget->getName() : String("null_texTarget"); else if ( mTexType[i] == Material::Cube && mCubeMap ) texName = mCubeMap->getPath(); else if ( mTexSlot[i].texObject ) diff --git a/Engine/source/platformWin32/videoInfo/wmiVideoInfo.cpp b/Engine/source/platformWin32/videoInfo/wmiVideoInfo.cpp index b4fecbba3..672d01000 100644 --- a/Engine/source/platformWin32/videoInfo/wmiVideoInfo.cpp +++ b/Engine/source/platformWin32/videoInfo/wmiVideoInfo.cpp @@ -88,7 +88,7 @@ static MYGUID IID_IDxDiagContainer( 0x7D0F462F, 0x4064, 0x4862, 0xBC, 0x7F, 0x93 //------------------------------------------------------------------------------ -WCHAR *WMIVideoInfo::smPVIQueryTypeToWMIString [] = +const WCHAR *WMIVideoInfo::smPVIQueryTypeToWMIString [] = { L"MaxNumberControlled", //PVI_NumDevices L"Description", //PVI_Description @@ -595,4 +595,4 @@ bool WMIVideoInfo::_queryPropertyWMI( const PVIQueryType queryType, const U32 ad enumerator->Release(); return result; -} \ No newline at end of file +} diff --git a/Engine/source/platformWin32/videoInfo/wmiVideoInfo.h b/Engine/source/platformWin32/videoInfo/wmiVideoInfo.h index 3b71d97fc..2c0e93537 100644 --- a/Engine/source/platformWin32/videoInfo/wmiVideoInfo.h +++ b/Engine/source/platformWin32/videoInfo/wmiVideoInfo.h @@ -51,7 +51,7 @@ private: bool _queryPropertyWMI( const PVIQueryType queryType, const U32 adapterId, String *outValue ); protected: - static WCHAR *smPVIQueryTypeToWMIString []; + static const WCHAR *smPVIQueryTypeToWMIString []; bool _queryProperty( const PVIQueryType queryType, const U32 adapterId, String *outValue ); bool _initialize(); String _lookUpVendorId(U32 vendorId); @@ -61,4 +61,4 @@ public: ~WMIVideoInfo(); }; -#endif \ No newline at end of file +#endif diff --git a/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp index c5563d125..fe7961667 100644 --- a/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp @@ -140,7 +140,7 @@ void AppVertConnectorGLSL::sortVars() // Not required in GLSL } -void AppVertConnectorGLSL::setName( char *newName ) +void AppVertConnectorGLSL::setName( const char *newName ) { dStrcpy( (char*)mName, newName, 32 ); } @@ -285,7 +285,7 @@ void VertPixelConnectorGLSL::sortVars() // Not needed in GLSL } -void VertPixelConnectorGLSL::setName( char *newName ) +void VertPixelConnectorGLSL::setName( const char *newName ) { dStrcpy( (char*)mName, newName, 32 ); } diff --git a/Engine/source/shaderGen/GLSL/shaderCompGLSL.h b/Engine/source/shaderGen/GLSL/shaderCompGLSL.h index 12cd4ae93..1ba5d66db 100644 --- a/Engine/source/shaderGen/GLSL/shaderCompGLSL.h +++ b/Engine/source/shaderGen/GLSL/shaderCompGLSL.h @@ -36,7 +36,7 @@ public: virtual Var* getElement( RegisterType type, U32 numElements = 1, U32 numRegisters = -1 ); - virtual void setName( char *newName ); + virtual void setName( const char *newName ); virtual void reset(); virtual void sortVars(); @@ -52,7 +52,7 @@ public: virtual Var* getElement( RegisterType type, U32 numElements = 1, U32 numRegisters = -1 ); - virtual void setName( char *newName ); + virtual void setName( const char *newName ); virtual void reset(); virtual void sortVars(); diff --git a/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp index f01bb8d5a..864511632 100644 --- a/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp @@ -230,7 +230,7 @@ void ShaderConnectorHLSL::sortVars() return; } -void ShaderConnectorHLSL::setName( char *newName ) +void ShaderConnectorHLSL::setName( const char *newName ) { dStrcpy( (char*)mName, newName, 32 ); } diff --git a/Engine/source/shaderGen/HLSL/shaderCompHLSL.h b/Engine/source/shaderGen/HLSL/shaderCompHLSL.h index cb4ae5ad1..a89c54ea1 100644 --- a/Engine/source/shaderGen/HLSL/shaderCompHLSL.h +++ b/Engine/source/shaderGen/HLSL/shaderCompHLSL.h @@ -43,7 +43,7 @@ public: U32 numElements = 1, U32 numRegisters = -1 ); - virtual void setName( char *newName ); + virtual void setName( const char *newName ); virtual void reset(); virtual void sortVars(); @@ -71,4 +71,4 @@ public: virtual void print( Stream &stream, bool isVerterShader ); }; -#endif // _SHADERCOMP_HLSL_H_ \ No newline at end of file +#endif // _SHADERCOMP_HLSL_H_ diff --git a/Engine/source/shaderGen/shaderComp.h b/Engine/source/shaderGen/shaderComp.h index ac6d9c539..70fe4372e 100644 --- a/Engine/source/shaderGen/shaderComp.h +++ b/Engine/source/shaderGen/shaderComp.h @@ -87,7 +87,7 @@ public: U32 numElements = 1, U32 numRegisters = -1 ) = 0; - virtual void setName( char *newName ) = 0; + virtual void setName( const char *newName ) = 0; virtual void reset() = 0; virtual void sortVars() = 0; diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index ccb53b8e2..954ee6cac 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -346,7 +346,7 @@ bool TerrainBlock::_setLightMapSize( void *obj, const char *index, const char *d bool TerrainBlock::setFile( const FileName &terrFileName ) { - if ( mTerrainAsset && mTerrainAsset->getTerrainFilePath() == terrFileName ) + if ( mTerrainAsset && mTerrainAsset->getTerrainFilePath() == StringTable->insert(terrFileName) ) return mFile != NULL; Resource file = ResourceManager::get().load( terrFileName ); diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 7884e1a63..63e743087 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -537,7 +537,7 @@ bool ColladaShapeLoader::canLoadCachedDTS(const Torque::Path& path) //assume the dts is good since it was zipped on purpose Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(cachedPath); - if (ref && !String::compare("Zip", ref->getTypeStr())) + if (ref && !String::compare("Zip", ref->getTypeStr().c_str())) { bool forceLoadDAE = Con::getBoolVariable("$collada::forceLoadDAE", false); @@ -729,7 +729,7 @@ TSShape* loadColladaShape(const Torque::Path &path) if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write)) { Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(daePath); - if (ref && !String::compare("Zip", ref->getTypeStr())) + if (ref && !String::compare("Zip", ref->getTypeStr().c_str())) Con::errorf("No cached dts file found in archive for %s. Forcing cache to disk.", daePath.getFullFileName().c_str()); Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str()); diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 6f53670b8..1a1e60da3 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -789,7 +789,7 @@ DefineTSShapeConstructorMethod(writeChangeSet, void, (), , while (!f.isEOF()) { const char* buffer = (const char*)f.readLine(); - if (!String::compare(buffer, beginMessage)) + if (!String::compare(buffer, beginMessage.c_str())) break; stream->writeText(buffer); stream->writeText("\r\n"); @@ -810,7 +810,7 @@ DefineTSShapeConstructorMethod(writeChangeSet, void, (), , while (!f.isEOF()) { const char* buffer = (const char*)f.readLine(); - if (!String::compare(buffer, endMessage)) + if (!String::compare(buffer, endMessage.c_str())) break; } diff --git a/Tools/CMake/CMakeLists.txt b/Tools/CMake/CMakeLists.txt index cdf6e832b..e35aa064b 100644 --- a/Tools/CMake/CMakeLists.txt +++ b/Tools/CMake/CMakeLists.txt @@ -20,8 +20,7 @@ # IN THE SOFTWARE. # ----------------------------------------------------------------------------- -# JTH: We require CMake 3.1.4 for MSVC14 compatibility check -cmake_minimum_required(VERSION 3.1.4) +cmake_minimum_required(VERSION 3.12) include(basics.cmake) diff --git a/Tools/CMake/basics.cmake b/Tools/CMake/basics.cmake index 6719036db..9499cbf10 100644 --- a/Tools/CMake/basics.cmake +++ b/Tools/CMake/basics.cmake @@ -387,8 +387,8 @@ macro(finishExecutable) add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files}) endif() - # Torque requires c++17 - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + # Torque requires c++20 + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) addInclude("${firstDir}")