Skip to content

Commit

Permalink
Fixed xrGame compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Apr 1, 2019
1 parent b946718 commit e796fca
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion cs/engine/xrGame/NET_Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NET_Event
P.r (&*data.begin(),size);
}
}
void export (NET_Packet& P)
void Export (NET_Packet& P)
{
u16 ID = M_EVENT;
P.w_begin (ID );
Expand Down
3 changes: 1 addition & 2 deletions cs/engine/xrGame/PHShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ void CPHShell::EnabledCallbacks(BOOL val)


template< typename T>
void for_each_bone_id( IKinematics &K, T op )
void for_each_bone_id( IKinematics &K, T&& op )
{
u16 bn = K.LL_BoneCount();
for(u16 i = 0; i < bn; ++i )
Expand Down Expand Up @@ -1195,7 +1195,6 @@ CPHElement* get_physics_parent( IKinematics &k, u16 id )
static u16 element_position_in_set_calbacks=u16(-1);
void CPHShell::SetCallbacks( )
{

struct set_bone_callback
{
void operator() ( CPHElement* e){e->SetBoneCallback(); }
Expand Down
4 changes: 2 additions & 2 deletions cs/engine/xrGame/ai_object_location.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class CAI_ObjectLocation {
IC void init ();
IC void reinit ();
IC void game_vertex (CVertex const *game_vertex);
IC void game_vertex (_GRAPH_ID const &game_vertex_id);
void game_vertex (_GRAPH_ID const &game_vertex_id);
IC const CVertex *game_vertex () const;
IC const _GRAPH_ID game_vertex_id () const;
IC void level_vertex (CLevelVertex const *level_vertex);
IC void level_vertex (u32 const &level_vertex_id);
void level_vertex (u32 const &level_vertex_id);
IC const CLevelVertex *level_vertex () const;
IC const u32 level_vertex_id () const;
};
Expand Down
4 changes: 2 additions & 2 deletions cs/engine/xrGame/ai_object_location_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ IC void CAI_ObjectLocation::game_vertex (CVertex const *game_vertex)
m_game_vertex_id = ai().game_graph().vertex_id(game_vertex);
}

IC void CAI_ObjectLocation::game_vertex (_GRAPH_ID const &game_vertex_id)
void CAI_ObjectLocation::game_vertex (_GRAPH_ID const &game_vertex_id)
{
VERIFY (ai().game_graph().valid_vertex_id(game_vertex_id));
m_game_vertex_id = game_vertex_id;
Expand All @@ -50,7 +50,7 @@ IC void CAI_ObjectLocation::level_vertex (CLevelVertex const *level_vertex
m_level_vertex_id = ai().level_graph().vertex_id(level_vertex);
}

IC void CAI_ObjectLocation::level_vertex (u32 const &level_vertex_id)
void CAI_ObjectLocation::level_vertex (u32 const &level_vertex_id)
{
VERIFY (ai().level_graph().valid_vertex_id(level_vertex_id));
m_level_vertex_id = level_vertex_id;
Expand Down
6 changes: 0 additions & 6 deletions cs/engine/xrGame/object_handler_planner_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

#pragma once

IC CObjectHandlerPlanner::_condition_type CObjectHandlerPlanner::uid(const u32 id0, const u32 id1) const
{
VERIFY (!((id0 << 16) & id1));
return ((id0 << 16) | id1);
}

IC bool CObjectHandlerPlanner::object_action (u32 action_id, CObject *object)
{
return ((action_id >> 16) == object->ID());
Expand Down
6 changes: 6 additions & 0 deletions cs/engine/xrGame/object_handler_planner_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ IC u32 CObjectHandlerPlanner::current_action_state_id () const
{
return (action_state_id(current_action_id()));
}

IC CObjectHandlerPlanner::_condition_type CObjectHandlerPlanner::uid(const u32 id0, const u32 id1) const
{
VERIFY(!((id0 << 16) & id1));
return ((id0 << 16) | id1);
}
21 changes: 21 additions & 0 deletions cs/engine/xrGame/script_game_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
////////////////////////////////////////////////////////////////////////////

#include "pch_script.h"
#include "gameobject.h"
#include "script_game_object.h"
#include "script_game_object_impl.h"
#include "script_entity_action.h"
Expand Down Expand Up @@ -102,6 +103,26 @@ CScriptIniFile *CScriptGameObject::spawn_ini () const
return ((CScriptIniFile*)object().spawn_ini());
}

// Moved from script_game_object_impl.h because of linkage errors
#if 1
CGameObject &CScriptGameObject::object() const
{
#ifdef DEBUG
__try
{
if (m_game_object && m_game_object->lua_game_object() == this)
return (*m_game_object);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{}

ai().script_engine().script_log(eLuaMessageTypeError, "you are trying to use a destroyed object [%x]", m_game_object);
THROW2(m_game_object && m_game_object->lua_game_object() == this, "Probably, you are trying to use a destroyed object!");
#endif // #ifdef DEBUG
return (*m_game_object);
}
#endif

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/script_game_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CScriptGameObject {
virtual ~CScriptGameObject ();
operator CObject* ();

IC CGameObject &object () const;
CGameObject &object () const;
CScriptGameObject *Parent () const;
void Hit (CScriptHit *tLuaHit);
int clsid () const;
Expand Down
5 changes: 4 additions & 1 deletion cs/engine/xrGame/script_game_object_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "ai_space.h"
#include "script_engine.h"

// Moved to script_game_object.cpp due to linkage errors
#if 0
IC CGameObject &CScriptGameObject::object () const
{
#ifdef DEBUG
Expand All @@ -26,4 +28,5 @@ IC CGameObject &CScriptGameObject::object () const
THROW2 (m_game_object && m_game_object->lua_game_object() == this,"Probably, you are trying to use a destroyed object!");
#endif // #ifdef DEBUG
return (*m_game_object);
}
}
#endif
2 changes: 1 addition & 1 deletion cs/engine/xrGame/space_restriction_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ shared_str CSpaceRestrictionManager::base_out_restrictions (ALife::_OBJECT_ID i
return ((*I).second.m_base_out_restrictions);
}

IC CSpaceRestrictionManager::CRestrictionPtr CSpaceRestrictionManager::restriction (ALife::_OBJECT_ID id)
CSpaceRestrictionManager::CRestrictionPtr CSpaceRestrictionManager::restriction (ALife::_OBJECT_ID id)
{
CLIENT_RESTRICTIONS::iterator I = m_clients->find(id);
VERIFY (m_clients->end() != I);
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/space_restriction_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CSpaceRestrictionManager : public CSpaceRestrictionHolder {
protected:
IC void join_restrictions (shared_str &restrictions, shared_str update);
IC void difference_restrictions (shared_str &restrictions, shared_str update);
IC CRestrictionPtr restriction (ALife::_OBJECT_ID id);
CRestrictionPtr restriction (ALife::_OBJECT_ID id);
CRestrictionPtr restriction (shared_str out_restrictors, shared_str in_restrictors);
IC void collect_garbage ();
virtual void on_default_restrictions_changed ();
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/static_obstacles_avoider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "ai/stalker/ai_stalker.h"
#include "moving_object.h"

IC const CAI_Stalker &static_obstacles_avoider::object () const
const CAI_Stalker &static_obstacles_avoider::object () const
{
return (movement_manager().object());
}
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/static_obstacles_avoider.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class static_obstacles_avoider {
protected:
virtual void query ();
IC const stalker_movement_manager_obstacles &movement_manager () const;
IC const CAI_Stalker &object () const;
const CAI_Stalker &object () const;

public:
IC static_obstacles_avoider();
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/visual_memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ CVisibleObject *CVisualMemoryManager::visible_object (const CGameObject *game_ob
return (&*I);
}

IC squad_mask_type CVisualMemoryManager::mask () const
squad_mask_type CVisualMemoryManager::mask () const
{
if (!m_stalker)
return (squad_mask_type(-1));
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrGame/visual_memory_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class CVisualMemoryManager {
IC const RAW_VISIBLES &raw_objects () const;
IC const NOT_YET_VISIBLES &not_yet_visible_objects () const;
IC const CVisionParameters &current_state () const;
IC squad_mask_type mask () const;
squad_mask_type mask () const;

public:
#ifdef DEBUG
Expand Down
11 changes: 0 additions & 11 deletions cs/engine/xrServerEntities/xrServer_Objects_ALife_Monsters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,17 +1092,6 @@ bool CSE_ALifeCreatureAbstract::can_switch_offline () const
return (inherited::can_switch_offline() && (get_health() > 0.f));
}

IC void CSE_ALifeCreatureAbstract::set_health (float const health_value)
{
VERIFY( !((get_killer_id() != u16(-1)) && (health_value > 0.f)) );
fHealth = health_value;
}

IC void CSE_ALifeCreatureAbstract::set_killer_id (ALife::_OBJECT_ID const killer_id)
{
m_killer_id = killer_id;
}

////////////////////////////////////////////////////////////////////////////
// CSE_ALifeMonsterAbstract
////////////////////////////////////////////////////////////////////////////
Expand Down
9 changes: 7 additions & 2 deletions cs/engine/xrServerEntities/xrServer_Objects_ALife_Monsters.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,13 @@ SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeCreatureAbstract,CSE_ALifeDynamicObjectVisu
IC float get_health () const { return fHealth;}
IC ALife::_OBJECT_ID get_killer_id () const { return m_killer_id; }

IC void set_health (float const health_value);
IC void set_killer_id (ALife::_OBJECT_ID const killer_id);
IC void set_health(float const health_value)
{
VERIFY(!((get_killer_id() != u16(-1)) && (health_value > 0.f)));
fHealth = health_value;
}

IC void set_killer_id (ALife::_OBJECT_ID const killer_id) { m_killer_id = killer_id; }

IC bool g_Alive () const { return (get_health() > 0.f);}
virtual bool used_ai_locations () const;
Expand Down

0 comments on commit e796fca

Please sign in to comment.