summaryrefslogtreecommitdiff
path: root/src/name_string_util.c
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-04-05 18:41:42 -0700
committerMarcus Huderle <huderlem@gmail.com>2018-04-05 18:41:42 -0700
commit66367c82ef07c10957d45ce7f0f776a178454e18 (patch)
tree0dd4fcd5cce3ef14dae4fc9ae91e54c6e070eef6 /src/name_string_util.c
parent171dd32df8a56e1f10956be8b944cb216edb8f9d (diff)
parent781d0ca44c8eab2b7751fe8f337d6acde7fe8582 (diff)
Merge remote-tracking branch 'upstream/master' into btl_attrs
Diffstat (limited to 'src/name_string_util.c')
-rw-r--r--src/name_string_util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/name_string_util.c b/src/name_string_util.c
new file mode 100644
index 000000000..32e9358e1
--- /dev/null
+++ b/src/name_string_util.c
@@ -0,0 +1,40 @@
+#include "global.h"
+#include "name_string_util.h"
+#include "string_util.h"
+#include "text.h"
+
+void PadNameString(u8 *a1, u8 a2)
+{
+ u8 i;
+
+ Text_StripExtCtrlCodes(a1);
+ i = StringLength(a1);
+
+ if (a2 == 0xFC)
+ {
+ while (i < 6)
+ {
+ a1[i] = 0xFC;
+ a1[i + 1] = 7;
+ i += 2;
+ }
+ }
+ else
+ {
+ while (i < 6)
+ {
+ a1[i] = a2;
+ i++;
+ }
+ }
+
+ a1[i] = EOS;
+}
+
+void SanitizeNameString(u8 *a1)
+{
+ if (StringLength(a1) < 6)
+ ConvertInternationalString(a1, 1);
+ else
+ Text_StripExtCtrlCodes(a1);
+}