- replaced more copystrings with FString.

This commit is contained in:
Christoph Oelckers 2016-07-28 09:06:49 +02:00
parent 66006a5c14
commit 759753eadc
4 changed files with 12 additions and 16 deletions

View file

@ -418,7 +418,7 @@ public:
class FPlayerNameBox : public FListMenuItemSelectable
{
const char *mText;
FString mText;
FFont *mFont;
EColorRange mFontColor;
int mFrameSize;
@ -447,7 +447,7 @@ public:
class FValueTextItem : public FListMenuItemSelectable
{
TArray<FString> mSelections;
const char *mText;
FString mText;
int mSelection;
FFont *mFont;
EColorRange mFontColor;
@ -472,7 +472,7 @@ public:
class FSliderItem : public FListMenuItemSelectable
{
const char *mText;
FString mText;
FFont *mFont;
EColorRange mFontColor;
int mMinrange, mMaxrange;
@ -539,7 +539,7 @@ public:
class FOptionMenuItem : public FListMenuItem
{
protected:
char *mLabel;
FString mLabel;
bool mCentered;
void drawLabel(int indent, int y, EColorRange color, bool grayed = false);
@ -548,7 +548,7 @@ public:
FOptionMenuItem(const char *text, FName action = NAME_None, bool center = false)
: FListMenuItem(0, 0, action)
{
mLabel = copystring(text);
mLabel = text;
mCentered = center;
}

View file

@ -479,7 +479,6 @@ void DOptionMenu::Drawer ()
FOptionMenuItem::~FOptionMenuItem()
{
if (mLabel != NULL) delete [] mLabel;
}
int FOptionMenuItem::Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
@ -507,14 +506,14 @@ int FOptionMenuItem::GetIndent()
{
return 0;
}
const char *label = mLabel;
const char *label = mLabel.GetChars();
if (*label == '$') label = GStrings(label+1);
return SmallFont->StringWidth(label);
}
void FOptionMenuItem::drawLabel(int indent, int y, EColorRange color, bool grayed)
{
const char *label = mLabel;
const char *label = mLabel.GetChars();
if (*label == '$') label = GStrings(label+1);
int overlay = grayed? MAKEARGB(96,48,0,0) : 0;

View file

@ -131,7 +131,7 @@ public:
msg = GStrings(msg + 1);
}
const char *actionLabel = mLabel;
const char *actionLabel = mLabel.GetChars();
if (actionLabel != NULL)
{
if (*actionLabel == '$')
@ -536,7 +536,7 @@ public:
int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
{
const char *txt = mCurrent? mAltText.GetChars() : mLabel;
const char *txt = mCurrent? mAltText.GetChars() : mLabel.GetChars();
if (*txt == '$') txt = GStrings(txt + 1);
int w = SmallFont->StringWidth(txt) * CleanXfac_1;
int x = (screen->GetWidth() - w) / 2;

View file

@ -64,7 +64,7 @@ EXTERN_CVAR (Bool, cl_run)
FPlayerNameBox::FPlayerNameBox(int x, int y, int height, int frameofs, const char *text, FFont *font, EColorRange color, FName action)
: FListMenuItemSelectable(x, y, height, action)
{
mText = copystring(text);
mText = text;
mFont = font;
mFontColor = color;
mFrameSize = frameofs;
@ -74,7 +74,6 @@ FPlayerNameBox::FPlayerNameBox(int x, int y, int height, int frameofs, const cha
FPlayerNameBox::~FPlayerNameBox()
{
if (mText != NULL) delete [] mText;
}
//=============================================================================
@ -220,7 +219,7 @@ bool FPlayerNameBox::MenuEvent(int mkey, bool fromcontroller)
FValueTextItem::FValueTextItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, EColorRange valuecolor, FName action, FName values)
: FListMenuItemSelectable(x, y, height, action)
{
mText = copystring(text);
mText = text;
mFont = font;
mFontColor = color;
mFontColor2 = valuecolor;
@ -240,7 +239,6 @@ FValueTextItem::FValueTextItem(int x, int y, int height, const char *text, FFont
FValueTextItem::~FValueTextItem()
{
if (mText != NULL) delete [] mText;
}
//=============================================================================
@ -341,7 +339,7 @@ void FValueTextItem::Drawer(bool selected)
FSliderItem::FSliderItem(int x, int y, int height, const char *text, FFont *font, EColorRange color, FName action, int min, int max, int step)
: FListMenuItemSelectable(x, y, height, action)
{
mText = copystring(text);
mText = text;
mFont = font;
mFontColor = color;
mSelection = 0;
@ -352,7 +350,6 @@ FSliderItem::FSliderItem(int x, int y, int height, const char *text, FFont *font
FSliderItem::~FSliderItem()
{
if (mText != NULL) delete [] mText;
}
//=============================================================================