Skip to content

Commit

Permalink
Moved a bunch of CALifeSimulatorBase member functions to not-inline f…
Browse files Browse the repository at this point in the history
…or DEBUG builds to reduce macro-expansion bloat.
  • Loading branch information
tamlin-mike authored and Xottab-DUTY committed Aug 5, 2017
1 parent 56d8280 commit 2fc32b2
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 109 deletions.
20 changes: 12 additions & 8 deletions src/xrGame/alife_simulator_base.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
////////////////////////////////////////////////////////////////////////////
// Module : alife_simulator_base.cpp
// Created : 25.12.2002
// Modified : 12.05.2004
// Author : Dmitriy Iassenev
// Description : ALife Simulator base class
// Module : alife_simulator_base.cpp
// Created : 25.12.2002
// Modified : 12.05.2004
// Author : Dmitriy Iassenev
// Description : ALife Simulator base class
////////////////////////////////////////////////////////////////////////////

#include "pch_script.h"
Expand All @@ -23,6 +23,10 @@
#include "inventory_upgrade_manager.h"
#include "Level.h"

#ifdef DEBUG
#include "alife_simulator_base_inline.h"
#endif

#pragma warning(push)
#pragma warning(disable : 4995)
#include <malloc.h>
Expand Down Expand Up @@ -94,7 +98,7 @@ CSE_Abstract* CALifeSimulatorBase::spawn_item(LPCSTR section, const Fvector& pos
R_ASSERT3(abstract, "Cannot find item with section", section);

abstract->s_name = section;
//. abstract->s_gameid = u8(GAME_SINGLE);
//. abstract->s_gameid = u8(GAME_SINGLE);
abstract->s_RP = 0xff;
abstract->ID = server().PerformIDgen(0xffff);
abstract->ID_Parent = parent_id;
Expand Down Expand Up @@ -132,7 +136,7 @@ CSE_Abstract* CALifeSimulatorBase::spawn_item(LPCSTR section, const Fvector& pos
dynamic_object->spawn_supplies();
dynamic_object->on_spawn();

// Msg ("LSS : SPAWN : [%s],[%s], level
// Msg ("LSS : SPAWN : [%s],[%s], level
//%s",*dynamic_object->s_name,dynamic_object->name_replace(),*ai().game_graph().header().level(ai().game_graph().vertex(dynamic_object->m_tGraphID)->level_id()).name());
return (dynamic_object);
}
Expand Down Expand Up @@ -240,7 +244,7 @@ void CALifeSimulatorBase::create(CSE_ALifeObject* object)
VERIFY(dynamic_object->m_bOnline);

#ifdef DEBUG
// Msg ("Creating object from client spawn
// Msg ("Creating object from client spawn
//[%d][%d][%s][%s]",dynamic_object->ID,dynamic_object->ID_Parent,dynamic_object->name(),dynamic_object->name_replace());
#endif

Expand Down
73 changes: 37 additions & 36 deletions src/xrGame/alife_simulator_base.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
////////////////////////////////////////////////////////////////////////////
// Module : alife_simulator_base.h
// Created : 25.12.2002
// Modified : 12.05.2004
// Author : Dmitriy Iassenev
// Description : ALife Simulator base class
// Module : alife_simulator_base.h
// Created : 25.12.2002
// Modified : 12.05.2004
// Author : Dmitriy Iassenev
// Description : ALife Simulator base class
////////////////////////////////////////////////////////////////////////////

#pragma once
Expand Down Expand Up @@ -62,48 +62,47 @@ class CALifeSimulatorBase : public IPureDestroyableObject
ALife::SCHEDULE_P_VECTOR m_tpaCombatGroups[2];

protected:
IC CALifeSimulatorHeader& header();
IC CALifeTimeManager& time();
IC CALifeSpawnRegistry& spawns();
IC CALifeObjectRegistry& objects();
IC CALifeStoryRegistry& story_objects();
IC CALifeSmartTerrainRegistry& smart_terrains();
IC CALifeGroupRegistry& groups();
IC void can_register_objects(const bool& value);
IC const bool& can_register_objects() const;
CALifeSimulatorHeader& header();
CALifeTimeManager& time();
CALifeSpawnRegistry& spawns();
CALifeObjectRegistry& objects();
CALifeStoryRegistry& story_objects();
CALifeSmartTerrainRegistry& smart_terrains();
CALifeGroupRegistry& groups();
void can_register_objects(bool value);
const bool& can_register_objects() const { return m_can_register_objects; }

public:
IC CALifeGraphRegistry& graph();
IC CALifeScheduleRegistry& scheduled();
IC CALifeTimeManager& time_manager();
IC CALifeRegistryContainer& registry() const;
IC inventory::upgrade::Manager& inventory_upgrade_manager() const;
CALifeGraphRegistry& graph();
CALifeScheduleRegistry& scheduled();
CALifeTimeManager& time_manager();
CALifeRegistryContainer& registry() const;
inventory::upgrade::Manager& inventory_upgrade_manager() const;

public:
CALifeSimulatorBase(IPureServer* server, LPCSTR section);
virtual ~CALifeSimulatorBase();
virtual void destroy();
IC bool initialized() const;
IC const CALifeSimulatorHeader& header() const;
IC const CALifeTimeManager& time() const;
IC const CALifeSpawnRegistry& spawns() const;
IC const CALifeObjectRegistry& objects() const;
IC const CALifeGraphRegistry& graph() const;
IC const CALifeScheduleRegistry& scheduled() const;
IC const CALifeStoryRegistry& story_objects() const;
IC const CALifeSmartTerrainRegistry& smart_terrains() const;
IC const CALifeGroupRegistry& groups() const;
IC CRandom32& random();
IC IPureServer& server() const;
IC const CALifeTimeManager& time_manager() const;
IC shared_str* server_command_line() const;
bool initialized() const { return m_initialized; }
const CALifeSimulatorHeader& header() const;
const CALifeTimeManager& time() const;
const CALifeSpawnRegistry& spawns() const;
const CALifeObjectRegistry& objects() const;
const CALifeGraphRegistry& graph() const;
const CALifeScheduleRegistry& scheduled() const;
const CALifeStoryRegistry& story_objects() const;
const CALifeSmartTerrainRegistry& smart_terrains() const;
const CALifeGroupRegistry& groups() const;
CRandom32& random();
IPureServer& server() const;
const CALifeTimeManager& time_manager() const;
shared_str* server_command_line() const;
template <typename T>
IC T& registry(T* t) const;

T& registry(T* t) const { return registry()(t); }
protected:
void unload();
virtual void reload(LPCSTR section);
IC void setup_command_line(shared_str* command_line);
void setup_command_line(shared_str* command_line);
void assign_death_position(CSE_ALifeCreatureAbstract* tpALifeCreatureAbstract, GameGraph::_GRAPH_ID tGraphID,
CSE_ALifeSchedulable* tpALifeSchedulable = 0);
virtual void setup_simulator(CSE_ALifeObject* object) = 0;
Expand All @@ -126,4 +125,6 @@ class CALifeSimulatorBase : public IPureDestroyableObject
ALife::ITEM_P_VECTOR m_temp_item_vector;
};

#ifndef DEBUG // for debug builds, the functions are instantiated by alife_simulator_base.cpp
#include "alife_simulator_base_inline.h"
#endif
Loading

0 comments on commit 2fc32b2

Please sign in to comment.