summaryrefslogtreecommitdiff
path: root/src/engine/name_string_util.c
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-09-30 19:23:55 -0700
committerGitHub <noreply@github.com>2017-09-30 19:23:55 -0700
commit83efcc9c3d1e81b78c2cd9ceab3ac6420a5f4070 (patch)
tree19bbb03916702b468956e82ed2bbe6d259b77a85 /src/engine/name_string_util.c
parent5fb9b9052276243d54ecfc27d0514e9c35825e8c (diff)
parent70c45eb2616195eb47b8bc67d03a1589cd6c56e6 (diff)
Merge pull request #411 from ProjectRevoTPP/refactor_src
split out src/ directory into categorized subdirectories.
Diffstat (limited to 'src/engine/name_string_util.c')
-rw-r--r--src/engine/name_string_util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/engine/name_string_util.c b/src/engine/name_string_util.c
new file mode 100644
index 000000000..f1a935453
--- /dev/null
+++ b/src/engine/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;
+
+ 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);
+}