mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
- use an FString to store the source for DHUDMessage
This commit is contained in:
parent
a675e4add8
commit
46473b45da
2 changed files with 7 additions and 23 deletions
|
@ -208,28 +208,13 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
|
|||
|
||||
TextColor = textColor;
|
||||
State = 0;
|
||||
SourceText = copystring (text);
|
||||
SourceText = text;
|
||||
VisibilityFlags = 0;
|
||||
Style = STYLE_Translucent;
|
||||
Alpha = 1.;
|
||||
ResetText (SourceText);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// DHUDMessage Destructor
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void DHUDMessage::OnDestroy()
|
||||
{
|
||||
if (SourceText != NULL)
|
||||
{
|
||||
delete[] SourceText;
|
||||
SourceText = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// DHUDMessage :: Serialize
|
||||
|
@ -263,7 +248,7 @@ void DHUDMessage::Serialize(FSerializer &arc)
|
|||
|
||||
if (arc.isReading())
|
||||
{
|
||||
ResetText(SourceText);
|
||||
ResetText(SourceText.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +262,7 @@ void DHUDMessage::ScreenSizeChanged ()
|
|||
{
|
||||
if (HUDWidth == 0)
|
||||
{
|
||||
ResetText (SourceText);
|
||||
ResetText (SourceText.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ class DHUDMessage : public DHUDMessageBase
|
|||
public:
|
||||
DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
|
||||
EColorRange textColor, float holdTime);
|
||||
virtual void OnDestroy () override;
|
||||
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
|
||||
|
@ -125,7 +124,7 @@ public:
|
|||
void SetNoWrap(bool nowrap)
|
||||
{
|
||||
NoWrap = nowrap;
|
||||
ResetText(SourceText);
|
||||
ResetText(SourceText.GetChars());
|
||||
}
|
||||
void SetClipRect(int x, int y, int width, int height, bool aspect)
|
||||
{
|
||||
|
@ -138,7 +137,7 @@ public:
|
|||
void SetWrapWidth(int wrap)
|
||||
{
|
||||
WrapWidth = wrap;
|
||||
ResetText(SourceText);
|
||||
ResetText(SourceText.GetChars());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -160,10 +159,10 @@ protected:
|
|||
double Alpha;
|
||||
|
||||
void CalcClipCoords(int hudheight);
|
||||
DHUDMessage () : SourceText(NULL) {}
|
||||
DHUDMessage() = default;
|
||||
|
||||
private:
|
||||
char *SourceText;
|
||||
FString SourceText;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue