Skip to content

Commit 46ee695

Browse files
authored
Merge pull request #5 from Zegeri/clean
Fix arguments that are passed to luabind
2 parents f423725 + 9d0e0e8 commit 46ee695

25 files changed

+132
-130
lines changed

src/Common/object_type_traits.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,35 @@ struct remove_const<T const>
112112
typedef T type;
113113
};
114114

115+
template <typename T>
116+
struct remove_noexcept;
117+
118+
template <typename R, typename... Args>
119+
struct remove_noexcept<R(Args...) noexcept>
120+
{
121+
using type = R(Args...);
122+
};
123+
124+
template< typename R, typename... Args>
125+
struct remove_noexcept <R(*)(Args...) noexcept>
126+
{
127+
using type = R(*)(Args...);
128+
};
129+
130+
template <typename C, typename R, typename... Args>
131+
struct remove_noexcept<R(C::*)(Args...) noexcept>
132+
{
133+
using type = R(C::*)(Args...);
134+
};
135+
136+
template <typename C, typename R, typename... Args>
137+
struct remove_noexcept<R(C::*)(Args...) const noexcept>
138+
{
139+
using type = R(C::*)(Args...) const;
140+
};
141+
142+
#define REMOVE_NOEXCEPT(fn) (object_type_traits::remove_noexcept<decltype(fn)>::type)(fn)
143+
115144
template <typename T>
116145
struct is_void
117146
{

src/xrGame/account_manager_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ using namespace luabind;
66
using namespace luabind::policy;
77
using namespace gamespy_gp;
88

9-
#ifndef LINUX // FIXME!!!
109
SCRIPT_EXPORT(account_manager, (), {
1110
module(luaState)[class_<account_manager>("account_manager")
1211
.def("suggest_unique_nicks", &account_manager::suggest_unique_nicks)
@@ -31,6 +30,7 @@ SCRIPT_EXPORT(account_manager, (), {
3130
.def("stop_searching_email", &account_manager::stop_searching_email)];
3231
});
3332

33+
#ifndef LINUX // FIXME!!!
3434
SCRIPT_EXPORT(suggest_nicks_cb, (), {
3535
module(luaState)[class_<gamespy_gp::suggest_nicks_cb>("suggest_nicks_cb")
3636
.def(constructor<>())

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 noexcept { return true; }
134+
bool CSE_ALifeAnomalousZone::keep_saved_data_anyway() const /* noexcept */ { return true; }

src/xrGame/alife_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ void CSE_ALifeObject::spawn_supplies(LPCSTR ini_string)
182182
}
183183
}
184184

185-
bool CSE_ALifeObject::keep_saved_data_anyway() const noexcept { return false; }
185+
bool CSE_ALifeObject::keep_saved_data_anyway() const /* noexcept */ { return false; }

src/xrServerEntities/script_flags_script.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "pch_script.h"
1010
#include "xrScriptEngine/ScriptExporter.hpp"
11+
#include "Common/object_type_traits.h"
1112

1213
using namespace luabind;
1314

@@ -53,15 +54,14 @@ void one(T* self)
5354
self->assign(typename T::TYPE(-1));
5455
}
5556

56-
#ifndef LINUX // FIXME!!!
5757
SCRIPT_EXPORT(Flags8, (),
5858
{
5959
module(luaState)
6060
[
6161
class_<Flags8>("flags8")
6262
.def(constructor<>())
63-
.def("get", &Flags8::get)
64-
.def("zero", &Flags8::zero)
63+
.def("get", REMOVE_NOEXCEPT(&Flags8::get))
64+
.def("zero", REMOVE_NOEXCEPT(&Flags8::zero))
6565
.def("one", &one<Flags8>)
6666
.def("invert", (Flags8 & (Flags8::*)())(&Flags8::invert))
6767
.def("invert", (Flags8 & (Flags8::*)(const Flags8&))(&Flags8::invert))
@@ -87,8 +87,8 @@ SCRIPT_EXPORT(Flags16, (),
8787
[
8888
class_<Flags16>("flags16")
8989
.def(constructor<>())
90-
.def("get", &Flags16::get)
91-
.def("zero", &Flags16::zero)
90+
.def("get", REMOVE_NOEXCEPT(&Flags16::get))
91+
.def("zero", REMOVE_NOEXCEPT(&Flags16::zero))
9292
.def("one", &one<Flags16>)
9393
.def("invert", (Flags16 & (Flags16::*)())(&Flags16::invert))
9494
.def("invert", (Flags16 & (Flags16::*)(const Flags16&))(&Flags16::invert))
@@ -114,9 +114,9 @@ SCRIPT_EXPORT(Flags32, (),
114114
[
115115
class_<Flags32>("flags32")
116116
.def(constructor<>())
117-
.def("get", &Flags32::get)
118-
.def("zero", &Flags32::zero)
119-
.def("one", &Flags32::one)
117+
.def("get", REMOVE_NOEXCEPT(&Flags32::get))
118+
.def("zero", REMOVE_NOEXCEPT(&Flags32::zero))
119+
.def("one", REMOVE_NOEXCEPT(&Flags32::one))
120120
.def("invert", (Flags32 & (Flags32::*)())(&Flags32::invert))
121121
.def("invert", (Flags32 & (Flags32::*)(const Flags32&))(&Flags32::invert))
122122
.def("invert", (Flags32 & (Flags32::*)(const Flags32::TYPE))(&Flags32::invert))
@@ -134,4 +134,3 @@ SCRIPT_EXPORT(Flags32, (),
134134
.def("equal", (bool(*)(Flags32*, const Flags32&, const Flags32::TYPE))(&equal<Flags32>))
135135
];
136136
});
137-
#endif

src/xrServerEntities/xrServer_Object_Base.h

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

src/xrServerEntities/xrServer_Objects_ALife.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -547,21 +547,21 @@ u32 CSE_ALifeObject::ef_detector_type() const
547547
return (u32(-1));
548548
}
549549

550-
bool CSE_ALifeObject::used_ai_locations() const noexcept
550+
bool CSE_ALifeObject::used_ai_locations() const /* noexcept */
551551
{ return !!m_flags.is(flUsedAI_Locations); }
552-
bool CSE_ALifeObject::can_switch_online() const noexcept
552+
bool CSE_ALifeObject::can_switch_online() const /* noexcept */
553553
{ return match_configuration() && !!m_flags.is(flSwitchOnline); }
554-
bool CSE_ALifeObject::can_switch_offline() const noexcept
554+
bool CSE_ALifeObject::can_switch_offline() const /* noexcept */
555555
{ return !match_configuration() || !!m_flags.is(flSwitchOffline); }
556-
bool CSE_ALifeObject::can_save() const noexcept
556+
bool CSE_ALifeObject::can_save() const /* noexcept */
557557
{ return !!m_flags.is(flCanSave); }
558-
bool CSE_ALifeObject::interactive() const noexcept
558+
bool CSE_ALifeObject::interactive() const /* noexcept */
559559
{ return !!m_flags.is(flInteractive) && !!m_flags.is(flVisibleForAI) && !!m_flags.is(flUsefulForAI); }
560560

561561
void CSE_ALifeObject::use_ai_locations(bool value) { m_flags.set(flUsedAI_Locations, BOOL(value)); }
562-
void CSE_ALifeObject::can_switch_online(bool value) noexcept { m_flags.set(flSwitchOnline, BOOL(value)); }
563-
void CSE_ALifeObject::can_switch_offline(bool value) noexcept { m_flags.set(flSwitchOffline, BOOL(value)); }
564-
void CSE_ALifeObject::interactive(bool value) noexcept { m_flags.set(flInteractive, BOOL(value)); }
562+
void CSE_ALifeObject::can_switch_online(bool value) /* noexcept */ { m_flags.set(flSwitchOnline, BOOL(value)); }
563+
void CSE_ALifeObject::can_switch_offline(bool value) /* noexcept */ { m_flags.set(flSwitchOffline, BOOL(value)); }
564+
void CSE_ALifeObject::interactive(bool value) /* noexcept */ { m_flags.set(flInteractive, BOOL(value)); }
565565
////////////////////////////////////////////////////////////////////////////
566566
// CSE_ALifeGroupAbstract
567567
////////////////////////////////////////////////////////////////////////////
@@ -703,8 +703,8 @@ void CSE_ALifePHSkeletonObject::UPDATE_Read(NET_Packet& tNetPacket)
703703
inherited2::UPDATE_Read(tNetPacket);
704704
};
705705

706-
bool CSE_ALifePHSkeletonObject::can_save() const noexcept { return CSE_PHSkeleton::need_save(); }
707-
bool CSE_ALifePHSkeletonObject::used_ai_locations() const noexcept { return false; }
706+
bool CSE_ALifePHSkeletonObject::can_save() const /* noexcept */ { return CSE_PHSkeleton::need_save(); }
707+
bool CSE_ALifePHSkeletonObject::used_ai_locations() const /* noexcept */ { return false; }
708708
#ifndef XRGAME_EXPORTS
709709
void CSE_ALifePHSkeletonObject::FillProps(LPCSTR pref, PropItemVec& items)
710710
{
@@ -726,8 +726,8 @@ CSE_ALifeSpaceRestrictor::CSE_ALifeSpaceRestrictor(LPCSTR caSection) : CSE_ALife
726726
}
727727

728728
CSE_ALifeSpaceRestrictor::~CSE_ALifeSpaceRestrictor() {}
729-
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const noexcept { return false; }
730-
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const noexcept { return false; }
729+
bool CSE_ALifeSpaceRestrictor::can_switch_offline() const /* noexcept */ { return false; }
730+
bool CSE_ALifeSpaceRestrictor::used_ai_locations() const /* noexcept */ { return false; }
731731
IServerEntityShape* CSE_ALifeSpaceRestrictor::shape() { return (this); }
732732
void CSE_ALifeSpaceRestrictor::STATE_Read(NET_Packet& tNetPacket, u16 size)
733733
{
@@ -1148,8 +1148,8 @@ void CSE_ALifeObjectPhysic::FillProps(LPCSTR pref, PropItemVec& values)
11481148
}
11491149
#endif // #ifndef XRGAME_EXPORTS
11501150

1151-
bool CSE_ALifeObjectPhysic::used_ai_locations() const noexcept { return false; }
1152-
bool CSE_ALifeObjectPhysic::can_save() const noexcept { return CSE_PHSkeleton::need_save(); }
1151+
bool CSE_ALifeObjectPhysic::used_ai_locations() const /* noexcept */ { return false; }
1152+
bool CSE_ALifeObjectPhysic::can_save() const /* noexcept */ { return CSE_PHSkeleton::need_save(); }
11531153
////////////////////////////////////////////////////////////////////////////
11541154
// CSE_ALifeObjectHangingLamp
11551155
////////////////////////////////////////////////////////////////////////////
@@ -1418,7 +1418,7 @@ CDUInterface* du, IServerEntityLEOwner* owner, bool bSelected, const Fmatrix& pa
14181418
}
14191419
#endif // #ifndef XRGAME_EXPORTS
14201420

1421-
bool CSE_ALifeObjectHangingLamp::used_ai_locations() const noexcept { return false; }
1421+
bool CSE_ALifeObjectHangingLamp::used_ai_locations() const /* noexcept */ { return false; }
14221422
bool CSE_ALifeObjectHangingLamp::validate()
14231423
{
14241424
if (flags.test(flR1) || flags.test(flR2))
@@ -1428,7 +1428,7 @@ bool CSE_ALifeObjectHangingLamp::validate()
14281428
return (false);
14291429
}
14301430

1431-
bool CSE_ALifeObjectHangingLamp::match_configuration() const noexcept
1431+
bool CSE_ALifeObjectHangingLamp::match_configuration() const /* noexcept */
14321432
{
14331433
R_ASSERT3(flags.test(flR1) || flags.test(flR2), "no renderer type set for hanging-lamp ", name_replace());
14341434
#ifdef XRGAME_EXPORTS
@@ -1458,7 +1458,7 @@ void CSE_ALifeObjectProjector::UPDATE_Write(NET_Packet& tNetPacket) { inherited:
14581458
void CSE_ALifeObjectProjector::FillProps(LPCSTR pref, PropItemVec& values) { inherited::FillProps(pref, values); }
14591459
#endif // #ifndef XRGAME_EXPORTS
14601460

1461-
bool CSE_ALifeObjectProjector::used_ai_locations() const noexcept { return false; }
1461+
bool CSE_ALifeObjectProjector::used_ai_locations() const /* noexcept */ { return false; }
14621462
////////////////////////////////////////////////////////////////////////////
14631463
// CSE_ALifeSchedulable
14641464
////////////////////////////////////////////////////////////////////////////
@@ -1562,7 +1562,7 @@ void CSE_ALifeHelicopter::load(NET_Packet& tNetPacket)
15621562
inherited1::load(tNetPacket);
15631563
inherited3::load(tNetPacket);
15641564
}
1565-
bool CSE_ALifeHelicopter::can_save() const noexcept { return CSE_PHSkeleton::need_save(); }
1565+
bool CSE_ALifeHelicopter::can_save() const /* noexcept */ { return CSE_PHSkeleton::need_save(); }
15661566
#ifndef XRGAME_EXPORTS
15671567
void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
15681568
{
@@ -1574,7 +1574,7 @@ void CSE_ALifeHelicopter::FillProps(LPCSTR pref, PropItemVec& values)
15741574
}
15751575
#endif // #ifndef XRGAME_EXPORTS
15761576

1577-
bool CSE_ALifeHelicopter::used_ai_locations() const noexcept { return false; }
1577+
bool CSE_ALifeHelicopter::used_ai_locations() const /* noexcept */ { return false; }
15781578
////////////////////////////////////////////////////////////////////////////
15791579
// CSE_ALifeCar
15801580
////////////////////////////////////////////////////////////////////////////
@@ -1621,8 +1621,8 @@ void CSE_ALifeCar::UPDATE_Write(NET_Packet& tNetPacket)
16211621
inherited2::UPDATE_Write(tNetPacket);
16221622
}
16231623

1624-
bool CSE_ALifeCar::used_ai_locations() const noexcept { return false; }
1625-
bool CSE_ALifeCar::can_save() const noexcept { return CSE_PHSkeleton::need_save(); }
1624+
bool CSE_ALifeCar::used_ai_locations() const /* noexcept */ { return false; }
1625+
bool CSE_ALifeCar::can_save() const /* noexcept */ { return CSE_PHSkeleton::need_save(); }
16261626
void CSE_ALifeCar::load(NET_Packet& tNetPacket)
16271627
{
16281628
inherited1::load(tNetPacket);
@@ -1737,8 +1737,8 @@ void CSE_ALifeObjectBreakable::FillProps(LPCSTR pref, PropItemVec& values)
17371737
}
17381738
#endif // #ifndef XRGAME_EXPORTS
17391739

1740-
bool CSE_ALifeObjectBreakable::used_ai_locations() const noexcept { return false; }
1741-
bool CSE_ALifeObjectBreakable::can_switch_offline() const noexcept { return false; }
1740+
bool CSE_ALifeObjectBreakable::used_ai_locations() const /* noexcept */ { return false; }
1741+
bool CSE_ALifeObjectBreakable::can_switch_offline() const /* noexcept */ { return false; }
17421742
////////////////////////////////////////////////////////////////////////////
17431743
// CSE_ALifeObjectClimable
17441744
////////////////////////////////////////////////////////////////////////////
@@ -1799,8 +1799,8 @@ void CSE_ALifeObjectClimable::set_additional_info(void* info)
17991799
}
18001800
#endif // #ifndef XRGAME_EXPORTS
18011801

1802-
bool CSE_ALifeObjectClimable::used_ai_locations() const noexcept { return false; }
1803-
bool CSE_ALifeObjectClimable::can_switch_offline() const noexcept { return false; }
1802+
bool CSE_ALifeObjectClimable::used_ai_locations() const /* noexcept */ { return false; }
1803+
bool CSE_ALifeObjectClimable::can_switch_offline() const /* noexcept */ { return false; }
18041804
////////////////////////////////////////////////////////////////////////////
18051805
// CSE_ALifeMountedWeapon
18061806
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)