summaryrefslogtreecommitdiff
path: root/src/name_string_util.c
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-03-22 18:34:29 -0400
committeryenatch <yenatch@gmail.com>2017-03-22 18:34:29 -0400
commit7acbfe40778bfbd03b0e2d357efef9ee9b0a34e9 (patch)
tree90c0b95146f3d768b536658eac6a63ff9adcaaec /src/name_string_util.c
parentc0a27d5455014bfe54f7ea73e8a38ce0ed8da6da (diff)
parente3c26e52ae6ab881ade913ca1fad2cd9629bbcb1 (diff)
Merge remote-tracking branch 'origin/master'
Conflicts: Makefile
Diffstat (limited to 'src/name_string_util.c')
-rw-r--r--src/name_string_util.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/name_string_util.c b/src/name_string_util.c
new file mode 100644
index 000000000..a1812d5e9
--- /dev/null
+++ b/src/name_string_util.c
@@ -0,0 +1,39 @@
+#include "global.h"
+#include "string_util.h"
+#include "text.h"
+
+void PadNameString(u8 *a1, u8 a2)
+{
+ u8 i;
+
+ 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
+ StripExtCtrlCodes(a1);
+}