@@ -138,12 +138,12 @@ class DynRpgText : public Drawable {
138
138
std::vector<uint8_t > Save (const std::string& id) {
139
139
std::stringstream ss;
140
140
ss << x << " ," << y << " ," ;
141
- for (size_t i = 0 ; i < texts.size (); ++i) {
141
+ for (int i = 0 ; i < static_cast < int >( texts.size () ); ++i) {
142
142
std::string t = texts[i];
143
143
// Replace , with a sentinel 0x01 to not mess up the tokenizer
144
144
std::replace (t.begin (), t.end (), ' ,' , ' \1 ' );
145
145
ss << t;
146
- if (i < texts.size () - 1 ) {
146
+ if (i < static_cast < int >( texts.size () ) - 1 ) {
147
147
ss << " \n " ;
148
148
}
149
149
@@ -399,14 +399,23 @@ static bool RemoveAll(dyn_arg_list) {
399
399
return true ;
400
400
}
401
401
402
- void DynRpg::TextPlugin::RegisterFunctions () {
403
- DynRpg::RegisterFunction (" write_text" , WriteText);
404
- DynRpg::RegisterFunction (" append_line" , AppendLine);
405
- DynRpg::RegisterFunction (" append_text" , AppendText);
406
- DynRpg::RegisterFunction (" change_text" , ChangeText);
407
- DynRpg::RegisterFunction (" change_position" , ChangePosition);
408
- DynRpg::RegisterFunction (" remove_text" , RemoveText);
409
- DynRpg::RegisterFunction (" remove_all" , RemoveAll);
402
+ bool DynRpg::TextPlugin::Invoke (StringView func, dyn_arg_list args, bool &, Game_Interpreter*) {
403
+ if (func == " write_text" ) {
404
+ return WriteText (args);
405
+ } else if (func == " append_line" ) {
406
+ return AppendLine (args);
407
+ } else if (func == " append_text" ) {
408
+ return AppendText (args);
409
+ } else if (func == " change_text" ) {
410
+ return ChangeText (args);
411
+ } else if (func == " change_position" ) {
412
+ return ChangePosition (args);
413
+ } else if (func == " remove_text" ) {
414
+ return RemoveText (args);
415
+ } else if (func == " remove_all" ) {
416
+ return RemoveAll (args);
417
+ }
418
+ return false ;
410
419
}
411
420
412
421
void DynRpg::TextPlugin::Update () {
0 commit comments