mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Initialized many variables
Fix for enemy invasions and reinforcements git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1192 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+31
-27
@@ -645,13 +645,13 @@ void Console::OnVScroll(WPARAM wParam) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) {
|
||||
if ((nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) != 0) {
|
||||
|
||||
nCurrentPos += nDelta;
|
||||
|
||||
SMALL_RECT sr;
|
||||
sr.Top = nCurrentPos;
|
||||
sr.Bottom = nDelta;
|
||||
sr.Top = (short) nCurrentPos;
|
||||
// sr.Bottom = nDelta;
|
||||
sr.Left = sr.Right = 0;
|
||||
m_csbiConsole.srWindow = sr;
|
||||
// ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr);
|
||||
@@ -825,6 +825,7 @@ void Console::OnMButtonDown(UINT uiFlags, POINTS points) {
|
||||
|
||||
void Console::OnMouseMove(UINT uiFlags, POINTS points) {
|
||||
|
||||
#if 0
|
||||
RECT windowRect;
|
||||
int deltaX, deltaY;
|
||||
POINT point;
|
||||
@@ -905,6 +906,7 @@ void Console::OnMouseMove(UINT uiFlags, POINTS points) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -2697,11 +2699,12 @@ void Console::SetWindowSizeAndPosition() {
|
||||
break;
|
||||
}
|
||||
|
||||
HWND hwndZ;
|
||||
HWND hwndZ = 0;
|
||||
switch (m_dwCurrentZOrder) {
|
||||
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
|
||||
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
|
||||
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
|
||||
default : return;
|
||||
}
|
||||
|
||||
::SetWindowPos(
|
||||
@@ -2769,7 +2772,7 @@ BOOL Console::SetTrayIcon(DWORD dwMessage) {
|
||||
if (strToolTip.length() > 63) {
|
||||
strToolTip.resize(59);
|
||||
strToolTip += _T(" ...");
|
||||
DWORD dw = strToolTip.length();
|
||||
// DWORD dw = strToolTip.length();
|
||||
}
|
||||
|
||||
_tcscpy(tnd.szTip, strToolTip.c_str());
|
||||
@@ -2804,7 +2807,7 @@ void Console::EditConfigFile() {
|
||||
// no params, just use the config file
|
||||
strParams = m_strConfigFile;
|
||||
} else {
|
||||
int nPos = strParams.find(_T("%f"));
|
||||
tstring::size_type nPos = strParams.find(_T("%f"));
|
||||
|
||||
if (nPos == tstring::npos) {
|
||||
// no '%f' in editor params, concatenate config file name
|
||||
@@ -3190,8 +3193,8 @@ void Console::InitConsoleWndSize(DWORD dwColumns) {
|
||||
|
||||
SMALL_RECT srConsoleRect;
|
||||
srConsoleRect.Top = srConsoleRect.Left =0;
|
||||
srConsoleRect.Right = dwColumns - 1;
|
||||
srConsoleRect.Bottom= m_dwRows - 1;
|
||||
// srConsoleRect.Right = dwColumns - 1;
|
||||
// srConsoleRect.Bottom= m_dwRows - 1;
|
||||
|
||||
#if 0
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
@@ -3230,8 +3233,8 @@ void Console::ResizeConsoleWindow() {
|
||||
|
||||
SMALL_RECT srConsoleRect;
|
||||
srConsoleRect.Top = srConsoleRect.Left =0;
|
||||
srConsoleRect.Right = m_dwColumns - 1;
|
||||
srConsoleRect.Bottom= m_dwRows - 1;
|
||||
// srConsoleRect.Right = m_dwColumns - 1;
|
||||
// srConsoleRect.Bottom= m_dwRows - 1;
|
||||
|
||||
#if 0
|
||||
// order of setting window size and screen buffer size depends on current and desired dimensions
|
||||
@@ -3311,9 +3314,9 @@ void Console::RepaintWindow() {
|
||||
COLORREF crBkColor = RGB(0, 0, 0);
|
||||
COLORREF crTxtColor = RGB(0, 0, 0);
|
||||
|
||||
int nNewBkMode = TRANSPARENT;
|
||||
COLORREF crNewBkColor = RGB(0, 0, 0);
|
||||
COLORREF crNewTxtColor = RGB(0, 0, 0);
|
||||
// int nNewBkMode = TRANSPARENT;
|
||||
// COLORREF crNewBkColor = RGB(0, 0, 0);
|
||||
// COLORREF crNewTxtColor = RGB(0, 0, 0);
|
||||
|
||||
bool bTextOut = false;
|
||||
|
||||
@@ -3635,7 +3638,7 @@ inline void Console::GetCursorRect(RECT& rectCursor) {
|
||||
auto_ptr<wchar_t> pszLine(new wchar_t[m_csbiCursor.dwCursorPosition.X + 2]);
|
||||
::ZeroMemory(pszLine.get(), (m_csbiCursor.dwCursorPosition.X + 2)*sizeof(wchar_t));
|
||||
|
||||
for (DWORD i = 0; i <= m_csbiCursor.dwCursorPosition.X; ++i) pszLine.get()[i] = m_pScreenBuffer[m_csbiCursor.dwCursorPosition.Y * m_dwColumns + i].Char.UnicodeChar;
|
||||
for (short i = 0; i <= m_csbiCursor.dwCursorPosition.X; ++i) pszLine.get()[i] = m_pScreenBuffer[m_csbiCursor.dwCursorPosition.Y * m_dwColumns + i].Char.UnicodeChar;
|
||||
|
||||
rectLine.left = rectLine.right = 0;
|
||||
rectLine.top = rectLine.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight;
|
||||
@@ -3676,7 +3679,7 @@ inline void Console::DrawCursorBackground(RECT& rectCursor) {
|
||||
GetCursorRect(rectCursor);
|
||||
|
||||
if (m_csbiCursor.dwCursorPosition.Y < m_csbiConsole.srWindow.Top ||
|
||||
m_csbiCursor.dwCursorPosition.Y >= m_csbiConsole.srWindow.Top + m_dwRows) {
|
||||
m_csbiCursor.dwCursorPosition.Y >= m_csbiConsole.srWindow.Top + (SHORT) m_dwRows) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3810,11 +3813,12 @@ void Console::ToggleWindowOnTop() {
|
||||
m_dwCurrentZOrder = m_dwOriginalZOrder;
|
||||
}
|
||||
|
||||
HWND hwndZ;
|
||||
HWND hwndZ = 0;
|
||||
switch (m_dwCurrentZOrder) {
|
||||
case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break;
|
||||
case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break;
|
||||
case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break;
|
||||
default : return;
|
||||
}
|
||||
|
||||
::SetWindowPos(
|
||||
@@ -4098,7 +4102,7 @@ void Console::ShowReadmeFile() {
|
||||
// no params, just use the readme file
|
||||
strParams = m_strReadmeFile;
|
||||
} else {
|
||||
int nPos = strParams.find(_T("%f"));
|
||||
tstring::size_type nPos = strParams.find(_T("%f"));
|
||||
|
||||
if (nPos == tstring::npos) {
|
||||
// no '%f' in editor params, concatenate readme file name
|
||||
@@ -4148,7 +4152,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
|
||||
RECT rectInval;
|
||||
int cursorX;
|
||||
int cursorY;
|
||||
int attr = m_nTextColor + (m_nTextBgColor << 4);
|
||||
WORD attr = (WORD)(m_nTextColor + (m_nTextBgColor << 4));
|
||||
|
||||
cursorX = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder;
|
||||
cursorY = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder;
|
||||
@@ -4183,7 +4187,7 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
|
||||
OnVScroll( SB_LINEUP);
|
||||
}
|
||||
m_csbiCursor.dwCursorPosition.Y--;
|
||||
m_csbiCursor.dwCursorPosition.X = m_dwColumns - 1;
|
||||
m_csbiCursor.dwCursorPosition.X = (SHORT)m_dwColumns - 1;
|
||||
cursorX = m_nCharWidth * m_csbiCursor.dwCursorPosition.X;
|
||||
idx--;
|
||||
}
|
||||
@@ -4196,17 +4200,17 @@ void Console::SendTextToConsole(const wchar_t *pszText) {
|
||||
m_csbiCursor.dwCursorPosition.X++;
|
||||
}
|
||||
|
||||
if (m_csbiCursor.dwCursorPosition.X >= m_dwColumns || *pszText == '\r' || *pszText == '\n' ) {
|
||||
if (m_csbiCursor.dwCursorPosition.X >= (SHORT) m_dwColumns || *pszText == '\r' || *pszText == '\n' ) {
|
||||
m_csbiCursor.dwCursorPosition.X = 0;
|
||||
cursorX = m_nInsideBorder;
|
||||
if (*pszText != '\r') {
|
||||
m_csbiCursor.dwCursorPosition.Y++;
|
||||
if (m_csbiCursor.dwCursorPosition.Y >= m_dwBufferRows) {
|
||||
if (m_csbiCursor.dwCursorPosition.Y >= (SHORT)m_dwBufferRows) {
|
||||
m_csbiCursor.dwCursorPosition.Y--;
|
||||
idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns;
|
||||
::CopyMemory( m_pScreenBufferNew, m_pScreenBufferNew + m_dwColumns, idx * sizeof( CHAR_INFO));
|
||||
::ZeroMemory( m_pScreenBufferNew + idx, m_dwColumns * sizeof( CHAR_INFO));
|
||||
} else if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top + m_dwRows) {
|
||||
} else if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top + (SHORT)m_dwRows) {
|
||||
OnVScroll( SB_LINEDOWN);
|
||||
} else {
|
||||
cursorY += m_nCharHeight;
|
||||
@@ -4429,7 +4433,7 @@ LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||
#endif
|
||||
|
||||
case WM_CHAR:
|
||||
myself->OnChar( wParam);
|
||||
myself->OnChar( (WORD) wParam);
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
@@ -4511,12 +4515,12 @@ DWORD WINAPI Console::MonitorThreadStatic(LPVOID lpParam) {
|
||||
DWORD Console::MonitorThread() {
|
||||
|
||||
// HANDLE arrHandles[] = {m_hConsoleProcess, m_hQuitEvent, m_hStdOut};
|
||||
HANDLE arrHandles[] = { m_hStdOut};
|
||||
// HANDLE arrHandles[] = { m_hStdOut};
|
||||
|
||||
while (1) {
|
||||
for (;;) { // Infinite loop
|
||||
#if 0
|
||||
DWORD dwWait = ::WaitForMultipleObjects(1, arrHandles, FALSE, INFINITE);
|
||||
|
||||
#if 0
|
||||
if (dwWait == WAIT_OBJECT_0) {
|
||||
::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
@@ -4532,7 +4536,7 @@ DWORD Console::MonitorThread() {
|
||||
// }
|
||||
}
|
||||
|
||||
return 0;
|
||||
// return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user