Compilation fixes for C++20

This commit is contained in:
Jeff Hutchinson 2022-11-27 23:08:07 -05:00
parent e16351605b
commit 1940becb2d
40 changed files with 220 additions and 211 deletions

View file

@ -443,7 +443,7 @@ bool afxMagicMissileData::onAdd()
{
// Tokenize input string and convert to Point3F array
//
Vector<char*> dataBlocks(__FILE__, __LINE__);
Vector<String> dataBlocks(__FILE__, __LINE__);
// make a copy of points_string
dsize_t tokCopyLen = dStrlen(wiggle_axis_string) + 1;

View file

@ -258,9 +258,9 @@ void afxSpellBook::unpackUpdate(NetConnection * con, BitStream * stream)
}
}
#define SPELL_DATA_NOT_FOUND "\n<just:center><font:Arial:20><color:FF0000>** Spell data not found **\n\n\n\n"
#define SPELL_DATA_NOT_FOUND "\n<just:center><font:Arial:20><color:FF0000>** 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])

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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)
{

View file

@ -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); }
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -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) );
}
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//