Skip to content

Commit 056db9b

Browse files
committed
thcrap_tasofro: pl: fix child versions of parseCommand not being called
Commit 068829b changed a parameter for AText::parseCommand from an int to a size_t. But it didn't apply the same changes to StoryText::parseCommand and Th155StoryText::parseCommand, which were overriding that function. Because of that, the 2 functions from the child classes were no longer overriding the one from the parent class. Fixes an issue in th145 where only the last line of dialog balloons was displayed, and may fix #286
1 parent f851ce4 commit 056db9b

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

thcrap_tasofro/src/pl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ bool TasofroPl::AText::parseCommand(json_t *patch, size_t json_line_num)
493493
return false;
494494
}
495495

496-
bool TasofroPl::StoryText::parseCommand(json_t *patch, int json_line_num)
496+
bool TasofroPl::StoryText::parseCommand(json_t *patch, size_t json_line_num)
497497
{
498498
bool ret = this->AText::parseCommand(patch, json_line_num);
499499
if (ret == false) {
@@ -504,7 +504,7 @@ bool TasofroPl::StoryText::parseCommand(json_t *patch, int json_line_num)
504504
return ret;
505505
}
506506

507-
bool TasofroPl::Th155StoryText::parseCommand(json_t *patch, int json_line_num)
507+
bool TasofroPl::Th155StoryText::parseCommand(json_t *patch, size_t json_line_num)
508508
{
509509
// Overwrite the StoryText overwrite and go back to the standard behavior
510510
return this->AText::parseCommand(patch, json_line_num);

thcrap_tasofro/src/pl.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ namespace TasofroPl
131131
class StoryText : public AText
132132
{
133133
protected:
134-
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
135-
bool parseCommand(json_t *patch, int json_line_num);
136-
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
137-
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
138-
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
134+
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
135+
bool parseCommand(json_t *patch, size_t json_line_num) override;
136+
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
137+
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
138+
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
139139

140140
public:
141141
StoryText(const std::vector<std::string>& fields, const std::string& comment = "");
@@ -145,9 +145,9 @@ namespace TasofroPl
145145
class Th155StoryText : public StoryText
146146
{
147147
protected:
148-
bool parseCommand(json_t *patch, int json_line_num);
149-
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
150-
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
148+
bool parseCommand(json_t *patch, size_t json_line_num) override;
149+
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
150+
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
151151

152152
public:
153153
Th155StoryText(const std::vector<std::string>& fields, const std::string& comment = "");
@@ -157,7 +157,7 @@ namespace TasofroPl
157157
class Th155_110StoryText : public Th155StoryText
158158
{
159159
protected:
160-
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
160+
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
161161

162162
public:
163163
Th155_110StoryText(const std::vector<std::string>& fields, const std::string& comment = "");
@@ -170,11 +170,11 @@ namespace TasofroPl
170170
bool is_staffroll;
171171

172172
protected:
173-
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
174-
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
175-
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
176-
void endLine();
177-
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
173+
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
174+
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
175+
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
176+
void endLine() override;
177+
void _patchExit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
178178

179179
public:
180180
EndingText(const std::vector<std::string>& fields, const std::string& comment = "");
@@ -184,9 +184,9 @@ namespace TasofroPl
184184
class WinText : public AText
185185
{
186186
protected:
187-
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it);
188-
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
189-
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it);
187+
void _patchInit(std::list<ALine*>& file, std::list<ALine*>::iterator& file_it) override;
188+
void beginLine(std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
189+
void _patchLine(std::string& text, std::list<ALine*>& file, const std::list<ALine*>::iterator& it) override;
190190

191191
public:
192192
WinText(const std::vector<std::string>& fields, const std::string& comment = "");

0 commit comments

Comments
 (0)