Network stuff and Utils Engine

This commit is contained in:
vladislav.khorev committed 2013-02-19 12:37:56 +00:00
1 parent 9627247bdc
commit 06652bfa0d
10 files changed
+42 -13

No files matched your search

+3
View File
@@ -12,6 +12,8 @@ const int CONST_ROW_WIDTH = 14;
const std::string CONST_CONSOLE_TEX_NAME = "console_bkg.bmp";
#ifndef UTILS_ENGINE
void TSimpleConsole::Draw()
{
@@ -59,6 +61,7 @@ void TSimpleConsole::Draw()
}
#endif
void TSimpleConsole::CutHistory()
{
+4 -4
View File
@@ -93,7 +93,7 @@ TSimpleAuthorization::TSimpleAuthorization(boost::asio::io_service& ioService, b
void TSimpleAuthorization::Authorize()
{
std::shared_ptr<TDataReader> dataReader(new TDataReader(Socket));
boost::shared_ptr<TDataReader> dataReader(new TDataReader(Socket));
dataReader->DataReadSignal.connect(boost::bind(&TSimpleAuthorization::HandleGetData, this, _1));
@@ -115,8 +115,8 @@ void TSimpleAuthorization::HandleGetData(boost::property_tree::ptree pTree)
{
if (pTree.find("OnHello") != pTree.not_found())
{
Login = p.get<std::string>("OnHello.Login");
Password = p.get<std::string>("OnHello.Password");
Login = pTree.get<std::string>("OnHello.Login");
Password = pTree.get<std::string>("OnHello.Password");
SaveLoginPasswordSignal(Login, Password);
AuthorizedSignal();
@@ -172,7 +172,7 @@ void TClientSocket::Open(const std::string address, const std::string& port)
return;
}
boost::asio::async_connect(Socket, iterator, boost::bind(&TClientSocket::HandleConnect, shared_from_this(), boost::asio::placeholders::error));
boost::asio::async_connect(Socket, iterator, boost::bind(&TClientSocket::HandleConnect, this, boost::asio::placeholders::error));
ConnectionTimeoutTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(CONST_CONNECTION_TIMEOUT_SECONDS)));
@@ -53,7 +53,11 @@ boost::property_tree::ptree::iterator ReplaceIncludeFile(boost::property_tree::p
}
}
#ifdef UTILS_ENGINE
xmlFileArr = CreateMemFromFile<char>(fileName, xmlFileSize);
#else
xmlFileArr = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, xmlFileSize);
#endif
std::string xmlString = std::string(&xmlFileArr[0], &xmlFileArr[xmlFileSize]);
@@ -143,7 +147,11 @@ std::shared_ptr<boost::property_tree::ptree> FileToPropertyTree(const std::strin
{
cardinal byteCount;
#ifdef UTILS_ENGINE
boost::shared_array<char> file = CreateMemFromFile<char>(fileName, byteCount);
#else
boost::shared_array<char> file = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, byteCount);
#endif
return FileToPropertyTree(file, byteCount, replaceMap);
}
+2
View File
@@ -3,6 +3,7 @@
namespace SE
{
#ifndef UTILS_ENGINE
void AssertIfInMainThread()
{
if (boost::this_thread::get_id() != ResourceManager->MainThreadId)
@@ -30,5 +31,6 @@ namespace SE
ResourceManager->MainThreadAsyncFunctionArr.push_back(f);
}
}
#endif
} //namespace SE
+6 -6
View File
@@ -8,27 +8,27 @@ Here goes all functions that are platform-specific
When I make iOS/Mac/Linux port, I will make same API pair h/cpp
*/
void GetWindowWidthHeight(int& width, int& height)
void GetWindowWidthHeight(HWND hwnd, int& width, int& height)
{
RECT rc;
GetClientRect(Hwnd, &rc);
GetClientRect(hwnd, &rc);
width = rc.right;
height = rc.bottom;
}
int GetWindowWidth()
int GetWindowWidth(HWND hwnd)
{
RECT rc;
GetClientRect(Hwnd, &rc);
GetClientRect(hwnd, &rc);
return rc.right;
}
int GetWindowHeight()
int GetWindowHeight(HWND hwnd)
{
RECT rc;
GetClientRect(Hwnd, &rc);
GetClientRect(hwnd, &rc);
return rc.bottom;
}