Skip to content

Commit

Permalink
Merge pull request #4 from Zegeri/clean
Browse files Browse the repository at this point in the history
Fix Windows build
  • Loading branch information
eagleivg authored Sep 19, 2018
2 parents 71c3a08 + 8fd3b87 commit 6cb41f5
Show file tree
Hide file tree
Showing 25 changed files with 1,231 additions and 164 deletions.
379 changes: 369 additions & 10 deletions sdk/include/loki/HierarchyGenerators.h

Large diffs are not rendered by default.

28 changes: 3 additions & 25 deletions sdk/include/loki/TypeManip.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,7 @@ namespace Loki
template <bool flag, typename T, typename U>
struct Select
{
private:
template<bool>
struct In
{ typedef T Result; };

template<>
struct In<false>
{ typedef U Result; };

public:
typedef typename In<flag>::Result Result;
using Result = std::conditional_t<flag, T, U>;
};


Expand All @@ -84,20 +74,8 @@ namespace Loki
////////////////////////////////////////////////////////////////////////////////

template <typename T, typename U>
struct IsSameType
{
private:
template<typename>
struct In
{ enum { value = false }; };

template<>
struct In<T>
{ enum { value = true }; };

public:
enum { value = In<U>::value };
};
struct IsSameType : std::is_same<T, U>
{};

////////////////////////////////////////////////////////////////////////////////
// Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
Expand Down
813 changes: 755 additions & 58 deletions sdk/include/loki/Typelist.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define CALLBACK
#define TEXT(x) strdup(x)

/*
inline char* _strlwr_l(char* str, locale_t loc)
{
//TODO
Expand All @@ -58,6 +59,7 @@ inline char* _strupr_l(char* str, locale_t loc)
{
//TODO
}
*/

#define VOID void
#define HKL void*
Expand Down
9 changes: 8 additions & 1 deletion src/utils/xrSE_Factory/xrSE_Factory.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,14 @@
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(ProjectName)_script.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(ProjectName)_script.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<ClCompile Include="..\..\xrServerEntities\PHNetState.cpp" />
<ClCompile Include="..\..\xrServerEntities\PHNetState.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\xrServerEntities\PHSynchronize.cpp" />
<ClCompile Include="..\..\xrServerEntities\script_fcolor_script.cpp">
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pch_script.h</PrecompiledHeaderFile>
Expand Down
7 changes: 4 additions & 3 deletions src/xrGame/accumulative_states.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ struct accumulative_pair_t
}; // struct accumulative_pair_t
} // namespace detail

#define ACCUMULATIVE_STATE_LIST Loki::Typelist<>
#define ADD_ACCUMULATIVE_STATE(id, type) using Accumulative_State_Type_##type = \
Loki::TL::Prepend<detail::accumulative_pair_t<id, type>, ACCUMULATIVE_STATE_LIST>::result
#define ACCUMULATIVE_STATE_LIST Loki::NullType
#define ADD_ACCUMULATIVE_STATE(id, type) \
typedef Loki::Typelist<detail::accumulative_pair_t<id, type>, ACCUMULATIVE_STATE_LIST> \
Accumulative_State_Type_##type;
#define SAVE_TYPE_LIST(id, type) Accumulative_State_Type_##type

} // namespace award_system
Expand Down
20 changes: 10 additions & 10 deletions src/xrGame/alife_registry_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@
#include "alife_space.h"
#include "Common/object_type_traits.h"

template <typename, typename>
template <typename TContainer, typename TList>
struct RegistryHelper;

template <typename TContainer>
struct RegistryHelper<TContainer, Loki::Typelist<>>
struct RegistryHelper<TContainer, Loki::NullType>
{
static void Save(TContainer*, IWriter&) {};
static void Load(TContainer*, IReader&) {};
};

template <typename TContainer, typename T, typename... Ts>
struct RegistryHelper<TContainer, Loki::Typelist<T, Ts...>>
template <typename TContainer, typename Head, typename Tail>
struct RegistryHelper<TContainer, Loki::Typelist<Head, Tail>>
{
static constexpr bool isSerializable = object_type_traits::is_base_and_derived<ISerializable, T>::value;
static constexpr bool isSerializable =
object_type_traits::is_base_and_derived<ISerializable, Head>::value;

static void Save(TContainer* self, IWriter& writer)
{
if constexpr (isSerializable)
self->T::save(writer);
RegistryHelper<TContainer, Loki::Typelist<Ts...>>::Save(self, writer);
self->Head::save(writer);
RegistryHelper<TContainer, Tail>::Save(self, writer);
};

static void Load(TContainer* self, IReader& reader)
{
if constexpr (isSerializable)
self->T::load(reader);
RegistryHelper<TContainer, Loki::Typelist<Ts...>>::Load(self, reader);
self->Head::load(reader);
RegistryHelper<TContainer, Tail>::Load(self, reader);
}

};

void CALifeRegistryContainer::load(IReader& file_stream)
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/alife_registry_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct CLinearRegistryType : public _base, public _type
{
};

class CALifeRegistryContainer : public Loki::GenLinearHierarchy<registry_type_list, CLinearRegistryType>
class CALifeRegistryContainer : public Loki::GenLinearHierarchy<registry_type_list, CLinearRegistryType>::LinBase
{
private:
typedef registry_type_list TYPE_LIST;
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/alife_registry_container_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include <loki/HierarchyGenerators.h>
#define registry_type_list Loki::Typelist<>
#define add_to_registry_type_list(a) using registry_##a = Loki::TL::Prepend<a, registry_type_list>::result;
#define registry_type_list Loki::NullType
#define add_to_registry_type_list(a) typedef Loki::Typelist<a, registry_type_list> registry_##a;
#define define_constant(a) (a*)0
#define save_registry_type_list(a) registry_##a
7 changes: 3 additions & 4 deletions src/xrGame/alife_simulator_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,9 @@ SCRIPT_EXPORT(CALifeSimulator, (), {
.def("actor", &get_actor)
.def("has_info", &has_info)
.def("dont_has_info", &dont_has_info)
#ifndef LINUX // FIXME!!!
.def("switch_distance", &CALifeSimulator::switch_distance)
.def("set_switch_distance", &CALifeSimulator::set_switch_distance) //Alundaio: renamed to set_switch_distance from switch_distance
#endif
.def("switch_distance", (float (CALifeSimulator::*)())(&CALifeSimulator::switch_distance))
.def("set_switch_distance", (void (CALifeSimulator::*)(float))
(&CALifeSimulator::set_switch_distance)) //Alundaio: renamed to set_switch_distance from switch_distance
//Alundaio: extend alife simulator exports
.def("teleport_object", &teleport_object)
//Alundaio: END
Expand Down
5 changes: 3 additions & 2 deletions src/xrGame/base_client_classes_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ struct linear_registrator<_type, Loki::EmptyType> : public _type
template <typename _1, typename _2>
struct heritage
{
using tl = Loki::Typelist<_1, _2>;
using result = Loki::GenLinearHierarchy<tl, linear_registrator>;
typedef Loki::Typelist<_1, Loki::Typelist<_2, Loki::NullType>> tl;
typedef typename Loki::TL::Erase<tl, Loki::EmptyType>::Result pure_tl;
typedef typename Loki::GenLinearHierarchy<pure_tl, linear_registrator>::LinBase result;
};

template <typename base>
Expand Down
1 change: 0 additions & 1 deletion src/xrGame/game_state_accumulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class game_state_accumulator : public game_events_handler
bool check_accumulative_value(enum_accumulative_player_values param_id, u32_binary_function* func, u32 right_arg);

using accumulative_values_collection_t = AssociativeVector<enum_accumulative_player_values, player_state_param*>;

private:
// average_values_collection_t m_average_values;
accumulative_values_collection_t m_accumulative_values;
Expand Down
11 changes: 11 additions & 0 deletions src/xrGame/game_state_accumulator_inline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
template <typename TypeListElement>
void game_state_accumulator::init_acpv_list()
{
static_assert(Loki::TL::is_Typelist<TypeListElement>::value,
"Type must have a Loki Type List type use ADD_ACCUMULATIVE_STATE macro define.");
init_acpv_list<TypeListElement::Tail>();

player_state_param* tmp_obj_inst = new typename TypeListElement::Head::value_type(this);

m_accumulative_values.insert(std::make_pair(TypeListElement::Head::value_id, tmp_obj_inst));
}
13 changes: 7 additions & 6 deletions src/xrGame/game_state_accumulator_state_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,26 @@

namespace award_system
{

template <typename>
struct AccumulatorHelper;

template <>
struct AccumulatorHelper<Loki::Typelist<>> {
struct AccumulatorHelper<Loki::NullType> {
static void init_acpv(game_state_accumulator*,
game_state_accumulator::accumulative_values_collection_t&)
{
}
};

template <typename T, typename... Ts>
struct AccumulatorHelper<Loki::Typelist<T, Ts...>> {
template <typename Head, typename Tail>
struct AccumulatorHelper<Loki::Typelist<Head, Tail>> {
static void init_acpv(game_state_accumulator* self,
game_state_accumulator::accumulative_values_collection_t& accumulative_values)
{
AccumulatorHelper<Loki::Typelist<Ts...>>::init_acpv(self, accumulative_values);
player_state_param* tmp_obj_inst = new typename T::value_type(self);
accumulative_values.insert(std::make_pair(T::value_id, tmp_obj_inst));
AccumulatorHelper<Tail>::init_acpv(self, accumulative_values);
player_state_param* tmp_obj_inst = new typename Head::value_type(self);
accumulative_values.insert(std::make_pair(Head::value_id, tmp_obj_inst));
}
};

Expand Down
4 changes: 1 addition & 3 deletions src/xrGame/level_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,9 +781,7 @@ IC static void CLevel_Export(lua_State* luaState)
];

module(luaState)[def("command_line", &command_line),
#ifndef LINUX // FIXME!!!
def("IsGameTypeSingle", &IsGameTypeSingle),
#endif
def("IsGameTypeSingle", (bool (*)())&IsGameTypeSingle),
def("IsDynamicMusic", &IsDynamicMusic), def("render_get_dx_level", &render_get_dx_level),
def("IsImportantSave", &IsImportantSave)];

Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/login_manager_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ SCRIPT_EXPORT(profile, (), {
luaState)[class_<profile>("profile").def("unique_nick", &profile::unique_nick).def("online", &profile::online)];
});

#ifndef LINUX // FIXME!!!
SCRIPT_EXPORT(login_operation_cb, (), {
module(luaState)[class_<gamespy_gp::login_operation_cb>("login_operation_cb")
.def(constructor<>())
.def(constructor<gamespy_gp::login_operation_cb::lua_object_type,
gamespy_gp::login_operation_cb::lua_function_type>())
#ifndef LINUX // FIXME!!!
.def("bind", &gamespy_gp::login_operation_cb::bind)
#endif
.def("clear", &gamespy_gp::login_operation_cb::clear)];
});
#endif
4 changes: 2 additions & 2 deletions src/xrGame/profile_data_types_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ SCRIPT_EXPORT(profile_data_script_registrator, (), {
.def_readonly("second", &all_best_scores_t::value_type::second)];
});

#ifndef LINUX // FIXME!!!
SCRIPT_EXPORT(store_operation_cb, (), {
module(luaState)[class_<gamespy_profile::store_operation_cb>("store_operation_cb")
.def(constructor<>())
.def(constructor<gamespy_profile::store_operation_cb::lua_object_type,
gamespy_profile::store_operation_cb::lua_function_type>())
#ifndef LINUX // FIXME!!!
.def("bind", &gamespy_profile::store_operation_cb::bind)
#endif
.def("clear", &gamespy_profile::store_operation_cb::clear)];
});
#endif
4 changes: 2 additions & 2 deletions src/xrGame/ui/UIListBox_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ SCRIPT_EXPORT(SServerFilters, (), {
.def_readwrite("listen_servers", &SServerFilters::listen_servers)];
});

#ifndef LINUX // FIXME!!!
SCRIPT_EXPORT(connect_error_cb, (), {
module(luaState)[class_<connect_error_cb>("connect_error_cb")
.def(constructor<>())
.def(constructor<connect_error_cb::lua_object_type, connect_error_cb::lua_function_type>())
#ifndef LINUX // FIXME!!!
.def("bind", &connect_error_cb::bind)
#endif
.def("clear", &connect_error_cb::clear)];
});
#endif

SCRIPT_EXPORT(CServerList, (CUIWindow), {
module(luaState)[class_<CServerList, CUIWindow>("CServerList")
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ui/UIWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CUIWindow : public CUISimpleWindow
void ShowChildren(bool show);

//абсолютные координаты
IC void GetAbsoluteRect(Frect& r);
void GetAbsoluteRect(Frect& r);
IC void GetAbsolutePos(Fvector2& p)
{
Frect abs;
Expand Down
10 changes: 9 additions & 1 deletion src/xrGame/xrGame.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@
<ClInclude Include="game_path_manager.h" />
<ClInclude Include="game_path_manager_inline.h" />
<ClInclude Include="game_state_accumulator.h" />
<ClInclude Include="game_state_accumulator_inline.h" />
<ClInclude Include="game_sv_artefacthunt.h" />
<ClInclude Include="game_sv_base.h" />
<ClInclude Include="game_sv_base_console_vars.h" />
Expand Down Expand Up @@ -1642,7 +1643,14 @@
<PrecompiledHeaderFile>pch_script.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName)_script.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<ClCompile Include="..\xrServerEntities\PHNetState.cpp" />
<ClCompile Include="..\xrServerEntities\PHNetState.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\xrServerEntities\script_fcolor_script.cpp">
<PrecompiledHeaderFile>pch_script.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName)_script.pch</PrecompiledHeaderOutputFile>
Expand Down
3 changes: 3 additions & 0 deletions src/xrGame/xrGame.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -5682,6 +5682,9 @@
<ClInclude Include="game_state_accumulator.h">
<Filter>Core\Server\Games\client\mp\award_system\player_state</Filter>
</ClInclude>
<ClInclude Include="game_state_accumulator_inline.h">
<Filter>Core\Server\Games\client\mp\award_system\player_state</Filter>
</ClInclude>
<ClInclude Include="hits_store.h">
<Filter>Core\Server\Games\client\mp\award_system\player_state</Filter>
</ClInclude>
Expand Down
9 changes: 8 additions & 1 deletion src/xrPhysics/xrPhysics.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\xrServerEntities\PHNetState.cpp" />
<ClCompile Include="..\xrServerEntities\PHNetState.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Mixed|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ActorCameraCollision.cpp" />
<ClCompile Include="collisiondamagereceiver.cpp" />
<ClCompile Include="console_vars.cpp" />
Expand Down
Loading

0 comments on commit 6cb41f5

Please sign in to comment.