nact: Change tvar from char array to std::string

This commit is contained in:
kichikuou
2025-06-06 14:51:38 +09:00
parent aef2822bc4
commit 7f527da74f
12 changed files with 50 additions and 57 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ Uint32 custom_event_type = static_cast<Uint32>(-1);
void NACT::text_dialog()
{
static char buf[256];
std::string oldstr = encoding->toUtf8(tvar[tvar_index - 1]);
std::string oldstr = encoding->toUtf8(tvar[tvar_index - 1].c_str());
int ok = EM_ASM_({
var r = xsystem35.shell.inputString("文字列を入力してください", UTF8ToString($0), $1);
if (r) {
@@ -29,7 +29,7 @@ void NACT::text_dialog()
return 0;
}, oldstr.c_str(), tvar_maxlen, buf, sizeof buf);
if (ok) {
strcpy_s(tvar[tvar_index - 1], 22, encoding->fromUtf8(buf).c_str());
tvar[tvar_index - 1] = encoding->fromUtf8(buf);
}
}