Skip to content

Commit 965520e

Browse files
committed
* Server Release Update
1 parent f1f61da commit 965520e

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

src/CSMGameProject/CSMGameServer/CSMGameServer.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@
170170
</PropertyGroup>
171171
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
172172
<LinkIncremental>false</LinkIncremental>
173-
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);Library/zip;Library/MD5;Library/TinyXML;</IncludePath>
173+
<IncludePath>C:\Program Files (x86)\MySQL\MySQL Server 5.5\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);Library/zip;Library/MD5;Library/TinyXML;</IncludePath>
174+
<LibraryPath>C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
174175
</PropertyGroup>
175176
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
176177
<ClCompile>
@@ -204,6 +205,7 @@
204205
<GenerateDebugInformation>true</GenerateDebugInformation>
205206
<EnableCOMDATFolding>true</EnableCOMDATFolding>
206207
<OptimizeReferences>true</OptimizeReferences>
208+
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winmm.lib;DbgHelp.lib</AdditionalDependencies>
207209
</Link>
208210
</ItemDefinitionGroup>
209211
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

src/CSMGameProject/CSMGameServer/ClientSession.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "PlayerManager.h"
99
#include "ClientManager.h"
1010
#include "DBCommand.h"
11+
#include "GameManager.h"
1112
bool ClientSession::OnConnect(SOCKADDR_IN* addr)
1213
{
1314
memcpy( &mClientAddr, addr, sizeof(SOCKADDR_IN) );
@@ -79,7 +80,8 @@ void ClientSession::Disconnect()
7980

8081
::shutdown(mSocket, SD_BOTH);
8182
::closesocket(mSocket);
82-
83+
84+
GGameManager->LogOutPlayer(mPlayerId);
8385
sprintf_s(query,"DELETE FROM tbl_player WHERE user_id=%d",mPlayerId);
8486
ExcuteNonQuery(query);
8587
//mysql_close(GMYSQLConnection);

src/CSMGameProject/CSMGameServer/GameManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void GameManager::LogOutPlayer(int playerId)
7272
int gameId =GPlayerManager->GetPlayer(playerId)->GetGameId();
7373
int team = GPlayerManager->GetPlayer(playerId)->GetTeam();
7474
mPlayerCount[gameId][team]--;
75+
7576
}
7677

7778
void GameManager::EndOfGame(int gameId, int team)

src/CSMGameProject/CSMGameServer/Main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ int _tmain(int argc, _TCHAR* argv[])
3535
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
3636
//_CrtSetBreakAlloc( 45402 );
3737
#endif
38+
HANDLE hMutex = CreateMutex( NULL, FALSE, _T("CSMServer") );
39+
if( hMutex == NULL ) {
40+
return false;
41+
}
3842
/// crash 발생시 dump 남기기 위해서
3943
SetUnhandledExceptionFilter(ExceptionFilter) ;
4044

src/CSMGameProject/CSMGameServer/Player.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "GameMap.h"
99

10+
#define _CRT_SECURE_NO_WARNING
11+
1012
Player::Player(void):mPosition(0,0),mPlayerState(PLAYER_STATE_IDLE)
1113
{
1214
}
@@ -72,7 +74,6 @@ Player::Player(int gameId, int playerId, ClientSession* client)
7274
Player::~Player(void)
7375
{
7476
//소멸자가 제대로 호출 안될 수도 있을거같은데..
75-
GGameManager->LogOutPlayer(mTeam);
7677
}
7778

7879
void Player::TransState(short state)
@@ -586,7 +587,7 @@ PlayerInfo Player::GetPlayerInfo()
586587
mPlayerInfo.mTeam = mTeam;
587588
mPlayerInfo.mType = mType;
588589
mPlayerInfo.mKillScore = mKillScore;
589-
wcscpy(mPlayerInfo.mName,mName.c_str());
590+
wcsncpy_s(mPlayerInfo.mName,sizeof(mPlayerInfo.mName),mName.c_str(),mName.size());
590591
return mPlayerInfo;
591592
}
592593

0 commit comments

Comments
 (0)