Ejemplo n.º 1
0
/* Checks if a node is in the OpenList
 *   If so, it returns the OpenListNode, else NULL */
static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node)
{
	return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
}
Ejemplo n.º 2
0
LRESULT CALLBACK WndProc(
	HWND hWnd,
	UINT nMessage,
	WPARAM wParam,
	LPARAM lParam
	)
{
	RECT ClientRect;
	switch (nMessage)
	{
	case WM_CREATE_IRC_WINDOW:
		if (Hash_Get(pHash, (char*)wParam))
		{
			ContextIRC.hCurrentWindow = Hash_Get(pHash, (char*)wParam);
		}
		else
		{
			static HWND __hWnd__;
			__hWnd__ = Create_Window(__hWnd__, hWnd);
			if (((char*)wParam)[0] == '#')
			{
				ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE);
				ContextIRC.hCurrentWindow = __hWnd__;
				strArray_Add(ChannelNames, szChannel);
				Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam);
				ShowWindow(Hash_Get(pHash, (char*)wParam), SW_SHOW);
				ResizeWindows(ContextIRC.dwOldWidth, ContextIRC.dwOldHeight);
				SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE);
			}
			else
			{
				ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray));
				ContextIRC.hCurrentWindow = __hWnd__;
				Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam);
				ResizeWindows(ContextIRC.dwOldWidth, ContextIRC.dwOldHeight);
				SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE);
			}
			ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray));
			Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam);
			SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE);
			break;
	}
	case WM_CREATE:
		pArray = Array_Init(pArray);
		ContextIRC.hCurrentWindow = Create_Window(ContextIRC.hCurrentWindow, hWnd);
		ContextIRC.hFont = InitFont(ContextIRC.hCurrentWindow);
		ContextIRC.hTypeBuffer = InitTypeBuffer(ContextIRC.hFont, hWnd);
		ContextIRC.hParentProc = SetWindowLongPtr(ContextIRC.hTypeBuffer, GWL_WNDPROC, (LONG_PTR)TypeBufferProc);
		ContextIRC.hNetworkThread = CreateThread(NULL, 0, Connect, NULL, 0, &ContextIRC.hNetworkThreadID);
		break;
	case WM_DESTROY:
		DestroyContext();
		PostQuitMessage(0);
		break;
	case WM_HOTKEY:
	{
					  register uint32_t nIndex = 0;
					  if (wParam == IRCContext->LeftKey)
					  {
						  if (Array_Num(pArray) <= 0)
							  break;
						  for (nIndex = Array_Num(pArray); nIndex > 0; nIndex--)
						  {
							  if (ContextIRC.hCurrentWindow == Array_Index(pArray, 0))
							  {
								  ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE);
								  ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray));

								  strcpy_s(szChannel, 96, strArray_Index(ChannelNames, strArray_Num(ChannelNames)));
								  
								  ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW);
								  MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE);
								  break;
							  }
							  nIndex--;
							  ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE);
							  ContextIRC.hCurrentWindow = Array_Index(pArray, nIndex);

							  strcpy_s(szChannel, 96, strArray_Index(ChannelNames, nIndex - 1));

							  ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW);
							  MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE);
							  break;
						  }
					  }
					  if (wParam == IRCContext->RightKey)
					  {
						  for (nIndex = 0; nIndex <= Array_Num(pArray); nIndex++)
						  {
							  if (Array_Num(pArray) <= 0)
								  break;
							  if (ContextIRC.hCurrentWindow == Array_Index(pArray, nIndex))
							  {
								  if (ContextIRC.hCurrentWindow == Array_Index(pArray, Array_Num(pArray)))
								  {
									  ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE);
									  ContextIRC.hCurrentWindow = Array_Index(pArray, 0);

									  strcpy_s(szChannel, 96, strArray_Index(ChannelNames, 0));

									  ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW);
									  MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE);
									  break;
								  }
								  nIndex++;
								  ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE);
								  ContextIRC.hCurrentWindow = Array_Index(pArray, nIndex);

								  strcpy_s(szChannel, 96, strArray_Index(ChannelNames, nIndex - 1));

								  ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW);
								  MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE);
								  break;
							  }
						  }
					  }
					  break;
	}
	case WM_SIZE:
		ResizeWindows(LOWORD(lParam), HIWORD(lParam) - IRCContext->nTypeHeight);
		GetClientRect(hWnd, &ClientRect);
		ContextIRC.dwOldWidth = LOWORD(lParam);
		ContextIRC.dwOldHeight = HIWORD(lParam);
		MoveWindow(ContextIRC.hTypeBuffer, 0, ClientRect.bottom - IRCContext->nTypeHeight, LOWORD(lParam), IRCContext->nTypeHeight, TRUE);
		break;
	default:
		return DefWindowProc(hWnd, nMessage, wParam, lParam);
	}
	return 0;
}
Ejemplo n.º 3
0
/* This looks in the Hash if a node exists in ClosedList
 *  If so, it returns the PathNode, else NULL */
static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
{
	return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
}