From 863dea4e8693047a60da115531e7403997b1ce98 Mon Sep 17 00:00:00 2001
From: Guilherme Menaldo <guilherme.menaldo@outlook.com>
Date: Sun, 27 Oct 2019 19:48:03 -0300
Subject: Makes HULD .po files read \r as a control character

This fixes loading .po files of NPCs that has multi-line mes split with \r.
---
 src/map/script.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/map/script.c b/src/map/script.c
index bd0fbb611..6b2f0bfbe 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5400,6 +5400,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id)
 					if (line[i] == '\\' && line[i+1] == '"') {
 						VECTOR_PUSH(*msg_ptr, '"');
 						i++;
+					} else if (line[i] == '\\' && line[i+1] == 'r') {
+						VECTOR_PUSH(*msg_ptr, '\r');
+						i++;
 					} else {
 						VECTOR_PUSH(*msg_ptr, line[i]);
 					}
@@ -5418,6 +5421,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id)
 				if (line[i] == '\\' && line[i+1] == '"') {
 					msgctxt[cursor] = '"';
 					i++;
+				} else if (line[i] == '\\' && line[i+1] == 'r') {
+					msgctxt[cursor] = '\r';
+					i++;
 				} else {
 					msgctxt[cursor] = line[i];
 				}
@@ -5439,6 +5445,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id)
 				if (line[i] == '\\' && line[i+1] == '"') {
 					VECTOR_PUSH(msgid, '"');
 					i++;
+				} else if (line[i] == '\\' && line[i+1] == 'r') {
+					VECTOR_PUSH(msgid, '\r');
+					i++;
 				} else {
 					VECTOR_PUSH(msgid, line[i]);
 				}
@@ -5458,6 +5467,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id)
 				if (line[i] == '\\' && line[i+1] == '"') {
 					VECTOR_PUSH(msgstr, '"');
 					i++;
+				} else if (line[i] == '\\' && line[i+1] == 'r') {
+					VECTOR_PUSH(msgstr, '\r');
+					i++;
 				} else {
 					VECTOR_PUSH(msgstr, line[i]);
 				}
-- 
cgit v1.2.3-70-g09d2