1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Ouch. Thing was for branch only.

This commit is contained in:
Michał W. Urbańczyk 2011-09-27 22:03:43 +00:00
parent bdd66b6537
commit 623325ca61
21 changed files with 82 additions and 588 deletions

View File

@ -92,7 +92,6 @@
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -1,6 +0,0 @@
bin_PROGRAMS = odpalarka
odpalarka_LDADD = $(top_builddir)/lib/libvcmi.la
odpalarka_CXXFLAGS = @SDL_CXXFLAGS@
odpalarka_LDFLAGS = -L$(top_builddir)/lib
odpalarka_SOURCES = main.cpp

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{27B69211-D138-4142-BBC9-40F5DEA39067}</ProjectGuid>
<RootNamespace>Odpalarka</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,14 +0,0 @@
#include "../global.h"
#include <boost/thread.hpp>
#include <boost/bind.hpp>
int main()
{
boost::thread t(boost::bind(std::system, "VCMI_server.exe b1.json StupidAI StupidAI"));
boost::thread tt(boost::bind(std::system, "VCMI_BattleAiHost.exe"));
boost::thread ttt(boost::bind(std::system, "VCMI_BattleAiHost.exe"));
boost::thread tttt(boost::bind(std::system, "VCMI_BattleAiHost.exe"));
boost::this_thread::sleep(boost::posix_time::seconds(5));
return EXIT_SUCCESS;
}

View File

@ -1,6 +0,0 @@
bin_PROGRAMS = vcmirunner
vcmirunner_LDADD = $(top_builddir)/lib/libvcmi.la
vcmirunner_CXXFLAGS = @SDL_CXXFLAGS@
vcmirunner_LDFLAGS = -L$(top_builddir)/lib
vcmirunner_SOURCES = main.cpp

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6A72AA10-D8CC-4685-A076-368CA64CA7C6}</ProjectGuid>
<RootNamespace>VCMI_BattleAiHost</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VCMI_global.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir);</AdditionalLibraryDirectories>
<AdditionalDependencies>VCMI_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>VCMI_lib.lib;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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>VCMI_lib.lib;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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>VCMI_lib.lib;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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,82 +0,0 @@
#include "../global.h"
#include "../lib/Connection.h"
#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <fstream>
#include "../StartInfo.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include "../lib/CGameState.h"
#include "../CCallback.h"
#include "../lib/CGameInterface.h"
#include <boost/format.hpp>
using namespace std;
using namespace boost;
std::string NAME = NAME_VER + std::string(" DLL runner");
int main(int argc, char** argv)
{
int pid = -1;
#ifdef _WIN32
pid = GetCurrentProcessId();
#else
pid = getpid();
#endif
logfile = new std::ofstream(("VCMI_Server_log_" + boost::lexical_cast<std::string>(pid) + ".txt").c_str());
try
{
string host = "127.0.0.1";
string port = "3030";
CConnection *serv = NULL;
while(!serv)
{
try
{
tlog0 << "Establishing connection...\n";
serv = new CConnection(host, port, "DLL host");
}
catch(...)
{
tlog1 << "\nCannot establish connection! Retrying within 2 seconds" << std::endl;
boost::this_thread::sleep(boost::posix_time::seconds(2));
}
}
ui8 color;
StartInfo si;
string battleAIName;
*serv >> si >> battleAIName >> color;
assert(si.mode == StartInfo::DUEL);
tlog0 << format("Server wants us to run %s in battle %s as side %d") % battleAIName % si.mapname % color;
CGameState *gs = new CGameState();
gs->init(&si, 0, 0);
CBattleCallback * cbc = new CBattleCallback(gs, color, this);
CBattleGameInterface *ai = CDynLibHandler::getNewBattleAI(battleAIName);
ai->init(cbc);
}
catch(std::exception &e)
{
tlog1 << "Encountered exception: " << e.what() << std::endl;
}
catch(...)
{
tlog1 << "Encountered unknown exception!" << std::endl;
}
return EXIT_SUCCESS;
}

View File

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_client", "client\VCMI_client.vcxproj", "{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_lib", "lib\VCMI_lib.vcxproj", "{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}"
@ -14,12 +14,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StupidAI", "AI\StupidAI\Stu
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_BattleAiHost", "VCMI_BattleAiHost\VCMI_BattleAiHost.vcxproj", "{6A72AA10-D8CC-4685-A076-368CA64CA7C6}"
ProjectSection(ProjectDependencies) = postProject
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Odpalarka", "Odpalarka\Odpalarka.vcxproj", "{27B69211-D138-4142-BBC9-40F5DEA39067}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ERM", "Scripting\ERM\ERM.vcxproj", "{8F202F43-106D-4F63-AD9D-B1D43E803E8C}"
ProjectSection(ProjectDependencies) = postProject
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
@ -30,8 +25,6 @@ Global
Debug|x64 = Debug|x64
RD|Win32 = RD|Win32
RD|x64 = RD|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.Debug|Win32.ActiveCfg = Debug|Win32
@ -42,9 +35,6 @@ Global
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.RD|Win32.Build.0 = RD|Win32
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.RD|x64.ActiveCfg = RD|x64
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.RD|x64.Build.0 = RD|x64
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.Release|Win32.ActiveCfg = RD|x64
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.Release|x64.ActiveCfg = RD|x64
{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}.Release|x64.Build.0 = RD|x64
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Debug|Win32.ActiveCfg = Debug|Win32
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Debug|Win32.Build.0 = Debug|Win32
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Debug|x64.ActiveCfg = Debug|x64
@ -53,9 +43,6 @@ Global
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.RD|Win32.Build.0 = RD|Win32
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.RD|x64.ActiveCfg = RD|x64
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.RD|x64.Build.0 = RD|x64
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Release|Win32.ActiveCfg = RD|x64
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Release|x64.ActiveCfg = RD|x64
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}.Release|x64.Build.0 = RD|x64
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Debug|Win32.ActiveCfg = Debug|Win32
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Debug|Win32.Build.0 = Debug|Win32
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Debug|x64.ActiveCfg = Debug|x64
@ -64,9 +51,6 @@ Global
{8AF697C3-465E-4910-B31B-576A9ECDB309}.RD|Win32.Build.0 = RD|Win32
{8AF697C3-465E-4910-B31B-576A9ECDB309}.RD|x64.ActiveCfg = RD|x64
{8AF697C3-465E-4910-B31B-576A9ECDB309}.RD|x64.Build.0 = RD|x64
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Release|Win32.ActiveCfg = RD|x64
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Release|x64.ActiveCfg = RD|x64
{8AF697C3-465E-4910-B31B-576A9ECDB309}.Release|x64.Build.0 = RD|x64
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Debug|Win32.ActiveCfg = Debug|Win32
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Debug|Win32.Build.0 = Debug|Win32
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Debug|x64.ActiveCfg = Debug|x64
@ -75,9 +59,6 @@ Global
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.RD|Win32.Build.0 = RD|Win32
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.RD|x64.ActiveCfg = RD|x64
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.RD|x64.Build.0 = RD|x64
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Release|Win32.ActiveCfg = RD|x64
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Release|x64.ActiveCfg = RD|x64
{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}.Release|x64.Build.0 = RD|x64
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Debug|Win32.ActiveCfg = Debug|Win32
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Debug|Win32.Build.0 = Debug|Win32
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Debug|x64.ActiveCfg = Debug|x64
@ -86,27 +67,14 @@ Global
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.RD|Win32.Build.0 = RD|Win32
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.RD|x64.ActiveCfg = RD|x64
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.RD|x64.Build.0 = RD|x64
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Release|Win32.ActiveCfg = RD|x64
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Release|x64.ActiveCfg = RD|x64
{15DABC90-234A-4B6B-9EEB-777C4768B82B}.Release|x64.Build.0 = RD|x64
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Debug|Win32.ActiveCfg = Debug|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Debug|Win32.Build.0 = Debug|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Debug|x64.ActiveCfg = Debug|x64
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.RD|Win32.ActiveCfg = Release|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.RD|Win32.Build.0 = Release|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.RD|x64.ActiveCfg = Release|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Release|Win32.ActiveCfg = Release|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Release|Win32.Build.0 = Release|Win32
{6A72AA10-D8CC-4685-A076-368CA64CA7C6}.Release|x64.ActiveCfg = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Debug|Win32.ActiveCfg = Debug|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Debug|Win32.Build.0 = Debug|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Debug|x64.ActiveCfg = Debug|x64
{27B69211-D138-4142-BBC9-40F5DEA39067}.RD|Win32.ActiveCfg = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.RD|Win32.Build.0 = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.RD|x64.ActiveCfg = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Release|Win32.ActiveCfg = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Release|Win32.Build.0 = Release|Win32
{27B69211-D138-4142-BBC9-40F5DEA39067}.Release|x64.ActiveCfg = Release|Win32
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.Debug|Win32.ActiveCfg = Debug|Win32
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.Debug|Win32.Build.0 = Debug|Win32
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.Debug|x64.ActiveCfg = Debug|x64
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.Debug|x64.Build.0 = Debug|x64
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.RD|Win32.ActiveCfg = RD|Win32
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.RD|Win32.Build.0 = RD|Win32
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.RD|x64.ActiveCfg = RD|x64
{8F202F43-106D-4F63-AD9D-B1D43E803E8C}.RD|x64.Build.0 = RD|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

16
b1.json
View File

@ -1,16 +0,0 @@
[
"terType" : 0,
"bfieldType" : 0,
"sides" :
[
{
"side" : 0,
"army" : [[10, 40]]
}
{
"side" : 1,
"army" : [[11, 41]]
}
]
]

View File

@ -124,25 +124,18 @@ void CDefObjInfoHandler::load()
castles[nobj->subid]=nobj;
}
if(vstd::contains(gobjs, 124))
for (int i = 0; i < 8 ; i++)
{
for (int i = 0; i < 8 ; i++)
static const char *holeDefs[] = {"AVLHOLD0.DEF", "AVLHLDS0.DEF", "AVLHOLG0.DEF", "AVLHLSN0.DEF",
"AVLHOLS0.DEF", "AVLHOLR0.DEF", "AVLHOLX0.DEF", "AVLHOLL0.DEF"};
if(i)
{
static const char *holeDefs[] = {"AVLHOLD0.DEF", "AVLHLDS0.DEF", "AVLHOLG0.DEF", "AVLHLSN0.DEF",
"AVLHOLS0.DEF", "AVLHOLR0.DEF", "AVLHOLX0.DEF", "AVLHOLL0.DEF"};
if(i)
{
gobjs[124][i] = new CGDefInfo(*gobjs[124][0]);
gobjs[124][i]->name = holeDefs[i];
}
gobjs[124][i] = new CGDefInfo(*gobjs[124][0]);
gobjs[124][i]->name = holeDefs[i];
}
}
else
{
tlog1 << "No def info for holes!\n";
}
}
CDefObjInfoHandler::~CDefObjInfoHandler()

View File

@ -31,7 +31,6 @@
#include "CMapInfo.h"
#include "BattleState.h"
#include "../lib/JsonNode.h"
#include <boost/algorithm/string/predicate.hpp>
boost::rand48 ran;
class CGObjectInstance;
@ -940,18 +939,9 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
DuelParameters dp;
try
{
if(boost::algorithm::ends_with(scenarioOps->mapname, ".json"))
{
tlog0 << "Loading duel settings from JSON file: " << scenarioOps->mapname << std::endl;
dp = DuelParameters::fromJSON(scenarioOps->mapname);
tlog0 << "JSON file has been succesfully read!\n";
}
else
{
CLoadFile lf(scenarioOps->mapname);
lf >> dp;
success = true;
}
CLoadFile lf(scenarioOps->mapname);
lf >> dp;
success = true;
}
catch(...)
{}
@ -2704,28 +2694,6 @@ DuelParameters::DuelParameters()
bfieldType = 15;
}
DuelParameters DuelParameters::fromJSON(const std::string &fname)
{
DuelParameters ret;
const JsonNode duelData(fname);
ret.terType = duelData["terType"].Float();
ret.bfieldType = duelData["bfieldType"].Float();
BOOST_FOREACH(const JsonNode &n, duelData["sides"].Vector())
{
SideSettings &ss = ret.sides[(int)n["side"].Float()];
int i = 0;
BOOST_FOREACH(const JsonNode &stackNode, n["army"].Vector())
{
ss.stacks[i].type = stackNode.Vector()[0].Float();
ss.stacks[i].count = stackNode.Vector()[1].Float();
i++;
}
}
return ret;
}
TeamState::TeamState()
{
setNodeType(TEAM);

View File

@ -305,8 +305,6 @@ struct DLL_EXPORT DuelParameters
}
} sides[2];
static DuelParameters fromJSON(const std::string &fname);
DuelParameters();
template <typename Handler> void serialize(Handler &h, const int version)
{

View File

@ -271,40 +271,38 @@ void CLodHandler::init(const std::string lodFile, const std::string dirName)
if (!LOD.is_open())
{
tlog1 << "Cannot open " << lodFile << std::endl;
return;
}
else
Uint32 temp;
LOD.seekg(8);
LOD.read((char *)&temp, 4);
totalFiles = SDL_SwapLE32(temp);
LOD.seekg(0x5c, std::ios::beg);
if(!LOD)
{
Uint32 temp;
LOD.seekg(8);
LOD.read((char *)&temp, 4);
totalFiles = SDL_SwapLE32(temp);
LOD.seekg(0x5c, std::ios::beg);
if(!LOD)
{
tlog2 << lodFile << " doesn't store anything!\n";
return;
}
struct LodEntry *lodEntries = new struct LodEntry[totalFiles];
LOD.read((char *)lodEntries, sizeof(struct LodEntry) * totalFiles);
for (unsigned int i=0; i<totalFiles; i++)
{
Entry entry;
initEntry(entry, lodEntries[i].filename);
entry.offset= SDL_SwapLE32(lodEntries[i].offset);
entry.realSize = SDL_SwapLE32(lodEntries[i].uncompressedSize);
entry.size = SDL_SwapLE32(lodEntries[i].size);
entries.insert(entry);
}
delete [] lodEntries;
tlog2 << lodFile << " doesn't store anything!\n";
return;
}
struct LodEntry *lodEntries = new struct LodEntry[totalFiles];
LOD.read((char *)lodEntries, sizeof(struct LodEntry) * totalFiles);
for (unsigned int i=0; i<totalFiles; i++)
{
Entry entry;
initEntry(entry, lodEntries[i].filename);
entry.offset= SDL_SwapLE32(lodEntries[i].offset);
entry.realSize = SDL_SwapLE32(lodEntries[i].uncompressedSize);
entry.size = SDL_SwapLE32(lodEntries[i].size);
entries.insert(entry);
}
delete [] lodEntries;
boost::filesystem::recursive_directory_iterator enddir;
if(boost::filesystem::exists(dirName))
{

View File

@ -408,7 +408,6 @@ CSerializer::CSerializer()
void CSerializer::addStdVecItems(CGameState *gs, LibClasses *lib)
{
assert(gs);
registerVectoredType(&gs->map->objects, &CGObjectInstance::id);
registerVectoredType(&lib->heroh->heroes, &CHero::ID);
registerVectoredType(&lib->creh->creatures, &CCreature::idNumber);

View File

@ -107,7 +107,7 @@ bool & JsonNode::Bool()
return data.Bool;
}
double & JsonNode::Float()
float & JsonNode::Float()
{
setType(DATA_FLOAT);
return data.Float;
@ -140,8 +140,8 @@ const bool & JsonNode::Bool() const
return data.Bool;
}
const double floatDefault = 0;
const double & JsonNode::Float() const
const float floatDefault = 0;
const float & JsonNode::Float() const
{
if (type == DATA_NULL)
return floatDefault;
@ -562,7 +562,7 @@ bool JsonParser::extractFloat(JsonNode &node)
{
assert(input[pos] == '-' || (input[pos] >= '0' && input[pos] <= '9'));
bool negative=false;
double result=0;
float result=0;
if (input[pos] == '-')
{
@ -583,7 +583,7 @@ bool JsonParser::extractFloat(JsonNode &node)
{
//extract fractional part
pos++;
double fractMult = 0.1;
float fractMult = 0.1;
if (input[pos] < '0' || input[pos] > '9')
return error("Decimal part expected!");

View File

@ -28,7 +28,7 @@ private:
union JsonData
{
bool Bool;
double Float;
float Float;
std::string* String;
JsonVector* Vector;
JsonMap* Struct;
@ -60,14 +60,14 @@ public:
//non-const accessors, node will change type on type mismatch
bool & Bool();
double & Float();
float & Float();
std::string & String();
JsonVector & Vector();
JsonMap & Struct();
//const accessors, will cause assertion failure on type mismatch
const bool & Bool() const;
const double & Float() const;
const float & Float() const;
const std::string & String() const;
const JsonVector & Vector() const;
const JsonMap & Struct() const;

View File

@ -1213,6 +1213,12 @@ void CGameHandler::run(bool resume)
boost::thread(boost::bind(&CGameHandler::handleConnection,this,pom,boost::ref(**i)));
}
if(gs->scenarioOps->mode == StartInfo::DUEL)
{
runBattle();
return;
}
while (!end2)
{
if(!resume)

View File

@ -335,6 +335,7 @@ CGameHandler * CVCMIServer::initGhFromHostingConnection(CConnection &c)
c << ui8(0); //OK!
}
gh->init(&si,std::time(NULL));
c.addStdVecItems(gh->gs);
gh->conns.insert(&c);
@ -498,51 +499,6 @@ void CVCMIServer::loadGame()
gh.run(true);
}
void CVCMIServer::startDuel(const std::string &battle, const std::string &leftAI, const std::string &rightAI)
{
//we need three connections
CConnection *conns[3] = {0};
for (int i = 0; i < 3 ; i++)
{
boost::system::error_code error;
tcp::socket * s = new tcp::socket(acceptor->get_io_service());
acceptor->accept(*s, error);
if (error)
{
tlog2<<"Got connection but there is an error " << std::endl << error;
i--;
delNull(s);
}
else
{
tlog0<<"We've accepted someone... " << std::endl;
conns[i] = new CConnection(s, NAME);
tlog0<<"Got connection!" << std::endl;
}
}
StartInfo si;
si.mode = StartInfo::DUEL;
si.mapname = battle;
CGameHandler *gh = new CGameHandler();
gh->init(&si,std::time(NULL));
BOOST_FOREACH(CConnection *c, conns)
{
c->addStdVecItems(gh->gs, VLC);
gh->connections[gh->conns.size()] = c;
gh->conns.insert(c);
}
gh->runBattle();
delNull(gh);
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
exit(0);
}
#ifndef __GNUC__
int _tmain(int argc, _TCHAR* argv[])
#else
@ -567,9 +523,6 @@ int main(int argc, char** argv)
{
io_service io_service;
CVCMIServer server;
assert(argc == 4);
server.startDuel(argv[1], argv[2], argv[3]);
while(!end2)
{
server.start();

View File

@ -54,7 +54,6 @@ public:
~CVCMIServer(); //d-tor
void start();
void startDuel(const std::string &battle, const std::string &leftAI, const std::string &rightAI);
CGameHandler *initGhFromHostingConnection(CConnection &c);
void newGame();

View File

@ -1,6 +1,17 @@
bin_PROGRAMS = odpalarka
odpalarka_LDADD = $(top_builddir)/lib/libvcmi.la
odpalarka_CXXFLAGS = @SDL_CXXFLAGS@
odpalarka_LDFLAGS = -L$(top_builddir)/lib
odpalarka_SOURCES = main.cpp
bin_PROGRAMS = vcmiserver
vcmiserver_LDADD = $(top_builddir)/lib/libvcmi.la
vcmiserver_CXXFLAGS = @SDL_CXXFLAGS@
vcmiserver_LDFLAGS = -L$(top_builddir)/lib
vcmiserver_SOURCES = \
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h \
CGameHandler.cpp \
CGameHandler.h \
CVCMIServer.cpp \
CVCMIServer.h \
NetPacksServer.cpp \
stdafx.cpp \
stdafx.h

View File

@ -35,7 +35,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>