1
0

VC2008 / VC2010: Enabled precompiled header through Globals.h; the header included in every module in the project. Compilation optimization.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@188 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-01-29 19:28:19 +00:00
parent f78eef29ee
commit 89afb970d8
190 changed files with 1566 additions and 507 deletions

View File

@ -3,6 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcproj", "{32012054-0C96-4C43-AB27-174FF8E72D66}"
ProjectSection(ProjectDependencies) = postProject
{9A476537-42C0-4848-AB40-15CFE83D17A8} = {9A476537-42C0-4848-AB40-15CFE83D17A8}
{082E8185-7B3A-4945-8C82-9132341A329D} = {082E8185-7B3A-4945-8C82-9132341A329D}
{EEAB54AD-114C-4AB8-8482-0A52D502BD35} = {EEAB54AD-114C-4AB8-8482-0A52D502BD35}
{5AAA90B9-946D-4034-83F3-676B06A6E326} = {5AAA90B9-946D-4034-83F3-676B06A6E326}
@ -17,6 +18,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "Lua.vcproj", "{082E8
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ToLua", "ToLua.vcproj", "{EEAB54AD-114C-4AB8-8482-0A52D502BD35}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebServer", "WebServer.vcproj", "{9A476537-42C0-4848-AB40-15CFE83D17A8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -43,6 +46,10 @@ Global
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Debug|Win32.Build.0 = Debug|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.ActiveCfg = Release|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.Build.0 = Release|Win32
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug|Win32.ActiveCfg = Debug|Win32
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug|Win32.Build.0 = Debug|Win32
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.ActiveCfg = Release|Win32
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -46,7 +46,8 @@
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="Globals.h"
WarningLevel="3"
DebugInformationFormat="4"
/>
@ -115,7 +116,8 @@
AdditionalIncludeDirectories="../zlib-1.2.5;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="Globals.h"
WarningLevel="3"
DebugInformationFormat="3"
/>
@ -287,14 +289,6 @@
RelativePath="..\source\cEntity.h"
>
</File>
<File
RelativePath="..\source\cEvent.cpp"
>
</File>
<File
RelativePath="..\source\cEvent.h"
>
</File>
<File
RelativePath="..\source\cFileFormatUpdater.cpp"
>
@ -416,9 +410,18 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
BasicRuntimeChecks="0"
UsePrecompiledHeader="0"
DebugInformationFormat="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\source\cNoise.h"
@ -544,14 +547,6 @@
RelativePath="..\source\cSimulatorManager.h"
>
</File>
<File
RelativePath="..\source\cSleep.cpp"
>
</File>
<File
RelativePath="..\source\cSleep.h"
>
</File>
<File
RelativePath="..\source\cSocket.cpp"
>
@ -660,6 +655,30 @@
RelativePath="..\source\FileDefine.h"
>
</File>
<File
RelativePath="..\source\Globals.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\source\Globals.h"
>
</File>
<File
RelativePath="..\source\LuaFunctions.h"
>
@ -1415,6 +1434,14 @@
RelativePath="..\source\cCriticalSection.h"
>
</File>
<File
RelativePath="..\source\cEvent.cpp"
>
</File>
<File
RelativePath="..\source\cEvent.h"
>
</File>
<File
RelativePath="..\source\cSemaphore.cpp"
>
@ -1423,6 +1450,14 @@
RelativePath="..\source\cSemaphore.h"
>
</File>
<File
RelativePath="..\source\cSleep.cpp"
>
</File>
<File
RelativePath="..\source\cSleep.h"
>
</File>
</Filter>
<Filter
Name="Bindings"
@ -1512,62 +1547,6 @@
>
</File>
</Filter>
<Filter
Name="WebServer"
>
<File
RelativePath="..\WebServer\base64.cpp"
>
</File>
<File
RelativePath="..\WebServer\base64.h"
>
</File>
<File
RelativePath="..\WebServer\cEvent.cpp"
>
</File>
<File
RelativePath="..\WebServer\cEvent.h"
>
</File>
<File
RelativePath="..\WebServer\Socket.cpp"
>
</File>
<File
RelativePath="..\WebServer\Socket.h"
>
</File>
<File
RelativePath="..\WebServer\StdHelpers.cpp"
>
</File>
<File
RelativePath="..\WebServer\StdHelpers.h"
>
</File>
<File
RelativePath="..\WebServer\Tracer.h"
>
</File>
<File
RelativePath="..\WebServer\UrlHelper.cpp"
>
</File>
<File
RelativePath="..\WebServer\UrlHelper.h"
>
</File>
<File
RelativePath="..\WebServer\WebServer.cpp"
>
</File>
<File
RelativePath="..\WebServer\WebServer.h"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>

233
VC2008/WebServer.vcproj Normal file
View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="WebServer"
ProjectGUID="{9A476537-42C0-4848-AB40-15CFE83D17A8}"
RootNamespace="WebServer"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\webserver"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="Globals.h"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\webserver"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="Globals.h"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\WebServer\base64.cpp"
>
</File>
<File
RelativePath="..\WebServer\base64.h"
>
</File>
<File
RelativePath="..\WebServer\cEvents.cpp"
>
</File>
<File
RelativePath="..\WebServer\cEvents.h"
>
</File>
<File
RelativePath="..\WebServer\Globals.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\WebServer\Globals.h"
>
</File>
<File
RelativePath="..\WebServer\Socket.cpp"
>
</File>
<File
RelativePath="..\WebServer\Socket.h"
>
</File>
<File
RelativePath="..\WebServer\StdHelpers.cpp"
>
</File>
<File
RelativePath="..\WebServer\StdHelpers.h"
>
</File>
<File
RelativePath="..\WebServer\Tracer.h"
>
</File>
<File
RelativePath="..\WebServer\UrlHelper.cpp"
>
</File>
<File
RelativePath="..\WebServer\UrlHelper.h"
>
</File>
<File
RelativePath="..\WebServer\WebServer.cpp"
>
</File>
<File
RelativePath="..\WebServer\WebServer.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -109,6 +109,8 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4078 %(AdditionalOptions)</AdditionalOptions>
@ -138,6 +140,8 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4078 %(AdditionalOptions)</AdditionalOptions>
@ -230,8 +234,7 @@
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeader>Use</PrecompiledHeader>
<BrowseInformation>
</BrowseInformation>
<WarningLevel>Level4</WarningLevel>
@ -239,6 +242,7 @@
</DebugInformationFormat>
<WholeProgramOptimization>true</WholeProgramOptimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4078 %(AdditionalOptions)</AdditionalOptions>
@ -339,6 +343,7 @@
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='Debug with optimized Noise|Win32'">Speed</FavorSizeOrSpeed>
<OmitFramePointers Condition="'$(Configuration)|$(Platform)'=='Debug with optimized Noise|Win32'">true</OmitFramePointers>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug with optimized Noise|Win32'">Default</BasicRuntimeChecks>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug with optimized Noise|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\source\cPassiveAggressiveMonster.cpp" />
<ClCompile Include="..\source\cPassiveMonster.cpp" />
@ -381,6 +386,11 @@
<ClCompile Include="..\source\cWorldGenerator_Test.cpp" />
<ClCompile Include="..\source\cZombie.cpp" />
<ClCompile Include="..\source\cZombiepigman.cpp" />
<ClCompile Include="..\source\Globals.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug with optimized Noise|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\Source\ManualBindings.cpp" />
<ClCompile Include="..\source\Matrix4f.cpp" />
<ClCompile Include="..\source\md5\md5.cpp" />
@ -540,6 +550,7 @@
<ClInclude Include="..\source\cZombiepigman.h" />
<ClInclude Include="..\source\Endianness.h" />
<ClInclude Include="..\Source\FileDefine.h" />
<ClInclude Include="..\source\Globals.h" />
<ClInclude Include="..\Source\LuaFunctions.h" />
<ClInclude Include="..\Source\ManualBindings.h" />
<ClInclude Include="..\source\Matrix4f.h" />

View File

@ -907,6 +907,7 @@
<ClCompile Include="..\source\cWebPlugin_Lua.cpp">
<Filter>cWebAdmin\cWebPlugin\cWebPlugin</Filter>
</ClCompile>
<ClCompile Include="..\source\Globals.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\cServer.h">
@ -1395,6 +1396,7 @@
<ClInclude Include="..\source\cWebPlugin_Lua.h">
<Filter>cWebAdmin\cWebPlugin\cWebPlugin</Filter>
</ClInclude>
<ClInclude Include="..\source\Globals.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\source\AllToLua.pkg">

View File

@ -76,6 +76,8 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -103,6 +105,8 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -128,7 +132,11 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\WebServer\base64.cpp" />
<ClCompile Include="..\WebServer\cEvent.cpp" />
<ClCompile Include="..\WebServer\cEvents.cpp" />
<ClCompile Include="..\WebServer\Globals.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\WebServer\Socket.cpp" />
<ClCompile Include="..\WebServer\StdHelpers.cpp" />
<ClCompile Include="..\WebServer\UrlHelper.cpp" />
@ -136,7 +144,8 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\WebServer\base64.h" />
<ClInclude Include="..\WebServer\cEvent.h" />
<ClInclude Include="..\WebServer\cEvents.h" />
<ClInclude Include="..\WebServer\Globals.h" />
<ClInclude Include="..\WebServer\Socket.h" />
<ClInclude Include="..\WebServer\StdHelpers.h" />
<ClInclude Include="..\WebServer\Tracer.h" />

View File

@ -6,9 +6,8 @@
<ClCompile Include="..\WebServer\StdHelpers.cpp" />
<ClCompile Include="..\WebServer\UrlHelper.cpp" />
<ClCompile Include="..\WebServer\WebServer.cpp" />
<ClCompile Include="..\WebServer\cEvent.cpp">
<Filter>Threading</Filter>
</ClCompile>
<ClCompile Include="..\WebServer\cEvents.cpp" />
<ClCompile Include="..\WebServer\Globals.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\WebServer\base64.h" />
@ -17,13 +16,7 @@
<ClInclude Include="..\WebServer\UrlHelper.h" />
<ClInclude Include="..\WebServer\WebServer.h" />
<ClInclude Include="..\WebServer\StdHelpers.h" />
<ClInclude Include="..\WebServer\cEvent.h">
<Filter>Threading</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Threading">
<UniqueIdentifier>{5108ca96-8262-4e37-b891-cff8f714210e}</UniqueIdentifier>
</Filter>
<ClInclude Include="..\WebServer\Globals.h" />
<ClInclude Include="..\WebServer\cEvents.h" />
</ItemGroup>
</Project>

10
WebServer/Globals.cpp Normal file
View File

@ -0,0 +1,10 @@
// Globals.cpp
// This file is used for precompiled header generation in MSVC environments
#include "Globals.h"

78
WebServer/Globals.h Normal file
View File

@ -0,0 +1,78 @@
// Globals.h
// This file gets included from every module in the project, so that global symbols may be introduced easily
// Also used for precompiled header generation in MSVC environments
// OS-dependent stuff:
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <winsock.h>
#else
#include <sys/types.h>
#include <sys/stat.h> // for mkdir
#include <sys/time.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#endif
// CRT stuff:
#include <assert.h>
#include <stdio.h>
// STL stuff:
#include <vector>
#include <list>
#include <string>
#include <map>
#include <algorithm>
// Common headers:
#include "../source/cCriticalSection.h"
#include "../source/cMCLogger.h"
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
// sprintf_s is the preferred call in MSVC ("secure"); make it *nix-compatible:
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#define vsnprintf_s(buffer, buffer_size, maxcount, stringbuffer, ...) (vsnprintf(buffer, maxcount, stringbuffer, __VA_ARGS__))
#endif // _WIN32

View File

@ -29,7 +29,7 @@
THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
*/
#include "../source/cMCLogger.h"
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Socket.h"
#include <iostream>
@ -38,11 +38,11 @@
#include <cstring>
#include <sys/time.h>
#else
#define MSG_NOSIGNAL (0)
#define MSG_NOSIGNAL (0)
#endif
#ifdef __MAC_NA
#define MSG_NOSIGNAL (0)
#define MSG_NOSIGNAL (0)
#endif
using namespace std;

View File

@ -29,8 +29,9 @@
THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
*/
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "StdHelpers.h"
#include <algorithm>
#include <cctype>
std::string ReplaceInStr(const std::string& in, const std::string& search_for, const std::string& replace_with) {

View File

@ -29,14 +29,12 @@
THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
*/
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "UrlHelper.h"
#include "Tracer.h"
#include "StdHelpers.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include <sstream>
#include <iostream>

View File

@ -31,24 +31,22 @@
THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
*/
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include <ctime>
#ifdef _WIN32
#include <process.h>
#include <process.h>
#endif
#include <iostream>
#include <string>
#include <map>
#include <sstream>
#include "WebServer.h"
#include "cEvents.h"
#include "Socket.h"
#include "UrlHelper.h"
#include "base64.h"
#include "cEvent.h"
webserver::request_func webserver::request_func_=0;
#ifdef _WIN32
@ -178,7 +176,7 @@ void webserver::Stop()
{
m_bStop = true;
m_Socket->Close();
m_Event->Wait();
m_Events->Wait();
}
void webserver::Begin()
@ -209,18 +207,18 @@ void webserver::Begin()
pthread_create( hHandle, NULL, Request, ptr_s);
#endif
}
m_Event->Set();
m_Events->Set();
}
webserver::webserver(unsigned int port_to_listen, request_func r) {
m_Socket = new SocketServer(port_to_listen,1);
request_func_ = r;
m_Event = new cEvent();
m_Events = new cEvents();
}
webserver::~webserver()
{
delete m_Socket;
delete m_Event;
delete m_Events;
}

View File

@ -30,66 +30,64 @@
THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
*/
#include <string>
#include <map>
class cEvent;
class cEvents;
class Socket;
class SocketServer;
class webserver {
public:
struct http_request {
public:
struct http_request {
http_request()
: s_( 0 )
, authentication_given_(false)
{}
http_request()
: s_( 0 )
, authentication_given_(false)
{}
Socket* s_;
std::string method_;
std::string path_;
std::map<std::string, std::string> params_;
Socket* s_;
std::string method_;
std::string path_;
std::map<std::string, std::string> params_;
std::string accept_;
std::string accept_language_;
std::string accept_encoding_;
std::string user_agent_;
std::string accept_;
std::string accept_language_;
std::string accept_encoding_;
std::string user_agent_;
/* status_: used to transmit server's error status, such as
o 202 OK
o 404 Not Found
and so on */
std::string status_;
/* status_: used to transmit server's error status, such as
o 202 OK
o 404 Not Found
and so on */
std::string status_;
/* auth_realm_: allows to set the basic realm for an authentication,
no need to additionally set status_ if set */
std::string auth_realm_;
/* auth_realm_: allows to set the basic realm for an authentication,
no need to additionally set status_ if set */
std::string auth_realm_;
std::string answer_;
std::string answer_;
/* authentication_given_ is true when the user has entered a username and password.
These can then be read from username_ and password_ */
bool authentication_given_;
std::string username_;
std::string password_;
};
/* authentication_given_ is true when the user has entered a username and password.
These can then be read from username_ and password_ */
bool authentication_given_;
std::string username_;
std::string password_;
};
typedef void (*request_func) (http_request*);
webserver(unsigned int port_to_listen, request_func);
typedef void (*request_func) (http_request*);
webserver(unsigned int port_to_listen, request_func);
~webserver();
void Begin();
void Stop();
private:
private:
bool m_bStop;
#ifdef _WIN32
static unsigned __stdcall Request(void*);
#else
static void* Request(void*);
#endif
static request_func request_func_;
#ifdef _WIN32
static unsigned __stdcall Request(void*);
#else
static void* Request(void*);
#endif
static request_func request_func_;
cEvent* m_Event;
cEvents * m_Events;
SocketServer* m_Socket;
};

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "base64.h"
#include <iostream>

View File

@ -1,16 +1,13 @@
#include "cEvent.h"
#include "../source/cMCLogger.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h> // sprintf()
#endif
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
cEvent::cEvent( unsigned int a_NumEvents /* = 1 */ )
#include "cEvents.h"
cEvents::cEvents( unsigned int a_NumEvents /* = 1 */ )
: m_NumEvents( a_NumEvents )
#ifndef _WIN32
, m_bNamed( false )
@ -34,24 +31,28 @@ cEvent::cEvent( unsigned int a_NumEvents /* = 1 */ )
if( sem_init( HandlePtr, 0, 0 ) )
{
LOG("WARNING cEvent: Could not create unnamed semaphore, fallback to named.");
LOG("WARNING cEvents: Could not create unnamed semaphore, fallback to named.");
m_bNamed = true;
delete HandlePtr; // named semaphores return their own address
char c_Str[32];
sprintf( c_Str, "cEvent%p", &HandlePtr );
sprintf( c_Str, "cEvents%p", &HandlePtr );
HandlePtr = sem_open( c_Str, O_CREAT, 777, 0 );
if( HandlePtr == SEM_FAILED )
LOG("ERROR: Could not create Event. (%i)", errno);
else
if( sem_unlink( c_Str ) != 0 )
LOG("ERROR: Could not unlink cEvent. (%i)", errno);
LOG("ERROR: Could not unlink cEvents. (%i)", errno);
}
}
#endif
}
cEvent::~cEvent()
cEvents::~cEvents()
{
#ifdef _WIN32
for( unsigned int i = 0; i < m_NumEvents; i++ )
@ -66,12 +67,12 @@ cEvent::~cEvent()
{
sem_t* & HandlePtr = ((sem_t**)m_Handle)[i];
char c_Str[32];
sprintf( c_Str, "cEvent%p", &HandlePtr );
sprintf( c_Str, "cEvents%p", &HandlePtr );
// LOG("Closing event: %s", c_Str );
// LOG("Sem ptr: %p", HandlePtr );
if( sem_close( HandlePtr ) != 0 )
{
LOG("ERROR: Could not close cEvent. (%i)", errno);
LOG("ERROR: Could not close cEvents. (%i)", errno);
}
}
else
@ -84,7 +85,11 @@ cEvent::~cEvent()
#endif
}
void cEvent::Wait()
void cEvents::Wait()
{
#ifdef _WIN32
WaitForMultipleObjects( m_NumEvents, (HANDLE*)m_Handle, true, INFINITE );
@ -93,20 +98,28 @@ void cEvent::Wait()
{
if( sem_wait( ((sem_t**)m_Handle)[i] ) != 0 )
{
LOG("ERROR: Could not wait for cEvent. (%i)", errno);
LOG("ERROR: Could not wait for cEvents. (%i)", errno);
}
}
#endif
}
void cEvent::Set(unsigned int a_EventNum /* = 0 */)
void cEvents::Set(unsigned int a_EventNum /* = 0 */)
{
#ifdef _WIN32
SetEvent( ((HANDLE*)m_Handle)[a_EventNum] );
#else
if( sem_post( ((sem_t**)m_Handle)[a_EventNum] ) != 0 )
{
LOG("ERROR: Could not set cEvent. (%i)", errno);
LOG("ERROR: Could not set cEvents. (%i)", errno);
}
#endif
}

View File

@ -1,18 +1,18 @@
#pragma once
class cEvent
class cEvents
{
public:
cEvent( unsigned int a_NumEvents = 1 );
~cEvent();
cEvents( unsigned int a_NumEvents = 1 );
~cEvents();
void Wait();
void Set(unsigned int a_EventNum = 0);
private:
unsigned int m_NumEvents;
void* m_Handle; // HANDLE[] pointer
#ifndef _WIN32
bool m_bNamed;
void* m_Handle; // HANDLE[] pointer
#ifndef _WIN32
bool m_bNamed;
#endif
};
};

View File

@ -15,6 +15,8 @@
!! MODIFIED BY FAKETRUTH !!
*/
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
// C++ Includes
#include <iostream>
#include <fstream>
@ -23,7 +25,6 @@
using namespace std;
// C Includes
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>

View File

@ -1,3 +1,6 @@
$#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
$#include "tolua_base.h"
$cfile "cTorch.h"

View File

@ -3,6 +3,8 @@
** Generated automatically by tolua++-1.0.92 on 01/27/12 00:53:11.
*/
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#ifndef __cplusplus
#include "stdlib.h"
#endif

View File

@ -1,6 +1,5 @@
#pragma once
#include "MemoryLeak.h"
#include "BlockID.h"
//tolua_begin

View File

@ -1,11 +1,10 @@
#pragma once
#include <string>
#ifdef _WIN32
#include <WinSock.h>
#include <WinSock.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
// Changes endianness

10
source/Globals.cpp Normal file
View File

@ -0,0 +1,10 @@
// Globals.cpp
// This file is used for precompiled header generation in MSVC environments
#include "Globals.h"

82
source/Globals.h Normal file
View File

@ -0,0 +1,82 @@
// Globals.h
// This file gets included from every module in the project, so that global symbols may be introduced easily
// Also used for precompiled header generation in MSVC environments
// OS-dependent stuff:
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <winsock.h>
#else
#include <sys/types.h>
#include <sys/stat.h> // for mkdir
#include <sys/time.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#endif
// CRT stuff:
#include <assert.h>
#include <stdio.h>
// STL stuff:
#include <vector>
#include <list>
#include <string>
#include <map>
#include <algorithm>
// Common headers:
#include "cSleep.h"
#include "cCriticalSection.h"
#include "cSemaphore.h"
#include "cEvent.h"
#include "cThread.h"
#include "cMCLogger.h"
// Common definitions:
/// Evaluates to the number of elements in an array (compile-time!)
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
// sprintf_s is the preferred call in MSVC ("secure"); make it *nix-compatible:
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#define vsnprintf_s(buffer, buffer_size, maxcount, stringbuffer, ...) (vsnprintf(buffer, maxcount, stringbuffer, __VA_ARGS__))
#endif // _WIN32

View File

@ -1,37 +1,30 @@
#pragma once
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <WinSock.h>
// #define socklen_t int
// #ifdef SendMessage
// #undef SendMessage
// #endif
#else
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <unistd.h>
#define SOCKET int
typedef void *HANDLE;
#define CRITICAL_SECTION pthread_mutex_t
#define SD_BOTH (2)
#define closesocket(x) (shutdown(x, SD_BOTH), close(x))
#define SOCKET_ERROR SO_ERROR
#define EnterCriticalSection(x) pthread_mutex_lock(x)
#define LeaveCriticalSection(x) pthread_mutex_unlock(x)
#define InitializeCriticalSection(x) pthread_mutex_init(x, NULL)
#define DeleteCriticalSection(x) (x)
#define sprintf_s(x, y, ...) sprintf(x, __VA_ARGS__)
#ifndef _WIN32
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
// TODO: We shouldn't need these! Use the OS support objects instead
#define SOCKET int
typedef void *HANDLE;
#define CRITICAL_SECTION pthread_mutex_t
#define SD_BOTH (2)
#define closesocket(x) (shutdown(x, SD_BOTH), close(x))
#define SOCKET_ERROR SO_ERROR
#define EnterCriticalSection(x) pthread_mutex_lock(x)
#define LeaveCriticalSection(x) pthread_mutex_unlock(x)
#define InitializeCriticalSection(x) pthread_mutex_init(x, NULL)
#define DeleteCriticalSection(x) (x)
#endif
inline bool IsSocketError( int a_ReturnedValue )
{
#ifdef _WIN32

View File

@ -1,6 +1,8 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "ManualBindings.h"
#include "tolua++.h"
#include "cMCLogger.h"
#include "cRoot.h"
#include "cWorld.h"

View File

@ -0,0 +1,4 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
// _X: empty file??

View File

@ -1,10 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "SquirrelBindings.h"
#if USE_SQUIRREL
#pragma warning(disable:4100) // Getting A LOT of these warnings from SqPlus
#pragma warning(disable:4127)
#include "cMCLogger.h"
#include <sqplus/sqplus.h>
#include <sqplus/SquirrelObject.h>
#include <../squirrel/sqstate.h>
@ -16,6 +17,10 @@
#include "cRoot.h"
#include "cPlayer.h"
bool SquirrelBindings::IsBound = false;
bool IsTopClosure( HSQUIRRELVM v )

View File

@ -1,6 +1,13 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Vector3d.h"
#include "Vector3f.h"
Vector3d::Vector3d(const Vector3f & v )
: x( v.x )
, y( v.y )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Vector3f.h"
#include "Vector3d.h"
#include "Vector3i.h"

View File

@ -1,6 +1,13 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Vector3i.h"
#include "Vector3d.h"
Vector3i::Vector3i( const Vector3d & v )
: x( (int)v.x )
, y( (int)v.y )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cAggressiveMonster.h"
#include "Vector3f.h"

View File

@ -1,13 +1,14 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cAuthenticator.h"
#include "cBlockingTCPLink.h"
#include "cMCLogger.h"
#include "../iniFile/iniFile.h"
#ifndef _WIN32
#include <cstring>
#endif
#include <string>
#include <sstream>
extern void ReplaceString( std::string & a_HayStack, const std::string & a_Needle, const std::string & a_ReplaceWith );

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cBlockToPickup.h"
#include "Defines.h"
#include "BlockID.h"

View File

@ -1,17 +1,17 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cBlockingTCPLink.h"
#include "packets/cPacket.h"
#include "MCSocket.h"
#include <string>
#include "cMCLogger.h"
#ifndef _WIN32
#include <cstring>
#include <errno.h>
#include <cstring>
#include <errno.h>
#endif
#ifdef _WIN32
#define MSG_NOSIGNAL (0)
#define MSG_NOSIGNAL (0)
#endif
#ifdef __MACH__
#define MSG_NOSIGNAL (0)

View File

@ -1,7 +1,10 @@
#pragma once
#include "cSocket.h"
#include <string>
class cEvent;
class cBlockingTCPLink //tolua_export

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCavespider.h"
cCavespider::cCavespider()

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cChatColor.h"
const std::string cChatColor::Color = "\xa7"; // Old color was "\xc2\xa7" or in other words: "§"

View File

@ -1,20 +1,27 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cChestEntity.h"
#include "cItem.h"
#include <string>
#include "cClientHandle.h"
#include "cMCLogger.h"
#include "cPlayer.h"
#include "cWindow.h"
#include "cWorld.h"
#include "cRoot.h"
#include "cPickup.h"
#include "cMCLogger.h"
#include "cChunk.h"
#include <json/json.h>
class cWorld;
class cRoot;
#include <json/json.h>
cChestEntity::cChestEntity(int a_X, int a_Y, int a_Z, cChunk* a_Chunk)
: cBlockEntity( E_BLOCK_CHEST, a_X, a_Y, a_Z, a_Chunk )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cChicken.h"
//TODO Drop egg every 5-10 minutes

View File

@ -1,8 +1,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#ifndef _WIN32
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <sys/stat.h> // for mkdir
#include <sys/types.h>
#endif
@ -16,11 +17,9 @@
#include "cServer.h"
#include "zlib.h"
#include "Defines.h"
#include <string> // memset
#include "cChestEntity.h"
#include "cFurnaceEntity.h"
#include "cSignEntity.h"
#include "cMCLogger.h"
#include "cTorch.h"
#include "cLadder.h"
#include "cPickup.h"
@ -28,7 +27,6 @@
#include "cItem.h"
#include "cNoise.h"
#include "cRoot.h"
#include "cCriticalSection.h"
#include "cWorldGenerator.h"
#include "cBlockToPickup.h"
#include "MersenneTwister.h"
@ -41,13 +39,9 @@
#include <json/json.h>
#include <list>
#include <vector>
#include <map>
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
extern bool g_bWaterPhysics;
@ -57,6 +51,7 @@ typedef std::list< cFurnaceEntity* > FurnaceEntityList;
typedef std::list< cClientHandle* > ClientHandleList;
typedef std::list< cBlockEntity* > BlockEntityList;
typedef std::list< cEntity* > EntityList;
struct cChunk::sChunkState
{
sChunkState()

View File

@ -1,17 +1,13 @@
#include "MemoryLeak.h"
#include "Globals.h"
#include "cChunkGenerator.h"
#include "cChunkMap.h"
#include "cChunk.h"
#include "cWorld.h"
#include "cThread.h"
#include "cCriticalSection.h"
#include "cSemaphore.h"
#include "cMCLogger.h"
#include <list>
typedef std::pair<int, int> ChunkCoord;
typedef std::list< ChunkCoord > ChunkCoordList;

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#if 0 // ignore all contents of this file
#include "cChunkLoader.h"
#include "cChunk.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cChunkMap.h"
#include "cChunk.h"
#include "cMCLogger.h"
@ -7,12 +10,8 @@
#include <math.h> // floorf
#ifndef _WIN32
#include <cstring> // memcpy
#include <cstdlib> // abs
#include <stdio.h> // sprintf and stuff
#define sprintf_s( dest, size, format, ... ) sprintf( dest, format, __VA_ARGS__ )
#include <cstring> // memcpy
#include <cstdlib> // abs
#endif
#include "zlib.h"
@ -22,6 +21,10 @@
#define LAYER_SIZE (32)
cChunkMap::cChunkMap( int a_Width, int a_Height, cWorld* a_World )
: m_Nodes( new cChunkNode[ a_Width * a_Height ] )
, m_Width( a_Width )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cClientHandle.h"
#include "cServer.h"
#include "cWorld.h"
@ -8,7 +11,6 @@
#include "cInventory.h"
#include "cChestEntity.h"
#include "cSignEntity.h"
#include "cMCLogger.h"
#include "cWindow.h"
#include "cCraftingWindow.h"
#include "cItem.h"
@ -30,9 +32,6 @@
#include "Vector3f.h"
#include "Vector3d.h"
#include "cCriticalSection.h"
#include "cSemaphore.h"
#include "cEvent.h"
#include "cSleep.h"
#include "cRoot.h"
@ -70,10 +69,6 @@
#include "packets/cPacket_PlayerListItem.h"
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
#define AddPistonDir( x, y, z, dir, amount ) switch(dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\
case 2: (z)-=(amount); break; case 3: (z)+=(amount); break;\
case 4: (x)-=(amount); break; case 5: (x)+=(amount); break; }

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCow.h"
//TODO: Milk Cow

View File

@ -1,6 +1,8 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCraftingWindow.h"
#include "cItem.h"
#include "cMCLogger.h"
#include "cRecipeChecker.h"
#include "cPlayer.h"
#include "cClientHandle.h"

View File

@ -1,8 +1,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCreativeInventory.h"
#include <string> //memset
#include "cPlayer.h"
#include "cClientHandle.h"
#include "cMCLogger.h"
#include "cWindow.h"
#include "cItem.h"
#include "cRecipeChecker.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCreeper.h"
cCreeper::cCreeper()

View File

@ -1,12 +1,5 @@
#include "cCriticalSection.h"
#include "cMCLogger.h"
#include <assert.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <pthread.h>
#endif
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules

View File

@ -1,10 +1,19 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cCuboid.h"
#include <algorithm> // swap
void cCuboid::Sort()
{
if( p1.x > p2.x ) std::swap( p1.x, p2.x );
if( p1.y > p2.y ) std::swap( p1.y, p2.y );
if( p1.z > p2.z ) std::swap( p1.z, p2.z );
}
}

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cEnderman.h"
cEnderman::cEnderman()

View File

@ -1,7 +1,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cEntity.h"
#include "cWorld.h"
#include "cChunk.h"
#include "cMCLogger.h"
#include "cServer.h"
#include "cRoot.h"
#include "Vector3d.h"

View File

@ -1,14 +1,9 @@
#include "cEvent.h"
#include "cMCLogger.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#endif
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
cEvent::cEvent( unsigned int a_NumEvents /* = 1 */ )
: m_NumEvents( a_NumEvents )

View File

@ -1,24 +1,10 @@
#include "Globals.h"
#include "cFileFormatUpdater.h"
#include "cMCLogger.h"
#include "Vector3d.h"
#include "Vector3f.h"
#include <string>
#include <list>
#include <stdio.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#else
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <iostream>
#include <cstdio>
#endif
#include "cItem.h"
#include <json/json.h>

View File

@ -1,9 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cFireSimulator.h"
#include "cWorld.h"
#include "Vector3i.h"
#include "BlockID.h"
#include "Defines.h"
#include <vector>
cFireSimulator::cFireSimulator( cWorld* a_World )
: cSimulator(a_World)

View File

@ -1,9 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cFluidSimulator.h"
#include "cWorld.h"
#include "Vector3i.h"
#include "BlockID.h"
#include "Defines.h"
#include <vector>
#include "cPickup.h"
#include "cItem.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cFurnaceEntity.h"
#include "BlockID.h"
#include "cItem.h"
@ -13,8 +16,6 @@
#include "packets/cPacket_InventoryProgressBar.h"
#include "cMCLogger.h"
#include <json/json.h>
cFurnaceEntity::cFurnaceEntity(int a_X, int a_Y, int a_Z, cChunk* a_Chunk)

View File

@ -1,6 +1,8 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cFurnaceRecipe.h"
#include "cItem.h"
#include "cMCLogger.h"
#include <fstream>
#include <sstream>

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cFurnaceWindow.h"
#include "cItem.h"
#include "cFurnaceEntity.h"
@ -5,7 +8,9 @@
#include "packets/cPacket_WindowClick.h"
#include "cMCLogger.h"
cFurnaceWindow::cFurnaceWindow( cFurnaceEntity* a_Owner )
: cWindow( a_Owner, true )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cGenSettings.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cGhast.h"
cGhast::cGhast()

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cGroup.h"
void cGroup::AddCommand( std::string a_Command )

View File

@ -1,8 +1,10 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cGroupManager.h"
#include "cGroup.h"
#include "../iniFile/iniFile.h"
#include "cChatColor.h"
#include "cMCLogger.h"
#include "cRoot.h"
extern std::vector< std::string > StringSplit( std::string str, std::string delim);

View File

@ -1,16 +1,17 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cHeartBeat.h"
#include "cMCLogger.h"
#include "md5/md5.h"
#include <stdio.h>
#include "cRoot.h"
#include "cServer.h"
#include "cSleep.h"
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
cHeartBeat::cHeartBeat()
{

View File

@ -1,8 +1,9 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cInventory.h"
#include <string> //memset
#include "cPlayer.h"
#include "cClientHandle.h"
#include "cMCLogger.h"
#include "cWindow.h"
#include "cItem.h"
#include "cRecipeChecker.h"
@ -14,6 +15,10 @@
#include "packets/cPacket_WholeInventory.h"
#include "packets/cPacket_InventorySlot.h"
cInventory::~cInventory()
{
delete [] m_Slots;

View File

@ -1,6 +1,13 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cItem.h"
#include <json/json.h>
void cItem::GetJson( Json::Value & a_OutValue )
{
a_OutValue["ID"] = m_ItemID;

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cLavaSimulator.h"
#include "Defines.h"

View File

@ -1,19 +1,15 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cLog.h"
#include <fstream>
#include <ctime>
#include <stdarg.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <sys/stat.h> // for mkdir
#include <sys/types.h>
#define sprintf_s(buffer, buffer_size, stringbuffer, ...) (sprintf(buffer, stringbuffer, __VA_ARGS__))
#define vsnprintf_s(buffer, buffer_size, maxcount, stringbuffer, ...) (vsnprintf(buffer, maxcount, stringbuffer, __VA_ARGS__))
#endif
#include <string>
cLog* cLog::s_Log = NULL;

View File

@ -1,10 +1,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cLuaCommandBinder.h"
#include "cMCLogger.h"
#include "cPlayer.h"
#include "cPlugin_Lua.h"
#include "tolua++.h"
extern std::vector<std::string> StringSplit(std::string str, std::string delim);
extern bool report_errors(lua_State* lua, int status);

View File

@ -1,16 +1,13 @@
#include "cMCLogger.h"
#include "cLog.h"
#include "cCriticalSection.h"
#include <stdio.h>
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include <cstdarg>
#include <time.h>
#include "cLog.h"
#ifndef _WIN32
#define sprintf_s(buffer, buffer_size, stringbuffer, ...) (sprintf(buffer, stringbuffer, __VA_ARGS__))
#else
#include <Windows.h>
#endif
cMCLogger* cMCLogger::s_MCLogger = 0;

View File

@ -4,7 +4,6 @@
#include <stdarg.h>
#endif
class cCriticalSection;
class cLog;
class cMCLogger //tolua_export
{ //tolua_export

View File

@ -1,14 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cMakeDir.h"
#ifndef _WIN32
//#include <cstring> // If something is missing, uncomment some of these!
//#include <cstdlib>
//#include <stdio.h>
#include <sys/stat.h> // for mkdir
//#include <sys/types.h>
#else
#include <Windows.h>
#endif
void cMakeDir::MakeDir( const char* a_Directory )
{
@ -21,4 +18,8 @@ void cMakeDir::MakeDir( const char* a_Directory )
#else
mkdir(a_Directory, S_IRWXU | S_IRWXG | S_IRWXO);
#endif
}
}

View File

@ -1,9 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cMonster.h"
#include "cRoot.h"
#include "cServer.h"
#include "cClientHandle.h"
#include "cWorld.h"
#include "cMCLogger.h"
#include "cChunk.h"
#include "cPlayer.h"
#include "BlockID.h"
@ -28,12 +30,12 @@
#include "../iniFile/iniFile.h"
#ifndef _WIN32
#include <cstdlib> // rand
#include <unistd.h>
#include <string.h>
#include <cstdlib> // rand
#include <unistd.h>
#endif
#include <string>
cMonster::cMonster()

View File

@ -1,11 +1,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cMonsterConfig.h"
#include "cMonster.h"
#include "../iniFile/iniFile.h"
#include <list>
#include <vector>
#include <cstdio>
//#include "../source/cprintf.h"
#include <string>
using namespace std;
extern std::vector<std::string> StringSplit(std::string str, std::string delim);

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cNoise.h"
#include <math.h>
@ -7,6 +10,10 @@
#define FAST_FLOOR( x ) ( (x) < 0 ? ((int)x)-1 : ((int)x) )
cNoise::cNoise( unsigned int a_Seed )
: m_Seed( a_Seed )
{

View File

@ -1,8 +1,14 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPassiveAggressiveMonster.h"
#include "cPlayer.h"
cPassiveAggressiveMonster::cPassiveAggressiveMonster()
{
m_EMPersonality = PASSIVE;

View File

@ -1,7 +1,13 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPassiveMonster.h"
#include "MersenneTwister.h"
cPassiveMonster::cPassiveMonster()
{
m_EMPersonality = PASSIVE;

View File

@ -1,10 +1,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPawn.h"
#include "cRoot.h"
#include "cServer.h"
#include "cWorld.h"
#include "cPlayer.h"
#include "cChunk.h"
#include "cMCLogger.h"
#include "cPluginManager.h"
#include "Vector3d.h"
#include "BlockID.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#ifndef _WIN32
#include <cstdlib>
#endif
@ -12,7 +15,6 @@
#include "cPluginManager.h"
#include "cItem.h"
#include "cRoot.h"
#include "cMCLogger.h"
#include "cTracer.h"
#include "cChunk.h"
@ -23,6 +25,10 @@
#include "Vector3d.h"
#include "Vector3f.h"
CLASS_DEFINITION( cPickup, cEntity )
cPickup::~cPickup()

View File

@ -1,7 +1,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPig.h"
cPig::cPig()
{
m_MobType = 90;

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPiston.h"
#include "cRedstone.h"
#include "cChunk.h"
@ -19,6 +22,10 @@ extern bool g_BlockPistonBreakable[];
#define FAST_FLOOR( x ) ( (x) < 0 ? ((int)x)-1 : ((int)x) )
cPiston::cPiston( cWorld* a_World )
:m_World ( a_World )
{

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPlayer.h"
#include "cServer.h"
#include "cCreativeInventory.h"
@ -7,7 +10,6 @@
#include "cPickup.h"
#include "cPluginManager.h"
#include "cChunk.h"
#include "cMCLogger.h"
#include "cWindow.h"
#include "cBlockEntity.h"
#include "cGroupManager.h"
@ -494,9 +496,6 @@ void cPlayer::SetIP( std::string a_IP )
m_IP = a_IP;
}
#ifdef SendMessage // Cause stupid windows.h defines SendMessage as SendMessageA
#undef SendMessage
#endif
void cPlayer::SendMessage( const char* a_Message )
{
m_ClientHandle->Send( cPacket_Chat( a_Message ) );

View File

@ -3,8 +3,10 @@
#include "cPawn.h"
#include "cSurvivalInventory.h"
#include "cCreativeInventory.h"
#include <list>
#include <string> // TODO - use const char*
class cGroup;
class cWindow;

View File

@ -1,7 +1,11 @@
#include "cPlugin.h"
#include <stdio.h>
#include "cMCLogger.h"
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPlugin.h"
cPlugin::cPlugin()
: m_Version( 0 )

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPluginManager.h"
#include "cPlugin.h"
#include "cPlugin_Lua.h"
@ -8,7 +11,6 @@
#include "cRoot.h"
#include "cLuaCommandBinder.h"
#include "../iniFile/iniFile.h"
#include <string> //strcmp
#include <stdarg.h>
#include "SquirrelBindings.h"
@ -18,6 +20,10 @@
#pragma warning(default:4100;default:4127;default:4510;default:4610;default:4244;default:4512)
#endif
extern std::vector<std::string> StringSplit(std::string str, std::string delim);
typedef std::list< cPlugin_Lua* > LuaPluginList;

View File

@ -1,6 +1,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#define LUA_USE_POSIX
#include "cMCLogger.h"
#include <string>
#include "cPlugin_Lua.h"
#include "cPluginManager.h"
#include "cRoot.h"

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#define LUA_USE_POSIX
#include "cPlugin_NewLua.h"
#include "cMCLogger.h"

View File

@ -1,10 +1,10 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cRecipeChecker.h"
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#ifndef _WIN32
#include <cstring>
@ -12,9 +12,12 @@
#endif
#include "Defines.h"
#include "cMCLogger.h"
#include "cRoot.h"
typedef std::list< cRecipeChecker::Recipe* > RecipeList;
struct cRecipeChecker::sRecipeCheckerState
{

View File

@ -1,11 +1,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cRedstone.h"
#include "cPiston.h"
#include "cRoot.h"
#include "cWorld.h"
#include "BlockID.h"
#include <iostream>
#include <vector>
#include <string>
cRedstone::cRedstone( cWorld* a_World )
:m_World ( a_World )

View File

@ -1,6 +1,13 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cReferenceManager.h"
#include "cEntity.h"
cReferenceManager::cReferenceManager( ENUM_REFERENCE_MANAGER_TYPE a_Type )
: m_Type( a_Type )
{

View File

@ -1,5 +1,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cRoot.h"
#include "cMCLogger.h"
#include "cServer.h"
#include "cWorld.h"
#include "cWebAdmin.h"

View File

@ -1,9 +1,15 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSandSimulator.h"
#include "cWorld.h"
#include "Vector3i.h"
#include "BlockID.h"
#include "Defines.h"
#include <vector>
cSandSimulator::cSandSimulator( cWorld* a_World )
: cSimulator(a_World)

View File

@ -1,14 +1,9 @@
#include "cSemaphore.h"
#include "cMCLogger.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#endif
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */ )
#ifndef _WIN32

View File

@ -1,10 +1,10 @@
// ReDucTor is an awesome guy who helped me a lot
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cServer.h"
#include "cClientHandle.h"
#include "cMCLogger.h"
#include "cThread.h"
#include "cEvent.h"
#include "cSleep.h"
#include "cTimer.h"
#include "cMonster.h"
@ -30,22 +30,18 @@
#include "packets/cPacket_Chat.h"
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
extern "C" {
#include "zlib.h"
}
#ifdef SendMessage
#undef SendMessage
#endif
bool g_bWaterPhysics = false;

View File

@ -1,3 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSheep.h"
//Todo: Implement color

View File

@ -1,5 +1,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSignEntity.h"
#include "cMCLogger.h"
#include "cPlayer.h"
#include "cClientHandle.h"
@ -11,6 +13,10 @@
#include <json/json.h>
cSignEntity::cSignEntity(ENUM_BLOCK_ID a_BlockType, int a_X, int a_Y, int a_Z, cChunk* a_Chunk)
: cBlockEntity(a_BlockType, a_X, a_Y, a_Z, a_Chunk)
{

View File

@ -1,5 +1,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSilverfish.h"
cSilverfish::cSilverfish()
{
m_MobType = 60;

View File

@ -1,9 +1,15 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSimulator.h"
#include "cWorld.h"
#include "Vector3i.h"
#include "BlockID.h"
#include "Defines.h"
#include <vector>
cSimulator::cSimulator( cWorld* a_World )
: m_World(a_World)

View File

@ -1,5 +1,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSimulatorManager.h"
#include <vector>
cSimulatorManager::cSimulatorManager()
{

Some files were not shown because too many files have changed in this diff Show More