diff --git a/src/menu/menu.h b/src/menu/menu.h index aa4058f87..04ae7e3f7 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -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 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; } diff --git a/src/menu/optionmenu.cpp b/src/menu/optionmenu.cpp index f6633c76a..efea7d910 100644 --- a/src/menu/optionmenu.cpp +++ b/src/menu/optionmenu.cpp @@ -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; diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index ec1ad5832..76718809e 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -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; diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index cf63283ba..ce542c2f2 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -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; } //=============================================================================