summaryrefslogtreecommitdiffstats
path: root/src/text/Messages.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2020-10-24 20:56:04 +0200
committererorcun <erorcunerorcun@hotmail.com.tr>2020-10-25 00:21:18 +0200
commitde09a80a357dbfdba2a5272c2181b6c5726f4c79 (patch)
tree08ea9aae161b863400f4be13e06b7c9c679c6c17 /src/text/Messages.cpp
parentFix WindModifiers (diff)
downloadre3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar.gz
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar.bz2
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar.lz
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar.xz
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.tar.zst
re3-de09a80a357dbfdba2a5272c2181b6c5726f4c79.zip
Diffstat (limited to '')
-rw-r--r--src/text/Messages.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp
index a2409289..db0865ae 100644
--- a/src/text/Messages.cpp
+++ b/src/text/Messages.cpp
@@ -71,7 +71,7 @@ CMessages::WideStringCompare(wchar *str1, wchar *str2, uint16 size)
if (len1 != len2 && (len1 < size || len2 < size))
return false;
- for (int32 i = 0; FixupChar(str1[i]) != '\0' && i < size; i++) {
+ for (int32 i = 0; i < size && FixupChar(str1[i]) != '\0'; i++) {
if (FixupChar(str1[i]) != FixupChar(str2[i]))
return false;
}
@@ -99,13 +99,9 @@ CMessages::Process()
if (BriefMessages[0].m_pText != nil && CTimer::GetTimeInMilliseconds() > BriefMessages[0].m_nTime + BriefMessages[0].m_nStartTime) {
BriefMessages[0].m_pText = nil;
- int32 i = 0;
- while (i < NUMBRIEFMESSAGES-1) {
- if (BriefMessages[i + 1].m_pText == nil)
- break;
-
+ int32 i;
+ for (i = 0; i < NUMBRIEFMESSAGES-1 && BriefMessages[i + 1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
- i++;
}
CMessages::BriefMessages[i].m_pText = nil;
CMessages::BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();
@@ -328,7 +324,7 @@ void
CMessages::AddToPreviousBriefArray(wchar *text, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, wchar *string)
{
int32 i;
- for (i = 0; PreviousBriefs[i].m_pText && i < NUMPREVIOUSBRIEFS; i++) {
+ for (i = 0; i < NUMPREVIOUSBRIEFS && PreviousBriefs[i].m_pText != nil; i++) {
if (PreviousBriefs[i].m_nNumber[0] == n1
&& PreviousBriefs[i].m_nNumber[1] == n2
&& PreviousBriefs[i].m_nNumber[2] == n3
@@ -505,7 +501,7 @@ CMessages::AddMessageWithNumber(wchar *str, uint32 time, uint16 flag, int32 n1,
GetWideStringLength(outstr);
uint16 i = 0;
- while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText)
+ while (i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil)
i++;
if (i >= NUMBRIEFMESSAGES) return;
@@ -722,35 +718,24 @@ CMessages::ClearThisPrint(wchar *str)
do {
equal = false;
- uint16 i = 0;
- while (i < NUMBRIEFMESSAGES) {
- if (BriefMessages[i].m_pText == nil)
- break;
-
+ uint16 i;
+ for (i = 0; i < NUMBRIEFMESSAGES && BriefMessages[i].m_pText != nil; i++) {
equal = FastWideStringComparison(str, BriefMessages[i].m_pText);
if (equal) break;
- i++;
}
if (equal) {
if (i != 0) {
BriefMessages[i].m_pText = nil;
- while (i < NUMBRIEFMESSAGES-1) {
- if (BriefMessages[i + 1].m_pText == nil)
- break;
-
+ for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
- i++;
}
BriefMessages[i].m_pText = nil;
} else {
BriefMessages[0].m_pText = nil;
- while (i < NUMBRIEFMESSAGES-1) {
- if (BriefMessages[i + 1].m_pText == nil)
- break;
+ for (; i < NUMBRIEFMESSAGES-1 && BriefMessages[i+1].m_pText != nil; i++) {
BriefMessages[i] = BriefMessages[i + 1];
- i++;
}
BriefMessages[i].m_pText = nil;
BriefMessages[0].m_nStartTime = CTimer::GetTimeInMilliseconds();