瀏覽代碼

Minigame Client verbindet sich jetzt automatisch

Kolja Strohm 5 年之前
父節點
當前提交
8881273f67
共有 4 個文件被更改,包括 56 次插入23 次删除
  1. 3 3
      KSGNetwork/KSGNetwork.vcxproj
  2. 3 3
      KSGNetwork/KSGNetwork.vcxproj.filters
  3. 30 15
      KSGNetwork/MinigameClient.cpp
  4. 20 2
      build.bat

+ 3 - 3
KSGNetwork/KSGNetwork.vcxproj

@@ -71,15 +71,15 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <IncludePath>..\..\..\..\Allgemein\Framework;..\..\..\..\Allgemein\Network\Network;..\..\..\..\Allgemein\GSL\GSL\Include;$(IncludePath)</IncludePath>
-    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Debug;..\..\..\..\Allgemein\Network\x64\Debug;..\..\..\..\Allgemein\GSL\x64\Debug;$(LibraryPath)</LibraryPath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Debug;..\..\..\..\Allgemein\Network\x64\Debug;..\..\..\..\Allgemein\GSL\GSL\x64\Debug;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <IncludePath>..\..\..\..\Allgemein\GSL\GSL\Include;..\..\..\..\Allgemein\Framework;..\..\..\..\Allgemein\Network\Network;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
-    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Release;..\..\..\..\Allgemein\Network\x64\Release;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\..\..\Allgemein\GSL\x64\Release</LibraryPath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\x64\Release;..\..\..\..\Allgemein\Network\x64\Release;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\..\..\Allgemein\GSL\GSL\x64\Release</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <IncludePath>..\..\..\..\Allgemein\GSL\GSL\Include;..\..\..\..\Allgemein\Framework;..\..\..\..\Allgemein\Network\Network;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
-    <LibraryPath>..\..\..\..\Allgemein\Framework\Release;..\..\..\..\Allgemein\Network\Release;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;..\..\..\..\Allgemein\GSL\Release</LibraryPath>
+    <LibraryPath>..\..\..\..\Allgemein\Framework\Release;..\..\..\..\Allgemein\Network\Release;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;..\..\..\..\Allgemein\GSL\GSL\Release</LibraryPath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>

+ 3 - 3
KSGNetwork/KSGNetwork.vcxproj.filters

@@ -21,9 +21,6 @@
     <ClInclude Include="..\Include\KSGNetwork.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
-    <ClInclude Include="Main.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClInclude>
     <ClInclude Include="Keys.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
@@ -119,5 +116,8 @@
     <ClCompile Include="RegisterClient.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="Main.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 30 - 15
KSGNetwork/MinigameClient.cpp

@@ -98,9 +98,12 @@ int MinigameClient::getMinigameOptionList( char *mName, Framework::RCArray< Fram
     cs.lock();
     if( !k )
     {
-        err = "Der Client ist nicht verbunden.";
-        cs.unlock();
-        return 0;
+        if( !verbinde() )
+        {
+            err = "Der Client ist nicht verbunden.";
+            cs.unlock();
+            return 0;
+        }
     }
     k->sendeEncrypted( "\x6", 1 );
     char ret = 0;
@@ -152,9 +155,12 @@ int MinigameClient::getMinigameBestscoreList( char *mName, Framework::Array< int
     cs.lock();
     if( !k )
     {
-        err = "Der Client ist nicht verbunden.";
-        cs.unlock();
-        return 0;
+        if( !verbinde() )
+        {
+            err = "Der Client ist nicht verbunden.";
+            cs.unlock();
+            return 0;
+        }
     }
     k->sendeEncrypted( "\x7", 1 );
     char ret = 0;
@@ -213,9 +219,12 @@ int MinigameClient::getMinigameOptionBestscore( char *mName, char *oName, Framew
     cs.lock();
     if( !k )
     {
-        err = "Der Client ist nicht verbunden.";
-        cs.unlock();
-        return 0;
+        if( !verbinde() )
+        {
+            err = "Der Client ist nicht verbunden.";
+            cs.unlock();
+            return 0;
+        }
     }
     k->sendeEncrypted( "\x8", 1 );
     char ret = 0;
@@ -267,9 +276,12 @@ bool MinigameClient::reportEndOfGame( char *mName, char *oName, int score, Frame
     cs.lock();
     if( !k )
     {
-        err = "Der Client ist nicht verbunden.";
-        cs.unlock();
-        return 0;
+        if( !verbinde() )
+        {
+            err = "Der Client ist nicht verbunden.";
+            cs.unlock();
+            return 0;
+        }
     }
     k->sendeEncrypted( "\x9", 1 );
     char ret = 0;
@@ -335,9 +347,12 @@ Framework::Datei *MinigameClient::downloadGameCapture( char *mName, char *oName
     cs.lock();
     if( !k )
     {
-        err = "Der Client ist nicht verbunden.";
-        cs.unlock();
-        return 0;
+        if( !verbinde() )
+        {
+            err = "Der Client ist nicht verbunden.";
+            cs.unlock();
+            return 0;
+        }
     }
     k->sendeEncrypted( "\xA", 1 );
     char ret = 0;

+ 20 - 2
build.bat

@@ -1,3 +1,21 @@
-"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "KSGNetwork.sln" /p:configuration=release /p:platform=win32
+:DebugWin64
+SET RETURN=DebugWin64
+SET NEXT=ReleaseWin64
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "KSGNetwork.sln" /p:configuration=debug /p:platform=x64
+if errorlevel 1 GOTO Error
+:ReleaseWin64
+SET RETURN=ReleaseWin64
+SET NEXT=ReleaseWin32
 "D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "KSGNetwork.sln" /p:configuration=release /p:platform=x64
-"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "KSGNetwork.sln" /p:configuration=debug /p:platform=x64
+if errorlevel 1 GOTO Error
+:ReleaseWin32
+SET RETURN=ReleaseWin32
+SET NEXT=END
+"D:\Visual Studio 2017\MSBuild\15.0\Bin\MSBuild.exe" "KSGNetwork.sln" /p:configuration=release /p:platform=win32
+if errorlevel 1 GOTO Error
+GOTO End
+:Error
+SET /p redo=Nochmal versuchen?(j/n):
+IF /I '%redo%' equ 'j' GOTO %RETURN%
+GOTO %NEXT%
+:End