Skip to content

Commit

Permalink
Added a bunch of nothrow declaration in an attempt to reduce the larg…
Browse files Browse the repository at this point in the history
…e number of exception handlers generated.
  • Loading branch information
tamlin-mike authored and Xottab-DUTY committed Aug 5, 2017
1 parent 82bfa36 commit c31426e
Show file tree
Hide file tree
Showing 16 changed files with 215 additions and 211 deletions.
36 changes: 18 additions & 18 deletions src/xrCore/_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,75 @@ struct _flags
public:
T flags;

TYPE get() const { return flags; }
SelfRef zero()
TYPE get() const throw() { return flags; }
SelfRef zero() throw()
{
flags = T(0);
return *this;
}
SelfRef one()
SelfRef one() throw()
{
flags = T(-1);
return *this;
}
SelfRef invert()
SelfRef invert() throw()
{
flags = ~flags;
return *this;
}
SelfRef invert(const Self& f)
SelfRef invert(const Self& f) throw()
{
flags = ~f.flags;
return *this;
}
SelfRef invert(const T mask)
SelfRef invert(const T mask) throw()
{
flags ^= mask;
return *this;
}
SelfRef assign(const Self& f)
SelfRef assign(const Self& f) throw()
{
flags = f.flags;
return *this;
}
SelfRef assign(const T mask)
SelfRef assign(const T mask) throw()
{
flags = mask;
return *this;
}
SelfRef set(const T mask, BOOL value)
SelfRef set(const T mask, BOOL value) throw()
{
if (value)
flags |= mask;
else
flags &= ~mask;
return *this;
}
BOOL is(const T mask) const { return mask == (flags & mask); }
BOOL is_any(const T mask) const { return BOOL(!!(flags & mask)); }
BOOL test(const T mask) const { return BOOL(!!(flags & mask)); }
SelfRef or (const T mask)
BOOL is(const T mask) const throw() { return mask == (flags & mask); }
BOOL is_any(const T mask) const throw() { return BOOL(!!(flags & mask)); }
BOOL test(const T mask) const throw() { return BOOL(!!(flags & mask)); }
SelfRef or (const T mask) throw()
{
flags |= mask;
return *this;
}
SelfRef or (const Self& f, const T mask)
SelfRef or (const Self& f, const T mask) throw()
{
flags = f.flags | mask;
return *this;
}
SelfRef and (const T mask)
SelfRef and (const T mask) throw()
{
flags &= mask;
return *this;
}
SelfRef and (const Self& f, const T mask)
SelfRef and (const Self& f, const T mask) throw()
{
flags = f.flags & mask;
return *this;
}
BOOL equal(const Self& f) const { return flags == f.flags; }
BOOL equal(const Self& f, const T mask) const { return (flags & mask) == (f.flags & mask); }
BOOL equal(const Self& f) const throw() { return flags == f.flags; }
BOOL equal(const Self& f, const T mask) const throw() { return (flags & mask) == (f.flags & mask); }
};

typedef _flags<u8> Flags8;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/alife_anomalous_zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ void CSE_ALifeAnomalousZone::on_spawn()
// spawn_artefacts ();
}

bool CSE_ALifeAnomalousZone::keep_saved_data_anyway() const { return (true); }
bool CSE_ALifeAnomalousZone::keep_saved_data_anyway() const throw() { return true; }
2 changes: 1 addition & 1 deletion src/xrGame/alife_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ void CSE_ALifeObject::spawn_supplies(LPCSTR ini_string)
}
}

bool CSE_ALifeObject::keep_saved_data_anyway() const { return (false); }
bool CSE_ALifeObject::keep_saved_data_anyway() const throw() { return false; }
9 changes: 5 additions & 4 deletions src/xrGame/alife_online_offline_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ void CSE_ALifeOnlineOfflineGroup::update()
MEMBERS::iterator E = m_members.end();
for (; I != E; ++I)
{
((*I).second)->o_Position = o_Position;
((*I).second)->m_tNodeID = m_tNodeID;
((*I).second)->m_tGraphID = m_tGraphID;
((*I).second)->m_fDistance = m_fDistance;
MEMBER* m = (*I).second;
m->o_Position = o_Position;
m->m_tNodeID = m_tNodeID;
m->m_tGraphID = m_tGraphID;
m->m_fDistance = m_fDistance;
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrScriptEngine/ScriptExportMacros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#endif

#define DEFINE_LUA_WRAPPER_CONST_METHOD_0(v_func_name, ret_type) \
virtual ret_type v_func_name() const \
virtual ret_type v_func_name() const throw()\
{ \
try \
{ \
Expand Down
2 changes: 1 addition & 1 deletion src/xrServerEntities/xrServer_Object_Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CSE_Abstract : public IServerEntity, public CPureServerObject, public CScr
virtual CSE_Abstract* base();
virtual const CSE_Abstract* base() const;
virtual CSE_Abstract* init();
virtual bool match_configuration() const { return true; }
virtual bool match_configuration() const throw() { return true; }
// end of the virtual inheritance dependant code
IC int script_clsid() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrServerEntities/xrServer_Objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class CSE_PHSkeleton
SPHBonesData saved_bones;
u16 source_id; // for break only
virtual void load(NET_Packet& tNetPacket);
virtual bool need_save() const { return (!_flags.test(flNotSave)); }
virtual bool need_save() const throw() { return !_flags.test(flNotSave); }
virtual void set_sorce_id(u16 si) { source_id = si; }
virtual u16 get_source_id() { return source_id; }
virtual CSE_Abstract* cast_abstract() { return 0; }
Expand Down
58 changes: 30 additions & 28 deletions src/xrServerEntities/xrServer_Objects_ALife.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,19 +534,21 @@ u32 CSE_ALifeObject::ef_detector_type() const
return (u32(-1));
}

bool CSE_ALifeObject::used_ai_locations() const { return (!!m_flags.is(flUsedAI_Locations)); }
bool CSE_ALifeObject::can_switch_online() const { return (match_configuration() && !!m_flags.is(flSwitchOnline)); }
bool CSE_ALifeObject::can_switch_offline() const { return (!match_configuration() || !!m_flags.is(flSwitchOffline)); }
bool CSE_ALifeObject::can_save() const { return (!!m_flags.is(flCanSave)); }
bool CSE_ALifeObject::interactive() const
{
return (!!m_flags.is(flInteractive) && !!m_flags.is(flVisibleForAI) && !!m_flags.is(flUsefulForAI));
}
bool CSE_ALifeObject::used_ai_locations() const throw()
{ return !!m_flags.is(flUsedAI_Locations); }
bool CSE_ALifeObject::can_switch_online() const throw()
{ return match_configuration() && !!m_flags.is(flSwitchOnline); }
bool CSE_ALifeObject::can_switch_offline() const throw()
{ return !match_configuration() || !!m_flags.is(flSwitchOffline); }
bool CSE_ALifeObject::can_save() const throw()
{ return !!m_flags.is(flCanSave); }
bool CSE_ALifeObject::interactive() const throw()
{ return !!m_flags.is(flInteractive) && !!m_flags.is(flVisibleForAI) && !!m_flags.is(flUsefulForAI); }

void CSE_ALifeObject::use_ai_locations(bool value) { m_flags.set(flUsedAI_Locations, BOOL(value)); }
void CSE_ALifeObject::can_switch_online(bool value) { m_flags.set(flSwitchOnline, BOOL(value)); }
void CSE_ALifeObject::can_switch_offline(bool value) { m_flags.set(flSwitchOffline, BOOL(value)); }
void CSE_ALifeObject::interactive(bool value) { m_flags.set(flInteractive, BOOL(value)); }
void CSE_ALifeObject::can_switch_online(bool value) throw() { m_flags.set(flSwitchOnline, BOOL(value)); }
void CSE_ALifeObject::can_switch_offline(bool value) throw() { m_flags.set(flSwitchOffline, BOOL(value)); }
void CSE_ALifeObject::interactive(bool value) throw() { m_flags.set(flInteractive, BOOL(value)); }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeGroupAbstract
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -688,8 +690,8 @@ void CSE_ALifePHSkeletonObject::UPDATE_Read(NET_Packet& tNetPacket)
inherited2::UPDATE_Read(tNetPacket);
};

bool CSE_ALifePHSkeletonObject::can_save() const { return CSE_PHSkeleton::need_save(); }
bool CSE_ALifePHSkeletonObject::used_ai_locations() const { return false; }
bool CSE_ALifePHSkeletonObject::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
bool CSE_ALifePHSkeletonObject::used_ai_locations() const throw() { return false; }
#ifndef XRGAME_EXPORTS
void CSE_ALifePHSkeletonObject::FillProps(LPCSTR pref, PropItemVec& items)
{
Expand All @@ -711,8 +713,8 @@ CSE_ALifeSpaceRestrictor::CSE_ALifeSpaceRestrictor(LPCSTR caSection) : CSE_ALife
}

CSE_ALifeSpaceRestrictor::~CSE_ALifeSpaceRestrictor() {}
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const { return (false); }
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const { return (false); }
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const throw() { return false; }
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const throw() { return false; }
IServerEntityShape* CSE_ALifeSpaceRestrictor::shape() { return (this); }
void CSE_ALifeSpaceRestrictor::STATE_Read(NET_Packet& tNetPacket, u16 size)
{
Expand Down Expand Up @@ -1133,8 +1135,8 @@ void CSE_ALifeObjectPhysic::FillProps(LPCSTR pref, PropItemVec& values)
}
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeObjectPhysic::used_ai_locations() const { return (false); }
bool CSE_ALifeObjectPhysic::can_save() const { return CSE_PHSkeleton::need_save(); }
bool CSE_ALifeObjectPhysic::used_ai_locations() const throw() { return false; }
bool CSE_ALifeObjectPhysic::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeObjectHangingLamp
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1403,7 +1405,7 @@ CDUInterface* du, IServerEntityLEOwner* owner, bool bSelected, const Fmatrix& pa
}
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeObjectHangingLamp::used_ai_locations() const { return (false); }
bool CSE_ALifeObjectHangingLamp::used_ai_locations() const throw() { return false; }
bool CSE_ALifeObjectHangingLamp::validate()
{
if (flags.test(flR1) || flags.test(flR2))
Expand All @@ -1413,7 +1415,7 @@ bool CSE_ALifeObjectHangingLamp::validate()
return (false);
}

bool CSE_ALifeObjectHangingLamp::match_configuration() const
bool CSE_ALifeObjectHangingLamp::match_configuration() const throw()
{
R_ASSERT3(flags.test(flR1) || flags.test(flR2), "no renderer type set for hanging-lamp ", name_replace());
#ifdef XRGAME_EXPORTS
Expand Down Expand Up @@ -1443,7 +1445,7 @@ void CSE_ALifeObjectProjector::UPDATE_Write(NET_Packet& tNetPacket) { inherited:
void CSE_ALifeObjectProjector::FillProps(LPCSTR pref, PropItemVec& values) { inherited::FillProps(pref, values); }
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeObjectProjector::used_ai_locations() const { return (false); }
bool CSE_ALifeObjectProjector::used_ai_locations() const throw() { return false; }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeSchedulable
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1547,7 +1549,7 @@ void CSE_ALifeHelicopter::load(NET_Packet& tNetPacket)
inherited1::load(tNetPacket);
inherited3::load(tNetPacket);
}
bool CSE_ALifeHelicopter::can_save() const { return CSE_PHSkeleton::need_save(); }
bool CSE_ALifeHelicopter::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
#ifndef XRGAME_EXPORTS
void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
{
Expand All @@ -1559,7 +1561,7 @@ void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
}
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeHelicopter::used_ai_locations() const { return (false); }
bool CSE_ALifeHelicopter::used_ai_locations() const throw() { return false; }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeCar
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1606,8 +1608,8 @@ void CSE_ALifeCar::UPDATE_Write(NET_Packet& tNetPacket)
inherited2::UPDATE_Write(tNetPacket);
}

bool CSE_ALifeCar::used_ai_locations() const { return (false); }
bool CSE_ALifeCar::can_save() const { return CSE_PHSkeleton::need_save(); }
bool CSE_ALifeCar::used_ai_locations() const throw() { return false; }
bool CSE_ALifeCar::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
void CSE_ALifeCar::load(NET_Packet& tNetPacket)
{
inherited1::load(tNetPacket);
Expand Down Expand Up @@ -1722,8 +1724,8 @@ void CSE_ALifeObjectBreakable::FillProps(LPCSTR pref, PropItemVec& values)
}
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeObjectBreakable::used_ai_locations() const { return (false); }
bool CSE_ALifeObjectBreakable::can_switch_offline() const { return (false); }
bool CSE_ALifeObjectBreakable::used_ai_locations() const throw() { return false; }
bool CSE_ALifeObjectBreakable::can_switch_offline() const throw() { return false; }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeObjectClimable
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1784,8 +1786,8 @@ void CSE_ALifeObjectClimable::set_additional_info(void* info)
}
#endif // #ifndef XRGAME_EXPORTS

bool CSE_ALifeObjectClimable::used_ai_locations() const { return (false); }
bool CSE_ALifeObjectClimable::can_switch_offline() const { return (false); }
bool CSE_ALifeObjectClimable::used_ai_locations() const throw() { return false; }
bool CSE_ALifeObjectClimable::can_switch_offline() const throw() { return false; }
////////////////////////////////////////////////////////////////////////////
// CSE_ALifeMountedWeapon
////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit c31426e

Please sign in to comment.