Skip to content

Commit 1b8ecad

Browse files
committed
xrAICore: now build on Linux
1 parent 3e74439 commit 1b8ecad

27 files changed

+265
-271
lines changed

src/Common/PlatformLinux.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ typedef dirent DirEntryType;
220220
#define stricmp strcasecmp
221221
#define strncpy_s(dest, size, source, num) (NULL == strncpy(dest, source, num))
222222
#define strcpy_s(dest, num, source) (NULL == strcpy(dest, source))
223+
#define strcat_s(dest, num, source) (dest == strcat(dest, source))
223224
#define _vsnprintf vsnprintf
225+
#define vsprintf_s(dest, size, format, args) vsprintf(dest, format, args)
224226
#define _alloca alloca
225227
#define _snprintf snprintf
226228
#define sprintf_s(buffer, buffer_size, stringbuffer, ...) sprintf(buffer, stringbuffer, ##__VA_ARGS__)

src/Common/object_loader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct CLoader
3838
template <bool pointer>
3939
static void load_data(std::enable_if_t<!pointer, T&> data, M& stream, const P& p)
4040
{
41-
CHelper1<T>::load_data<object_type_traits::is_base_and_derived<ISerializable, T>::value>(data, stream, p);
41+
CHelper1<T>::template load_data<object_type_traits::is_base_and_derived<ISerializable, T>::value>(data, stream, p);
4242
}
4343

4444
template <bool pointer>
@@ -117,7 +117,7 @@ struct CLoader
117117
template <bool a>
118118
static void load_data(std::enable_if_t<!a, T&> data, M& stream, const P& p)
119119
{
120-
CHelper<T>::load_data<object_type_traits::is_pointer<T>::value>(data, stream, p);
120+
CHelper<T>::template load_data<object_type_traits::is_pointer<T>::value>(data, stream, p);
121121
}
122122

123123
template <bool a>

src/xrAICore/CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
project(xrAICore)
22

33
list(APPEND DIRS
4-
"."
5-
"Components"
6-
"Navigation"
7-
"Navigation/PatrolPath"
8-
"Navigation/PathManagers"
9-
)
4+
"."
5+
"Components"
6+
"Navigation"
7+
"Navigation/PatrolPath"
8+
"Navigation/PathManagers"
9+
)
1010

1111
add_dir("${DIRS}")
1212

1313
include_directories(
14-
${CMAKE_CURRENT_SOURCE_DIR}/..
15-
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
16-
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
17-
)
14+
${CMAKE_CURRENT_SOURCE_DIR}/..
15+
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
16+
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
17+
)
1818

1919
#foreach(header ${${PROJECT_NAME}__INCLUDES})
2020
# if (${header} MATCHES _inline.h$)
@@ -26,4 +26,4 @@ add_definitions(-DXRAICORE_EXPORTS -DAI_COMPILER -D_SECURE_SCL=0)
2626
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
2727

2828
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
29-
target_link_libraries(${PROJECT_NAME} xrCore xrAPI xrScriptEngine luabind LuaJIT)
29+
target_link_libraries(${PROJECT_NAME} xrCore xrAPI xrScriptEngine luabind luajit)

src/xrAICore/Components/condition_state.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ class CConditionState
1717
typedef _world_property COperatorCondition;
1818

1919
protected:
20-
xr_vector<COperatorCondition> m_conditions;
20+
xr_vector<_world_property> m_conditions;
2121
u32 m_hash;
2222

2323
public:
2424
IC CConditionState();
2525
IC virtual ~CConditionState();
26-
IC const xr_vector<COperatorCondition>& conditions() const;
27-
IC u8 weight(const CConditionState& condition) const;
28-
IC void add_condition(const COperatorCondition& condition);
29-
IC void remove_condition(const typename COperatorCondition::_condition_type& condition);
26+
IC const xr_vector<_world_property>& conditions() const;
27+
IC u8 weight(const _world_property& condition) const;
28+
IC void add_condition(const _world_property& condition);
29+
IC void remove_condition(const typename _world_property::condition_type& condition);
3030
IC void add_condition(
31-
typename xr_vector<COperatorCondition>::const_iterator& J, const COperatorCondition& condition);
32-
IC void add_condition_back(const COperatorCondition& condition);
31+
typename xr_vector<_world_property>::const_iterator& J, const _world_property& condition);
32+
IC void add_condition_back(const _world_property& condition);
3333
IC bool includes(const CConditionState& condition) const;
3434
IC void clear();
3535
IC bool operator<(const CConditionState& condition) const;
3636
IC CConditionState<_world_property>& operator-=(const CConditionState& condition);
3737
IC bool operator==(const CConditionState& condition) const;
3838
IC u32 hash_value() const;
39-
IC const COperatorCondition* property(const typename COperatorCondition::_condition_type& condition) const;
39+
IC const _world_property* property(const typename _world_property::condition_type& condition) const;
4040
};
4141

4242
#include "xrAICore/Components/condition_state_inline.h"

src/xrAICore/Components/condition_state_inline.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,41 @@ IC CConditionStateAbstract::CConditionState()
2222
TEMPLATE_SPECIALIZATION
2323
CConditionStateAbstract::~CConditionState() {}
2424
TEMPLATE_SPECIALIZATION
25-
IC const xr_vector<typename CConditionStateAbstract::COperatorCondition>& CConditionStateAbstract::conditions() const
25+
IC const xr_vector<_world_property>& CConditionStateAbstract::conditions() const
2626
{
2727
return (m_conditions);
2828
}
2929

3030
TEMPLATE_SPECIALIZATION
31-
IC void CConditionStateAbstract::add_condition_back(const COperatorCondition& condition)
31+
IC void CConditionStateAbstract::add_condition_back(const _world_property& condition)
3232
{
3333
THROW(m_conditions.empty() || (m_conditions.back().condition() < condition.condition()));
3434
m_conditions.push_back(condition);
3535
m_hash ^= condition.hash_value();
3636
}
3737

3838
TEMPLATE_SPECIALIZATION
39-
IC void CConditionStateAbstract::add_condition(const COperatorCondition& condition)
39+
IC void CConditionStateAbstract::add_condition(const _world_property& condition)
4040
{
41-
typename xr_vector<COperatorCondition>::iterator I = std::lower_bound(m_conditions.begin(), m_conditions.end(), condition);
41+
typename xr_vector<_world_property>::iterator I = std::lower_bound(m_conditions.begin(), m_conditions.end(), condition);
4242
THROW((I == m_conditions.end()) || ((*I).condition() != condition.condition()));
4343
m_conditions.insert(I, condition);
4444
m_hash ^= condition.hash_value();
4545
}
4646

4747
TEMPLATE_SPECIALIZATION
48-
IC void CConditionStateAbstract::remove_condition(const typename COperatorCondition::_condition_type& condition)
48+
IC void CConditionStateAbstract::remove_condition(const typename _world_property::condition_type& condition)
4949
{
50-
typename xr_vector<COperatorCondition>::iterator I = std::lower_bound(
51-
m_conditions.begin(), m_conditions.end(), COperatorCondition(condition, COperatorCondition::_value_type(0)));
50+
typename xr_vector<_world_property>::iterator I = std::lower_bound(
51+
m_conditions.begin(), m_conditions.end(), _world_property(condition, typename _world_property::value_type(0)));
5252
THROW((I != m_conditions.end()) && ((*I).condition() == condition));
5353
m_hash ^= (*I).hash_value();
5454
m_conditions.erase(I);
5555
}
5656

5757
TEMPLATE_SPECIALIZATION
5858
IC void CConditionStateAbstract::add_condition(
59-
typename xr_vector<COperatorCondition>::const_iterator& J, const COperatorCondition& condition)
59+
typename xr_vector<_world_property>::const_iterator& J, const _world_property& condition)
6060
{
6161
m_conditions.insert(m_conditions.begin() + (J - m_conditions.begin()), condition);
6262
m_hash ^= condition.hash_value();
@@ -70,13 +70,13 @@ IC void CConditionStateAbstract::clear()
7070
}
7171

7272
TEMPLATE_SPECIALIZATION
73-
IC u8 CConditionStateAbstract::weight(const CConditionState& condition) const
73+
IC u8 CConditionStateAbstract::weight(const _world_property& condition) const
7474
{
7575
u8 result = 0;
76-
typename xr_vector<COperatorCondition>::const_iterator I = conditions().begin();
77-
typename xr_vector<COperatorCondition>::const_iterator E = conditions().end();
78-
typename xr_vector<COperatorCondition>::const_iterator i = condition.conditions().begin();
79-
typename xr_vector<COperatorCondition>::const_iterator e = condition.conditions().end();
76+
typename xr_vector<_world_property>::const_iterator I = conditions().begin();
77+
typename xr_vector<_world_property>::const_iterator E = conditions().end();
78+
typename xr_vector<_world_property>::const_iterator i = condition.conditions().begin();
79+
typename xr_vector<_world_property>::const_iterator e = condition.conditions().end();
8080
for (; (I != E) && (i != e);)
8181
if ((*I).condition() < (*i).condition())
8282
++I;
@@ -95,10 +95,10 @@ IC u8 CConditionStateAbstract::weight(const CConditionState& condition) const
9595
TEMPLATE_SPECIALIZATION
9696
IC bool CConditionStateAbstract::operator<(const CConditionState& condition) const
9797
{
98-
typename xr_vector<COperatorCondition>::const_iterator I = conditions().begin();
99-
typename xr_vector<COperatorCondition>::const_iterator E = conditions().end();
100-
typename xr_vector<COperatorCondition>::const_iterator i = condition.conditions().begin();
101-
typename xr_vector<COperatorCondition>::const_iterator e = condition.conditions().end();
98+
typename xr_vector<_world_property>::const_iterator I = conditions().begin();
99+
typename xr_vector<_world_property>::const_iterator E = conditions().end();
100+
typename xr_vector<_world_property>::const_iterator i = condition.conditions().begin();
101+
typename xr_vector<_world_property>::const_iterator e = condition.conditions().end();
102102
for (; (I != E) && (i != e); ++I, ++i)
103103
if (*I < *i)
104104
return (true);
@@ -118,10 +118,10 @@ IC bool CConditionStateAbstract::operator==(const CConditionState& condition) co
118118
{
119119
if (hash_value() != condition.hash_value())
120120
return (false);
121-
typename xr_vector<COperatorCondition>::const_iterator I = conditions().begin();
122-
typename xr_vector<COperatorCondition>::const_iterator E = conditions().end();
123-
typename xr_vector<COperatorCondition>::const_iterator i = condition.conditions().begin();
124-
typename xr_vector<COperatorCondition>::const_iterator e = condition.conditions().end();
121+
typename xr_vector<_world_property>::const_iterator I = conditions().begin();
122+
typename xr_vector<_world_property>::const_iterator E = conditions().end();
123+
typename xr_vector<_world_property>::const_iterator i = condition.conditions().begin();
124+
typename xr_vector<_world_property>::const_iterator e = condition.conditions().end();
125125
for (; (I != E) && (i != e); ++I, ++i)
126126
if (!(*I == *i))
127127
return (false);
@@ -134,11 +134,11 @@ TEMPLATE_SPECIALIZATION
134134
IC CConditionState<_world_property>& CConditionStateAbstract::operator-=(const CConditionState& condition)
135135
{
136136
m_hash = 0;
137-
xr_vector<COperatorCondition> temp;
138-
typename xr_vector<COperatorCondition>::const_iterator I = conditions().begin();
139-
typename xr_vector<COperatorCondition>::const_iterator E = conditions().end();
140-
typename xr_vector<COperatorCondition>::const_iterator i = condition.conditions().begin();
141-
typename xr_vector<COperatorCondition>::const_iterator e = condition.conditions().end();
137+
xr_vector<_world_property> temp;
138+
typename xr_vector<_world_property>::const_iterator I = conditions().begin();
139+
typename xr_vector<_world_property>::const_iterator E = conditions().end();
140+
typename xr_vector<_world_property>::const_iterator i = condition.conditions().begin();
141+
typename xr_vector<_world_property>::const_iterator e = condition.conditions().end();
142142
for (; (I != E) && (i != e);)
143143
if ((*I).condition() < (*i).condition())
144144
++I;
@@ -161,10 +161,10 @@ IC CConditionState<_world_property>& CConditionStateAbstract::operator-=(const C
161161
TEMPLATE_SPECIALIZATION
162162
IC bool CConditionStateAbstract::includes(const CConditionState& condition) const
163163
{
164-
typename xr_vector<COperatorCondition>::const_iterator I = conditions().begin();
165-
typename xr_vector<COperatorCondition>::const_iterator E = conditions().end();
166-
typename xr_vector<COperatorCondition>::const_iterator i = condition.conditions().begin();
167-
typename xr_vector<COperatorCondition>::const_iterator e = condition.conditions().end();
164+
typename xr_vector<_world_property>::const_iterator I = conditions().begin();
165+
typename xr_vector<_world_property>::const_iterator E = conditions().end();
166+
typename xr_vector<_world_property>::const_iterator i = condition.conditions().begin();
167+
typename xr_vector<_world_property>::const_iterator e = condition.conditions().end();
168168
for (; (I != E) && (i != e);)
169169
if ((*I).condition() < (*i).condition())
170170
++I;
@@ -183,11 +183,11 @@ IC bool CConditionStateAbstract::includes(const CConditionState& condition) cons
183183
TEMPLATE_SPECIALIZATION
184184
IC u32 CConditionStateAbstract::hash_value() const { return (m_hash); }
185185
TEMPLATE_SPECIALIZATION
186-
IC const typename CConditionStateAbstract::COperatorCondition* CConditionStateAbstract::property(
187-
const typename CConditionStateAbstract::COperatorCondition::_condition_type& condition) const
186+
IC const _world_property* CConditionStateAbstract::property(
187+
const typename _world_property::condition_type& condition) const
188188
{
189-
typename xr_vector<COperatorCondition>::const_iterator I = std::lower_bound(
190-
conditions().begin(), conditions().end(), COperatorCondition(condition, COperatorCondition::_value_type(0)));
189+
typename xr_vector<_world_property>::const_iterator I = std::lower_bound(
190+
conditions().begin(), conditions().end(), _world_property(condition, typename _world_property::value_type(0)));
191191
if (I == m_conditions.end())
192192
return (0);
193193
else

src/xrAICore/Components/operator_abstract.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
template <typename _world_property, typename _edge_value_type>
1414
class COperatorAbstract
1515
{
16-
public:
17-
typedef _edge_value_type _edge_value_type;
18-
1916
protected:
2017
typedef CConditionState<_world_property> inherited;
2118
typedef inherited CSConditionState;

0 commit comments

Comments
 (0)