diff options
author | Strangerke | 2016-07-29 23:17:51 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 16c3757dcddeeff00b8d66e1d3308b59c8c62098 (patch) | |
tree | 9008617e797c7b863f3b0261ee3551692e2ee72e /engines/dm | |
parent | ba46060b13e7106e524fd1a56086e4e88c0b9fb4 (diff) | |
download | scummvm-rg350-16c3757dcddeeff00b8d66e1d3308b59c8c62098.tar.gz scummvm-rg350-16c3757dcddeeff00b8d66e1d3308b59c8c62098.tar.bz2 scummvm-rg350-16c3757dcddeeff00b8d66e1d3308b59c8c62098.zip |
DM: Refactor f426_isMessageOnTwoLines
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/dialog.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp index 6a99ee5505..fc610c6ff7 100644 --- a/engines/dm/dialog.cpp +++ b/engines/dm/dialog.cpp @@ -145,21 +145,17 @@ void DialogMan::f425_printCenteredChoice(byte* bitmap, char* str, int16 posX, in } bool DialogMan::f426_isMessageOnTwoLines(char* str, char* part1, char* part2) { - uint16 L1305_ui_StringLength; - uint16 L1306_ui_SplitPosition; - - - L1305_ui_StringLength = strlen(str); - if (L1305_ui_StringLength <= 30) { + uint16 strLength = strlen(str); + if (strLength <= 30) return false; - } + strcpy(part1, str); - L1306_ui_SplitPosition = L1305_ui_StringLength >> 1; - while ((part1[L1306_ui_SplitPosition] != ' ') && L1306_ui_SplitPosition < L1305_ui_StringLength) { - L1306_ui_SplitPosition++; - } - part1[L1306_ui_SplitPosition] = '\0'; - strcpy(part2, &part1[L1306_ui_SplitPosition + 1]); + uint16 splitPosition = strLength >> 1; + while ((part1[splitPosition] != ' ') && (splitPosition < strLength)) + splitPosition++; + + part1[splitPosition] = '\0'; + strcpy(part2, &part1[splitPosition + 1]); return true; } } |