Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.sdf
*.opensdf
*.aps
*.db
2 changes: 1 addition & 1 deletion Dependencies/Detours.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(DETOURS_DIR)\Detours.props" />
<Import Project="C:\HiveDeps\Detours\Detours.props" />
</ImportGroup>
</Project>
2 changes: 1 addition & 1 deletion Dependencies/MySQL.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(MYSQL_DIR)\MySQL.props" />
<Import Project="C:\HiveDeps\MySQL\MySQL.props" />
</ImportGroup>
</Project>
2 changes: 1 addition & 1 deletion Dependencies/Poco.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(POCO_DIR)\Poco.props" />
<Import Project="C:\HiveDeps\poco\Poco.props" />
</ImportGroup>
</Project>
2 changes: 1 addition & 1 deletion Dependencies/PostgreSQL.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(POSTGRESQL_DIR)\PostgreSQL.props" />
<Import Project="C:\HiveDeps\PostgreSQL\PostgreSQL.props" />
</ImportGroup>
</Project>
2 changes: 1 addition & 1 deletion Dependencies/TBB.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(TBB_DIR)\TBB.props" />
<Import Project="C:\HiveDeps\TBB\TBB.props" />
</ImportGroup>
</Project>
12 changes: 7 additions & 5 deletions Hive/Source/Database/Database.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,21 @@
<ProjectGuid>{E0E04F80-0DB4-4946-B956-4BCA754DAB71}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Database</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -80,11 +81,12 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Development\Libraries\boost_1_55_0\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Development\Libraries\boost_1_55_0\lib\x86\v120\lib;$(LibraryPath)</LibraryPath>
<IncludePath>C:\HiveDeps\boost\boost;$(IncludePath)</IncludePath>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -117,7 +119,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DATABASE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)$(UniversalCRT_IncludePath)C:\HiveDeps\boost;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
11 changes: 11 additions & 0 deletions Hive/Source/Database/Field.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ class Field
float getFloat() const { return static_cast<float>(getDouble()); }
bool getBool() const { return _value ? atoi(_value) > 0 : false; }
Int32 getInt32() const { return _value ? static_cast<Int32>(atol(_value)) : Int32(0); }
Int64 getInt64() const
{
if (!_value)
return 0;

Int64 parsedVal;
if (!Poco::NumberParser::tryParse64(_value, parsedVal))
return 0;

return parsedVal;
}
Int8 getInt8() const { return _value ? static_cast<Int8>(atol(_value)) : Int8(0); }
UInt8 getUInt8() const { return _value ? static_cast<UInt8>(atol(_value)) : UInt8(0); }
UInt16 getUInt16() const { return _value ? static_cast<UInt16>(atol(_value)) : UInt16(0); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@
<ProjectGuid>{E6BA8EFD-342A-409B-9273-6463009E5DCA}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DatabaseMySql</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -67,11 +68,12 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Development\Libraries\boost_1_55_0\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Development\Libraries\boost_1_55_0\lib\x86\v120\lib;$(LibraryPath)</LibraryPath>
<IncludePath>C:\HiveDeps\boost\boost;$(IncludePath)</IncludePath>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -104,7 +106,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DATABASEMYSQL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)$(UniversalCRT_IncludePath)C:\HiveDeps\boost;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@
<ProjectGuid>{3A94A40D-418F-4890-829D-7CD16EA1AB6C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DatabasePostgre</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -67,8 +68,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Development\Libraries\boost_1_55_0\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Development\Libraries\boost_1_55_0\lib\x86\v120\lib;$(LibraryPath)</LibraryPath>
<IncludePath>C:\HiveDeps\boost\boost;$(IncludePath)</IncludePath>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down
12 changes: 7 additions & 5 deletions Hive/Source/HiveExt/HiveExt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>HiveExt</RootNamespace>
<ProjectName>HiveExt</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -66,11 +67,12 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Development\Libraries\boost_1_55_0\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Development\Libraries\boost_1_55_0\lib\x86\v120\lib;$(LibraryPath)</LibraryPath>
<IncludePath>C:\HiveDeps\boost\boost;$(IncludePath)</IncludePath>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>C:\HiveDeps\boost\lib\x86\v141\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -111,7 +113,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)$(UniversalCRT_IncludePath)C:\HiveDeps\boost;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
37 changes: 30 additions & 7 deletions Hive/Source/HiveLib/DataSource/CharDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* "Hatchet_Swing","Crowbar_Swing","Machete_Swing","Bat_Swing","BatBarbed_Swing","BatNails_Swing","Fishing_Swing"
*/

#include "CharDataSource.h"
Expand All @@ -26,6 +28,11 @@ namespace
{
MELEE_HATCHET,
MELEE_CROWBAR,
MELEE_MACHETE,
MELEE_BAT,
MELEE_BATBARBED,
MELEE_BATNAILS,
MELEE_FISHING,
MELEE_COUNT
};

Expand All @@ -34,34 +41,50 @@ namespace
public:
MeleeAmmoType operator()(const string& itemClass) const
{
if (boost::iequals(itemClass,"Hatchet_Swing"))
//"Hatchet_Swing","Crowbar_Swing","Machete_Swing","Bat_Swing","BatBarbed_Swing","BatNails_Swing","Fishing_Swing"
if (boost::iequals(itemClass, "Hatchet_Swing"))
return MELEE_HATCHET;
else if (boost::iequals(itemClass,"crowbar_swing"))
else if (boost::iequals(itemClass, "crowbar_swing"))
return MELEE_CROWBAR;
else if (boost::iequals(itemClass, "Machete_Swing"))
return MELEE_MACHETE;
else if (boost::iequals(itemClass, "Bat_Swing"))
return MELEE_BAT;
else if (boost::iequals(itemClass, "BatBarbed_Swing"))
return MELEE_BATBARBED;
else if (boost::iequals(itemClass, "BatNails_Swing"))
return MELEE_BATNAILS;
else if (boost::iequals(itemClass, "Fishing_Swing"))
return MELEE_FISHING;
else
return MELEE_COUNT;
}
template<typename T> MeleeAmmoType operator()(const T& other) const { return MELEE_COUNT; }
template<typename T> MeleeAmmoType operator()(const T& other) const { return MELEE_COUNT; }
};
}

int CharDataSource::SanitiseInv( Sqf::Parameters& origInv )
int CharDataSource::SanitiseInv(Sqf::Parameters& origInv)
{
if (origInv.size() != 2) //empty inv or not conforming to [weapons, magazines] layout
return 0;

map<MeleeAmmoType,int> numAmmo;
map<MeleeAmmoType, int> numAmmo;
numAmmo[MELEE_HATCHET] = 0;
numAmmo[MELEE_CROWBAR] = 0;
numAmmo[MELEE_MACHETE] = 0;
numAmmo[MELEE_BAT] = 0;
numAmmo[MELEE_BATBARBED] = 0;
numAmmo[MELEE_BATNAILS] = 0;
numAmmo[MELEE_FISHING] = 0;

try
{
int numErased = 0;

Sqf::Parameters& magazines = boost::get<Sqf::Parameters>(origInv.at(1));
for (auto it=magazines.begin();it!=magazines.end();)
for (auto it = magazines.begin(); it != magazines.end();)
{
MeleeAmmoType ammoType = boost::apply_visitor(MeleeAmmoVisitor(),*it);
MeleeAmmoType ammoType = boost::apply_visitor(MeleeAmmoVisitor(), *it);
if (ammoType != MELEE_COUNT)
{
++numAmmo[ammoType];
Expand Down
12 changes: 7 additions & 5 deletions Hive/Source/HiveLib/DataSource/CharDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ class CharDataSource
virtual ~CharDataSource() {}

virtual Sqf::Value fetchCharacterInitial( string playerId, int serverId, const string& playerName ) = 0;
virtual Sqf::Value fetchCharacterDetails( int characterId ) = 0;
virtual Sqf::Value fetchCharacterDetails( Int64 characterId ) = 0;
virtual Sqf::Value fetchTraderObject( int traderObjectId, int action ) = 0;
typedef map<string,Sqf::Value> FieldsType;
virtual bool updateCharacter( int characterId, int serverId, const FieldsType& fields ) = 0;
virtual bool initCharacter( int characterId, const Sqf::Value& inventory, const Sqf::Value& backpack ) = 0;
virtual bool killCharacter( int characterId, int duration, int infected ) = 0;
virtual bool recordLogin( string playerId, int characterId, int action ) = 0;
virtual bool updateCharacter( Int64 characterId, int serverId, const FieldsType& fields ) = 0;
virtual bool updateCharacterGroup(string playerId, int serverId, const Sqf::Value& playerGroup ) = 0;
virtual bool updatePlayerCoins(string playerId, int serverId, Int64 coinsValue, Int64 playerBank ) = 0;
virtual bool initCharacter( Int64 characterId, const Sqf::Value& inventory, const Sqf::Value& backpack ) = 0;
virtual bool killCharacter( Int64 characterId, int duration, int infected ) = 0;
virtual bool recordLogin( string playerId, Int64 characterId, int action ) = 0;
protected:
static int SanitiseInv(Sqf::Parameters& origInv);
};
5 changes: 3 additions & 2 deletions Hive/Source/HiveLib/DataSource/ObjDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ class ObjDataSource

typedef std::queue<Sqf::Parameters> ServerObjectsQueue;
virtual void populateObjects( int serverId, ServerObjectsQueue& queue ) = 0;
virtual void populateTraderObjects( int characterId, ServerObjectsQueue& queue ) = 0;
virtual void populateTraderObjects( Int64 characterId, ServerObjectsQueue& queue ) = 0;
virtual bool updateObjectInventory( int serverId, Int64 objectIdent, bool byUID, const Sqf::Value& inventory ) = 0;
virtual bool updateObjectInventoryWCoins(int serverId, Int64 objectIdent, bool byUID, const Sqf::Value& inventory, Int64 coinsValue ) = 0;
virtual bool deleteObject( int serverId, Int64 objectIdent, bool byUID ) = 0;
virtual bool updateDatestampObject( int serverId, Int64 objectIdent, bool byUID ) = 0;
virtual bool updateVehicleMovement( int serverId, Int64 objectIdent, const Sqf::Value& worldspace, double fuel ) = 0;
virtual bool updateVehicleStatus( int serverId, Int64 objectIdent, const Sqf::Value& hitPoints, double damage ) = 0;
virtual bool createObject( int serverId, const string& className, double damage, int characterId,
virtual bool createObject( int serverId, const string& className, double damage, Int64 characterId,
const Sqf::Value& worldSpace, const Sqf::Value& inventory, const Sqf::Value& hitPoints, double fuel, Int64 uniqueId ) = 0;
virtual Sqf::Value fetchObjectId( int serverId, Int64 objectUID ) = 0;
};
Loading