Skip to content

Commit 9f0af9a

Browse files
committed
sadfasdfrasdrtdfsafgasd
1 parent 549c9c4 commit 9f0af9a

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
build-config: 'RelWithDebInfo'
4141
export-pdb: true
4242
combine: true
43-
sdk: 'nightly'
43+
# sdk: 'nightly'
4444
target: ${{ matrix.config.target }}
4545

4646
package:

src/UI/TransAlertLayer.cpp

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "TransAlertLayer.hpp"
22
#include "TransLabelBMFont.hpp"
33
#include "../Utils/TranslationManager.hpp"
4+
#include <regex>
45

56
bool TransAlertLayer::init(char const* title, const gd::string& desc, char const* btn)
67
{
@@ -10,17 +11,7 @@ bool TransAlertLayer::init(char const* title, const gd::string& desc, char const
1011

1112
bool useTtf = false;
1213

13-
for (auto letter : desc2)
14-
{
15-
if (letter == '\n')
16-
continue;
17-
18-
if (!label->getConfiguration()->getCharacterSet()->contains(as<int>(letter)))
19-
{
20-
useTtf = true;
21-
break;
22-
}
23-
}
14+
useTtf = !std::regex_match(desc2, std::regex("^[a-zA-Z0-9\\s]*$"));
2415

2516
if (useTtf)
2617
{

src/UI/TransLabelBMFont.cpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "TransLabelBMFont.hpp"
22
#include "../Utils/Utils.hpp"
33
#include "../Utils/TranslationManager.hpp"
4+
#include <regex>
45

56
/*
67
@@ -122,14 +123,7 @@ void TransLabelBMFont::updateTTFVisible()
122123
}
123124
else
124125
{
125-
for (auto letter : this->text)
126-
{
127-
if (!label->getConfiguration()->getCharacterSet()->contains(as<int>(letter)))
128-
{
129-
useTtf = true;
130-
break;
131-
}
132-
}
126+
useTtf = !std::regex_match(text, std::regex("^[a-zA-Z0-9\\s]*$"));
133127
}
134128

135129
label->setString(text.c_str());

0 commit comments

Comments
 (0)