- added a few FString variants for frequently called functions.

This commit is contained in:
Christoph Oelckers 2016-02-05 10:52:10 +01:00
parent 76c5039c63
commit 353608f2b9
3 changed files with 9 additions and 0 deletions

View file

@ -95,6 +95,7 @@ public:
// Return width of string in pixels (unscaled) // Return width of string in pixels (unscaled)
int StringWidth (const BYTE *str) const; int StringWidth (const BYTE *str) const;
inline int StringWidth (const char *str) const { return StringWidth ((const BYTE *)str); } inline int StringWidth (const char *str) const { return StringWidth ((const BYTE *)str); }
inline int StringWidth (const FString &str) const { return StringWidth ((const BYTE *)str.GetChars()); }
int GetCharCode(int code, bool needpic) const; int GetCharCode(int code, bool needpic) const;
char GetCursor() const { return Cursor; } char GetCursor() const { return Cursor; }

View file

@ -79,5 +79,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *str, bool pre
void V_FreeBrokenLines (FBrokenLines *lines); void V_FreeBrokenLines (FBrokenLines *lines);
inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const char *str, bool preservecolor = false) inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const char *str, bool preservecolor = false)
{ return V_BreakLines (font, maxwidth, (const BYTE *)str, preservecolor); } { return V_BreakLines (font, maxwidth, (const BYTE *)str, preservecolor); }
inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const FString &str, bool preservecolor = false)
{ return V_BreakLines (font, maxwidth, (const BYTE *)str.GetChars(), preservecolor); }
#endif //__V_TEXT_H__ #endif //__V_TEXT_H__

View file

@ -166,8 +166,10 @@ public:
inline int CheckNumForName (const BYTE *name) { return CheckNumForName ((const char *)name, ns_global); } inline int CheckNumForName (const BYTE *name) { return CheckNumForName ((const char *)name, ns_global); }
inline int CheckNumForName (const char *name) { return CheckNumForName (name, ns_global); } inline int CheckNumForName (const char *name) { return CheckNumForName (name, ns_global); }
inline int CheckNumForName (const FString &name) { return CheckNumForName (name.GetChars()); }
inline int CheckNumForName (const BYTE *name, int ns) { return CheckNumForName ((const char *)name, ns); } inline int CheckNumForName (const BYTE *name, int ns) { return CheckNumForName ((const char *)name, ns); }
inline int GetNumForName (const char *name) { return GetNumForName (name, ns_global); } inline int GetNumForName (const char *name) { return GetNumForName (name, ns_global); }
inline int GetNumForName (const FString &name) { return GetNumForName (name.GetChars(), ns_global); }
inline int GetNumForName (const BYTE *name) { return GetNumForName ((const char *)name); } inline int GetNumForName (const BYTE *name) { return GetNumForName ((const char *)name); }
inline int GetNumForName (const BYTE *name, int ns) { return GetNumForName ((const char *)name, ns); } inline int GetNumForName (const BYTE *name, int ns) { return GetNumForName ((const char *)name, ns); }
@ -175,6 +177,10 @@ public:
int CheckNumForFullName (const char *name, int wadfile); int CheckNumForFullName (const char *name, int wadfile);
int GetNumForFullName (const char *name); int GetNumForFullName (const char *name);
inline int CheckNumForFullName(const FString &name, bool trynormal = false, int namespc = ns_global) { return CheckNumForFullName(name.GetChars(), trynormal, namespc); }
inline int CheckNumForFullName (const FString &name, int wadfile) { return CheckNumForFullName(name.GetChars(), wadfile); }
inline int GetNumForFullName (const FString &name) { return GetNumForFullName(name.GetChars()); }
void SetLinkedTexture(int lump, FTexture *tex); void SetLinkedTexture(int lump, FTexture *tex);
FTexture *GetLinkedTexture(int lump); FTexture *GetLinkedTexture(int lump);