Skip to content

Commit c31426e

Browse files
tamlin-mikeXottab-DUTY
authored andcommitted
Added a bunch of nothrow declaration in an attempt to reduce the large number of exception handlers generated.
1 parent 82bfa36 commit c31426e

16 files changed

+215
-211
lines changed

src/xrCore/_flags.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,75 +15,75 @@ struct _flags
1515
public:
1616
T flags;
1717

18-
TYPE get() const { return flags; }
19-
SelfRef zero()
18+
TYPE get() const throw() { return flags; }
19+
SelfRef zero() throw()
2020
{
2121
flags = T(0);
2222
return *this;
2323
}
24-
SelfRef one()
24+
SelfRef one() throw()
2525
{
2626
flags = T(-1);
2727
return *this;
2828
}
29-
SelfRef invert()
29+
SelfRef invert() throw()
3030
{
3131
flags = ~flags;
3232
return *this;
3333
}
34-
SelfRef invert(const Self& f)
34+
SelfRef invert(const Self& f) throw()
3535
{
3636
flags = ~f.flags;
3737
return *this;
3838
}
39-
SelfRef invert(const T mask)
39+
SelfRef invert(const T mask) throw()
4040
{
4141
flags ^= mask;
4242
return *this;
4343
}
44-
SelfRef assign(const Self& f)
44+
SelfRef assign(const Self& f) throw()
4545
{
4646
flags = f.flags;
4747
return *this;
4848
}
49-
SelfRef assign(const T mask)
49+
SelfRef assign(const T mask) throw()
5050
{
5151
flags = mask;
5252
return *this;
5353
}
54-
SelfRef set(const T mask, BOOL value)
54+
SelfRef set(const T mask, BOOL value) throw()
5555
{
5656
if (value)
5757
flags |= mask;
5858
else
5959
flags &= ~mask;
6060
return *this;
6161
}
62-
BOOL is(const T mask) const { return mask == (flags & mask); }
63-
BOOL is_any(const T mask) const { return BOOL(!!(flags & mask)); }
64-
BOOL test(const T mask) const { return BOOL(!!(flags & mask)); }
65-
SelfRef or (const T mask)
62+
BOOL is(const T mask) const throw() { return mask == (flags & mask); }
63+
BOOL is_any(const T mask) const throw() { return BOOL(!!(flags & mask)); }
64+
BOOL test(const T mask) const throw() { return BOOL(!!(flags & mask)); }
65+
SelfRef or (const T mask) throw()
6666
{
6767
flags |= mask;
6868
return *this;
6969
}
70-
SelfRef or (const Self& f, const T mask)
70+
SelfRef or (const Self& f, const T mask) throw()
7171
{
7272
flags = f.flags | mask;
7373
return *this;
7474
}
75-
SelfRef and (const T mask)
75+
SelfRef and (const T mask) throw()
7676
{
7777
flags &= mask;
7878
return *this;
7979
}
80-
SelfRef and (const Self& f, const T mask)
80+
SelfRef and (const Self& f, const T mask) throw()
8181
{
8282
flags = f.flags & mask;
8383
return *this;
8484
}
85-
BOOL equal(const Self& f) const { return flags == f.flags; }
86-
BOOL equal(const Self& f, const T mask) const { return (flags & mask) == (f.flags & mask); }
85+
BOOL equal(const Self& f) const throw() { return flags == f.flags; }
86+
BOOL equal(const Self& f, const T mask) const throw() { return (flags & mask) == (f.flags & mask); }
8787
};
8888

8989
typedef _flags<u8> Flags8;

src/xrGame/alife_anomalous_zone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ void CSE_ALifeAnomalousZone::on_spawn()
131131
// spawn_artefacts ();
132132
}
133133

134-
bool CSE_ALifeAnomalousZone::keep_saved_data_anyway() const { return (true); }
134+
bool CSE_ALifeAnomalousZone::keep_saved_data_anyway() const throw() { return true; }

src/xrGame/alife_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ void CSE_ALifeObject::spawn_supplies(LPCSTR ini_string)
8484
}
8585
}
8686

87-
bool CSE_ALifeObject::keep_saved_data_anyway() const { return (false); }
87+
bool CSE_ALifeObject::keep_saved_data_anyway() const throw() { return false; }

src/xrGame/alife_online_offline_group.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ void CSE_ALifeOnlineOfflineGroup::update()
5858
MEMBERS::iterator E = m_members.end();
5959
for (; I != E; ++I)
6060
{
61-
((*I).second)->o_Position = o_Position;
62-
((*I).second)->m_tNodeID = m_tNodeID;
63-
((*I).second)->m_tGraphID = m_tGraphID;
64-
((*I).second)->m_fDistance = m_fDistance;
61+
MEMBER* m = (*I).second;
62+
m->o_Position = o_Position;
63+
m->m_tNodeID = m_tNodeID;
64+
m->m_tGraphID = m_tGraphID;
65+
m->m_fDistance = m_fDistance;
6566
}
6667
return;
6768
}

src/xrScriptEngine/ScriptExportMacros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#endif
6161

6262
#define DEFINE_LUA_WRAPPER_CONST_METHOD_0(v_func_name, ret_type) \
63-
virtual ret_type v_func_name() const \
63+
virtual ret_type v_func_name() const throw()\
6464
{ \
6565
try \
6666
{ \

src/xrServerEntities/xrServer_Object_Base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class CSE_Abstract : public IServerEntity, public CPureServerObject, public CScr
152152
virtual CSE_Abstract* base();
153153
virtual const CSE_Abstract* base() const;
154154
virtual CSE_Abstract* init();
155-
virtual bool match_configuration() const { return true; }
155+
virtual bool match_configuration() const throw() { return true; }
156156
// end of the virtual inheritance dependant code
157157
IC int script_clsid() const
158158
{

src/xrServerEntities/xrServer_Objects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class CSE_PHSkeleton
228228
SPHBonesData saved_bones;
229229
u16 source_id; // for break only
230230
virtual void load(NET_Packet& tNetPacket);
231-
virtual bool need_save() const { return (!_flags.test(flNotSave)); }
231+
virtual bool need_save() const throw() { return !_flags.test(flNotSave); }
232232
virtual void set_sorce_id(u16 si) { source_id = si; }
233233
virtual u16 get_source_id() { return source_id; }
234234
virtual CSE_Abstract* cast_abstract() { return 0; }

src/xrServerEntities/xrServer_Objects_ALife.cpp

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -534,19 +534,21 @@ u32 CSE_ALifeObject::ef_detector_type() const
534534
return (u32(-1));
535535
}
536536

537-
bool CSE_ALifeObject::used_ai_locations() const { return (!!m_flags.is(flUsedAI_Locations)); }
538-
bool CSE_ALifeObject::can_switch_online() const { return (match_configuration() && !!m_flags.is(flSwitchOnline)); }
539-
bool CSE_ALifeObject::can_switch_offline() const { return (!match_configuration() || !!m_flags.is(flSwitchOffline)); }
540-
bool CSE_ALifeObject::can_save() const { return (!!m_flags.is(flCanSave)); }
541-
bool CSE_ALifeObject::interactive() const
542-
{
543-
return (!!m_flags.is(flInteractive) && !!m_flags.is(flVisibleForAI) && !!m_flags.is(flUsefulForAI));
544-
}
537+
bool CSE_ALifeObject::used_ai_locations() const throw()
538+
{ return !!m_flags.is(flUsedAI_Locations); }
539+
bool CSE_ALifeObject::can_switch_online() const throw()
540+
{ return match_configuration() && !!m_flags.is(flSwitchOnline); }
541+
bool CSE_ALifeObject::can_switch_offline() const throw()
542+
{ return !match_configuration() || !!m_flags.is(flSwitchOffline); }
543+
bool CSE_ALifeObject::can_save() const throw()
544+
{ return !!m_flags.is(flCanSave); }
545+
bool CSE_ALifeObject::interactive() const throw()
546+
{ return !!m_flags.is(flInteractive) && !!m_flags.is(flVisibleForAI) && !!m_flags.is(flUsefulForAI); }
545547

546548
void CSE_ALifeObject::use_ai_locations(bool value) { m_flags.set(flUsedAI_Locations, BOOL(value)); }
547-
void CSE_ALifeObject::can_switch_online(bool value) { m_flags.set(flSwitchOnline, BOOL(value)); }
548-
void CSE_ALifeObject::can_switch_offline(bool value) { m_flags.set(flSwitchOffline, BOOL(value)); }
549-
void CSE_ALifeObject::interactive(bool value) { m_flags.set(flInteractive, BOOL(value)); }
549+
void CSE_ALifeObject::can_switch_online(bool value) throw() { m_flags.set(flSwitchOnline, BOOL(value)); }
550+
void CSE_ALifeObject::can_switch_offline(bool value) throw() { m_flags.set(flSwitchOffline, BOOL(value)); }
551+
void CSE_ALifeObject::interactive(bool value) throw() { m_flags.set(flInteractive, BOOL(value)); }
550552
////////////////////////////////////////////////////////////////////////////
551553
// CSE_ALifeGroupAbstract
552554
////////////////////////////////////////////////////////////////////////////
@@ -688,8 +690,8 @@ void CSE_ALifePHSkeletonObject::UPDATE_Read(NET_Packet& tNetPacket)
688690
inherited2::UPDATE_Read(tNetPacket);
689691
};
690692

691-
bool CSE_ALifePHSkeletonObject::can_save() const { return CSE_PHSkeleton::need_save(); }
692-
bool CSE_ALifePHSkeletonObject::used_ai_locations() const { return false; }
693+
bool CSE_ALifePHSkeletonObject::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
694+
bool CSE_ALifePHSkeletonObject::used_ai_locations() const throw() { return false; }
693695
#ifndef XRGAME_EXPORTS
694696
void CSE_ALifePHSkeletonObject::FillProps(LPCSTR pref, PropItemVec& items)
695697
{
@@ -711,8 +713,8 @@ CSE_ALifeSpaceRestrictor::CSE_ALifeSpaceRestrictor(LPCSTR caSection) : CSE_ALife
711713
}
712714

713715
CSE_ALifeSpaceRestrictor::~CSE_ALifeSpaceRestrictor() {}
714-
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const { return (false); }
715-
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const { return (false); }
716+
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const throw() { return false; }
717+
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const throw() { return false; }
716718
IServerEntityShape* CSE_ALifeSpaceRestrictor::shape() { return (this); }
717719
void CSE_ALifeSpaceRestrictor::STATE_Read(NET_Packet& tNetPacket, u16 size)
718720
{
@@ -1133,8 +1135,8 @@ void CSE_ALifeObjectPhysic::FillProps(LPCSTR pref, PropItemVec& values)
11331135
}
11341136
#endif // #ifndef XRGAME_EXPORTS
11351137

1136-
bool CSE_ALifeObjectPhysic::used_ai_locations() const { return (false); }
1137-
bool CSE_ALifeObjectPhysic::can_save() const { return CSE_PHSkeleton::need_save(); }
1138+
bool CSE_ALifeObjectPhysic::used_ai_locations() const throw() { return false; }
1139+
bool CSE_ALifeObjectPhysic::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
11381140
////////////////////////////////////////////////////////////////////////////
11391141
// CSE_ALifeObjectHangingLamp
11401142
////////////////////////////////////////////////////////////////////////////
@@ -1403,7 +1405,7 @@ CDUInterface* du, IServerEntityLEOwner* owner, bool bSelected, const Fmatrix& pa
14031405
}
14041406
#endif // #ifndef XRGAME_EXPORTS
14051407

1406-
bool CSE_ALifeObjectHangingLamp::used_ai_locations() const { return (false); }
1408+
bool CSE_ALifeObjectHangingLamp::used_ai_locations() const throw() { return false; }
14071409
bool CSE_ALifeObjectHangingLamp::validate()
14081410
{
14091411
if (flags.test(flR1) || flags.test(flR2))
@@ -1413,7 +1415,7 @@ bool CSE_ALifeObjectHangingLamp::validate()
14131415
return (false);
14141416
}
14151417

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

1446-
bool CSE_ALifeObjectProjector::used_ai_locations() const { return (false); }
1448+
bool CSE_ALifeObjectProjector::used_ai_locations() const throw() { return false; }
14471449
////////////////////////////////////////////////////////////////////////////
14481450
// CSE_ALifeSchedulable
14491451
////////////////////////////////////////////////////////////////////////////
@@ -1547,7 +1549,7 @@ void CSE_ALifeHelicopter::load(NET_Packet& tNetPacket)
15471549
inherited1::load(tNetPacket);
15481550
inherited3::load(tNetPacket);
15491551
}
1550-
bool CSE_ALifeHelicopter::can_save() const { return CSE_PHSkeleton::need_save(); }
1552+
bool CSE_ALifeHelicopter::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
15511553
#ifndef XRGAME_EXPORTS
15521554
void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
15531555
{
@@ -1559,7 +1561,7 @@ void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
15591561
}
15601562
#endif // #ifndef XRGAME_EXPORTS
15611563

1562-
bool CSE_ALifeHelicopter::used_ai_locations() const { return (false); }
1564+
bool CSE_ALifeHelicopter::used_ai_locations() const throw() { return false; }
15631565
////////////////////////////////////////////////////////////////////////////
15641566
// CSE_ALifeCar
15651567
////////////////////////////////////////////////////////////////////////////
@@ -1606,8 +1608,8 @@ void CSE_ALifeCar::UPDATE_Write(NET_Packet& tNetPacket)
16061608
inherited2::UPDATE_Write(tNetPacket);
16071609
}
16081610

1609-
bool CSE_ALifeCar::used_ai_locations() const { return (false); }
1610-
bool CSE_ALifeCar::can_save() const { return CSE_PHSkeleton::need_save(); }
1611+
bool CSE_ALifeCar::used_ai_locations() const throw() { return false; }
1612+
bool CSE_ALifeCar::can_save() const throw() { return CSE_PHSkeleton::need_save(); }
16111613
void CSE_ALifeCar::load(NET_Packet& tNetPacket)
16121614
{
16131615
inherited1::load(tNetPacket);
@@ -1722,8 +1724,8 @@ void CSE_ALifeObjectBreakable::FillProps(LPCSTR pref, PropItemVec& values)
17221724
}
17231725
#endif // #ifndef XRGAME_EXPORTS
17241726

1725-
bool CSE_ALifeObjectBreakable::used_ai_locations() const { return (false); }
1726-
bool CSE_ALifeObjectBreakable::can_switch_offline() const { return (false); }
1727+
bool CSE_ALifeObjectBreakable::used_ai_locations() const throw() { return false; }
1728+
bool CSE_ALifeObjectBreakable::can_switch_offline() const throw() { return false; }
17271729
////////////////////////////////////////////////////////////////////////////
17281730
// CSE_ALifeObjectClimable
17291731
////////////////////////////////////////////////////////////////////////////
@@ -1784,8 +1786,8 @@ void CSE_ALifeObjectClimable::set_additional_info(void* info)
17841786
}
17851787
#endif // #ifndef XRGAME_EXPORTS
17861788

1787-
bool CSE_ALifeObjectClimable::used_ai_locations() const { return (false); }
1788-
bool CSE_ALifeObjectClimable::can_switch_offline() const { return (false); }
1789+
bool CSE_ALifeObjectClimable::used_ai_locations() const throw() { return false; }
1790+
bool CSE_ALifeObjectClimable::can_switch_offline() const throw() { return false; }
17891791
////////////////////////////////////////////////////////////////////////////
17901792
// CSE_ALifeMountedWeapon
17911793
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)