From 353608f2b9afbaf2a3cfa0e1d8fdd2e3e58a520d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 5 Feb 2016 10:52:10 +0100 Subject: [PATCH] - added a few FString variants for frequently called functions. --- src/v_font.h | 1 + src/v_text.h | 2 ++ src/w_wad.h | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/src/v_font.h b/src/v_font.h index 13dca6e2c..40b65d920 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -95,6 +95,7 @@ public: // Return width of string in pixels (unscaled) int StringWidth (const BYTE *str) const; 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; char GetCursor() const { return Cursor; } diff --git a/src/v_text.h b/src/v_text.h index f1426b30a..22b93992d 100644 --- a/src/v_text.h +++ b/src/v_text.h @@ -79,5 +79,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *str, bool pre void V_FreeBrokenLines (FBrokenLines *lines); inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const char *str, bool preservecolor = false) { 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__ diff --git a/src/w_wad.h b/src/w_wad.h index dcac6a1b2..04a6941f0 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -166,8 +166,10 @@ public: 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 FString &name) { return CheckNumForName (name.GetChars()); } 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 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, int ns) { return GetNumForName ((const char *)name, ns); } @@ -175,6 +177,10 @@ public: int CheckNumForFullName (const char *name, int wadfile); 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); FTexture *GetLinkedTexture(int lump);