Fixed initialization of Strife dialogs internal structures

Explicit assignment to members, no more memset() on non-PoD types
https://mantis.zdoom.org/view.php?id=317
This commit is contained in:
alexey.lysiuk 2017-02-21 22:36:20 +02:00
parent bb6e667f33
commit bdd20d3887
3 changed files with 13 additions and 28 deletions

View file

@ -568,16 +568,6 @@ FStrifeDialogueNode::~FStrifeDialogueNode ()
}
}
//============================================================================
//
// FStrifeDialogueReply :: ~FStrifeDialogueReply
//
//============================================================================
FStrifeDialogueReply::~FStrifeDialogueReply ()
{
}
//============================================================================
//
// FindNode

View file

@ -20,19 +20,19 @@ struct FStrifeDialogueItemCheck
struct FStrifeDialogueNode
{
~FStrifeDialogueNode ();
PClassActor *DropType;
PClassActor *DropType = nullptr;
TArray<FStrifeDialogueItemCheck> ItemCheck;
int ThisNodeNum; // location of this node in StrifeDialogues
int ItemCheckNode; // index into StrifeDialogues
int ThisNodeNum = 0; // location of this node in StrifeDialogues
int ItemCheckNode = 0; // index into StrifeDialogues
PClassActor *SpeakerType;
PClassActor *SpeakerType = nullptr;
FString SpeakerName;
FSoundID SpeakerVoice;
FString Backdrop;
FString Dialogue;
FString Goodbye; // must init to null for binary scripts to work as intended
FStrifeDialogueReply *Children;
FStrifeDialogueReply *Children = nullptr;
FName MenuClassName;
FString UserData;
};
@ -40,13 +40,11 @@ struct FStrifeDialogueNode
// FStrifeDialogueReply holds responses the player can give to the NPC
struct FStrifeDialogueReply
{
~FStrifeDialogueReply ();
FStrifeDialogueReply *Next;
PClassActor *GiveType;
int ActionSpecial;
int Args[5];
int PrintAmount;
FStrifeDialogueReply *Next = nullptr;
PClassActor *GiveType = nullptr;
int ActionSpecial = 0;
int Args[5] = {};
int PrintAmount = 0;
TArray<FStrifeDialogueItemCheck> ItemCheck;
TArray<FStrifeDialogueItemCheck> ItemCheckRequire;
TArray<FStrifeDialogueItemCheck> ItemCheckExclude;
@ -54,9 +52,9 @@ struct FStrifeDialogueReply
FString QuickYes;
FString QuickNo;
FString LogString;
int NextNode; // index into StrifeDialogues
int LogNumber;
bool NeedsGold;
int NextNode = 0; // index into StrifeDialogues
int LogNumber = 0;
bool NeedsGold = false;
};
extern TArray<FStrifeDialogueNode *> StrifeDialogues;

View file

@ -121,7 +121,6 @@ class USDFParser : public UDMFParserBase
bool ParseChoice(FStrifeDialogueReply **&replyptr)
{
FStrifeDialogueReply *reply = new FStrifeDialogueReply;
memset(reply, 0, sizeof(*reply));
reply->Next = *replyptr;
*replyptr = reply;
@ -293,8 +292,6 @@ class USDFParser : public UDMFParserBase
{
FStrifeDialogueNode *node = new FStrifeDialogueNode;
FStrifeDialogueReply **replyptr = &node->Children;
memset(node, 0, sizeof(*node));
//node->ItemCheckCount[0] = node->ItemCheckCount[1] = node->ItemCheckCount[2] = -1;
node->ThisNodeNum = StrifeDialogues.Push(node);
node->ItemCheckNode = -1;