Skip to content

Commit 56ea0a6

Browse files
author
nitrocaster
committed
Delete redundant typedefs, rename client/sever base class aliases.
1 parent c08c870 commit 56ea0a6

11 files changed

+54
-71
lines changed

src/xrServerEntities/object_factory.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@
1717
class CObjectFactory {
1818
public:
1919
#ifndef NO_XR_GAME
20-
typedef ObjectFactory::CLIENT_BASE_CLASS CLIENT_BASE_CLASS;
20+
using ClientObjectBaseClass = ObjectFactory::ClientObjectBaseClass;
2121
#endif
22-
typedef ObjectFactory::SERVER_BASE_CLASS SERVER_BASE_CLASS;
23-
24-
#ifndef NO_XR_GAME
25-
typedef ObjectFactory::CLIENT_SCRIPT_BASE_CLASS CLIENT_SCRIPT_BASE_CLASS;
26-
#endif
27-
typedef ObjectFactory::SERVER_SCRIPT_BASE_CLASS SERVER_SCRIPT_BASE_CLASS;
22+
using ServerObjectBaseClass = ObjectFactory::ServerObjectBaseClass;
2823

2924
protected:
3025
struct CObjectItemPredicate {
@@ -76,11 +71,9 @@ class CObjectFactory {
7671
virtual ~CObjectFactory ();
7772
void init ();
7873
#ifndef NO_XR_GAME
79-
IC CLIENT_BASE_CLASS *client_object (const CLASS_ID &clsid) const;
80-
IC SERVER_BASE_CLASS *server_object (const CLASS_ID &clsid, LPCSTR section) const;
81-
#else
82-
IC SERVER_BASE_CLASS *server_object (const CLASS_ID &clsid, LPCSTR section) const;
74+
inline ClientObjectBaseClass *client_object(const CLASS_ID &clsid) const;
8375
#endif
76+
inline ServerObjectBaseClass *server_object(const CLASS_ID &clsid, LPCSTR section) const;
8477

8578
IC int script_clsid (const CLASS_ID &clsid) const;
8679
void register_script () const;

src/xrServerEntities/object_factory_impl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ template <typename _client_type, typename _server_type>
2525
IC void CObjectFactory::add (const CLASS_ID &clsid, LPCSTR script_clsid)
2626
{
2727
{
28-
typedef object_type_traits::is_base_and_derived<CLIENT_BASE_CLASS,_client_type> a;
28+
typedef object_type_traits::is_base_and_derived<ClientObjectBaseClass,_client_type> a;
2929
STATIC_CHECK (a::value,Client_class_must_be_derived_from_the_CLIENT_BASE_CLASS);
3030
}
3131
{
32-
typedef object_type_traits::is_base_and_derived<SERVER_BASE_CLASS,_server_type> a;
32+
typedef object_type_traits::is_base_and_derived<ServerObjectBaseClass,_server_type> a;
3333
STATIC_CHECK (a::value,Server_class_must_be_derived_from_the_SERVER_BASE_CLASS);
3434
}
3535
add (xr_new<CObjectItemClientServer<_client_type,_server_type> >(clsid,script_clsid));
@@ -39,15 +39,15 @@ template <typename _unknown_type>
3939
IC void CObjectFactory::add (const CLASS_ID &clsid, LPCSTR script_clsid)
4040
{
4141
{
42-
typedef object_type_traits::is_base_and_derived<CLIENT_BASE_CLASS,_unknown_type> a;
43-
typedef object_type_traits::is_base_and_derived<SERVER_BASE_CLASS,_unknown_type> b;
42+
typedef object_type_traits::is_base_and_derived<ClientObjectBaseClass,_unknown_type> a;
43+
typedef object_type_traits::is_base_and_derived<ServerObjectBaseClass,_unknown_type> b;
4444
STATIC_CHECK (a::value || b::value,Class_must_be_derived_from_the_CLIENT_BASE_CLASS_or_SERVER_BASE_CLASS);
4545
}
4646
add (
4747
xr_new<
4848
CObjectItemSingle<
4949
_unknown_type,
50-
object_type_traits::is_base_and_derived<CLIENT_BASE_CLASS,_unknown_type>::value
50+
object_type_traits::is_base_and_derived<ClientObjectBaseClass,_unknown_type>::value
5151
>
5252
>
5353
(clsid,script_clsid)

src/xrServerEntities/object_factory_inline.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,21 @@ IC int CObjectFactory::script_clsid (const CLASS_ID &clsid) const
106106
}
107107

108108
#ifndef NO_XR_GAME
109-
IC CObjectFactory::CLIENT_BASE_CLASS *CObjectFactory::client_object (const CLASS_ID &clsid) const
109+
inline CObjectFactory::ClientObjectBaseClass *CObjectFactory::client_object (const CLASS_ID &clsid) const
110110
{
111111
return (item(clsid).client_object());
112112
}
113+
#endif
113114

114-
IC CObjectFactory::SERVER_BASE_CLASS *CObjectFactory::server_object (const CLASS_ID &clsid, LPCSTR section) const
115+
inline CObjectFactory::ServerObjectBaseClass *CObjectFactory::server_object (const CLASS_ID &clsid, LPCSTR section) const
115116
{
117+
#ifndef NO_XR_GAME
116118
return (item(clsid).server_object(section));
117-
}
118119
#else
119-
IC CObjectFactory::SERVER_BASE_CLASS *CObjectFactory::server_object (const CLASS_ID &clsid, LPCSTR section) const
120-
{
121-
const CObjectItemAbstract *object = item(clsid,true);
122-
return (object ? object->server_object(section) : 0);
123-
}
120+
const CObjectItemAbstract *object = item(clsid, true);
121+
return (object ? object->server_object(section) : 0);
124122
#endif
123+
}
125124

126125
IC void CObjectFactory::actualize () const
127126
{

src/xrServerEntities/object_factory_space.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,19 @@
66
// Description : Object factory space
77
////////////////////////////////////////////////////////////////////////////
88

9-
#ifndef object_factory_spaceH
10-
#define object_factory_spaceH
11-
129
#pragma once
1310

1411
#ifndef XRGAME_EXPORTS
15-
# define NO_XR_GAME
12+
#define NO_XR_GAME
1613
#endif
1714

15+
class IFactoryObject;
1816
class CSE_Abstract;
1917

20-
namespace ObjectFactory {
21-
22-
#ifndef NO_XR_GAME
23-
typedef IFactoryObject CLIENT_BASE_CLASS;
24-
#endif
25-
typedef CSE_Abstract SERVER_BASE_CLASS;
26-
18+
namespace ObjectFactory
19+
{
2720
#ifndef NO_XR_GAME
28-
typedef IFactoryObject CLIENT_SCRIPT_BASE_CLASS;
21+
using ClientObjectBaseClass = IFactoryObject;
2922
#endif
30-
typedef CSE_Abstract SERVER_SCRIPT_BASE_CLASS;
23+
using ServerObjectBaseClass = CSE_Abstract;
3124
};
32-
33-
#endif

src/xrServerEntities/object_item_abstract.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class CObjectItemAbstract {
2323
IC const CLASS_ID &clsid () const;
2424
IC shared_str script_clsid () const;
2525
#ifndef NO_XR_GAME
26-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const = 0;
26+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const = 0;
2727
#endif
28-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const = 0;
28+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const = 0;
2929
};
3030

3131
#include "object_item_abstract_inline.h"

src/xrServerEntities/object_item_client_server.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class CObjectItemClientServer : public CObjectItemAbstract {
2525
public:
2626
IC CObjectItemClientServer (const CLASS_ID &clsid, LPCSTR script_clsid);
2727
#ifndef NO_XR_GAME
28-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const;
28+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const;
2929
#endif
30-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const;
30+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const;
3131
};
3232

3333
#ifndef NO_XR_GAME
@@ -36,8 +36,8 @@ class CObjectItemClientServer : public CObjectItemAbstract {
3636
typedef CObjectItemAbstract inherited;
3737
public:
3838
IC CObjectItemClientServerSingleMp (const CLASS_ID &clsid, LPCSTR script_clsid);
39-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const;
40-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const;
39+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const;
40+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const;
4141
};
4242
#endif // NO_XR_GAME
4343

src/xrServerEntities/object_item_client_server_inline.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ IC CSObjectItemClientServer::CObjectItemClientServer (const CLASS_ID &clsid, LPC
2222

2323
#ifndef NO_XR_GAME
2424
TEMPLATE_SPECIALIZATION
25-
ObjectFactory::CLIENT_BASE_CLASS *CSObjectItemClientServer::client_object () const
25+
ObjectFactory::ClientObjectBaseClass *CSObjectItemClientServer::client_object () const
2626
{
2727
return (xr_new<CLIENT_TYPE>()->_construct());
2828
}
2929
#endif
3030

3131
TEMPLATE_SPECIALIZATION
32-
ObjectFactory::SERVER_BASE_CLASS *CSObjectItemClientServer::server_object (LPCSTR section) const
32+
ObjectFactory::ServerObjectBaseClass *CSObjectItemClientServer::server_object (LPCSTR section) const
3333
{
34-
ObjectFactory::SERVER_BASE_CLASS * o = xr_new<SERVER_TYPE>(section)->init();
34+
ObjectFactory::ServerObjectBaseClass * o = xr_new<SERVER_TYPE>(section)->init();
3535
R_ASSERT (o);
3636
return (o);
3737
}
@@ -50,9 +50,9 @@ ObjectFactory::SERVER_BASE_CLASS *CSObjectItemClientServer::server_object (LPCST
5050
}
5151

5252
TEMPLATE_SPECIALIZATION
53-
ObjectFactory::CLIENT_BASE_CLASS *CSObjectItemClientServerSingleMp::client_object () const
53+
ObjectFactory::ClientObjectBaseClass *CSObjectItemClientServerSingleMp::client_object () const
5454
{
55-
ObjectFactory::CLIENT_BASE_CLASS *result =
55+
ObjectFactory::ClientObjectBaseClass *result =
5656
IsGameTypeSingle() ?
5757
xr_new<_client_type_single>() :
5858
xr_new<_client_type_mp>();
@@ -61,9 +61,9 @@ ObjectFactory::SERVER_BASE_CLASS *CSObjectItemClientServer::server_object (LPCST
6161
}
6262

6363
TEMPLATE_SPECIALIZATION
64-
ObjectFactory::SERVER_BASE_CLASS *CSObjectItemClientServerSingleMp::server_object (LPCSTR section) const
64+
ObjectFactory::ServerObjectBaseClass *CSObjectItemClientServerSingleMp::server_object (LPCSTR section) const
6565
{
66-
ObjectFactory::SERVER_BASE_CLASS *result =
66+
ObjectFactory::ServerObjectBaseClass *result =
6767
IsGameTypeSingle() ?
6868
xr_new<_server_type_single>(section) :
6969
xr_new<_server_type_mp>(section);

src/xrServerEntities/object_item_script.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#ifndef NO_XR_GAME
1515
# include "attachable_item.h"
1616

17-
ObjectFactory::CLIENT_BASE_CLASS *CObjectItemScript::client_object () const
17+
ObjectFactory::ClientObjectBaseClass *CObjectItemScript::client_object () const
1818
{
19-
ObjectFactory::CLIENT_SCRIPT_BASE_CLASS *object = nullptr;
19+
ObjectFactory::ClientObjectBaseClass *object = nullptr;
2020
try {
2121
object = m_client_creator();
2222
}
@@ -29,9 +29,9 @@ ObjectFactory::CLIENT_BASE_CLASS *CObjectItemScript::client_object () const
2929

3030
#endif
3131

32-
ObjectFactory::SERVER_BASE_CLASS *CObjectItemScript::server_object (LPCSTR section) const
32+
ObjectFactory::ServerObjectBaseClass *CObjectItemScript::server_object (LPCSTR section) const
3333
{
34-
ObjectFactory::SERVER_BASE_CLASS *object = nullptr;
34+
ObjectFactory::ServerObjectBaseClass *object = nullptr;
3535

3636
try {
3737
object = m_server_creator(section);
@@ -46,9 +46,9 @@ ObjectFactory::SERVER_BASE_CLASS *CObjectItemScript::server_object (LPCSTR secti
4646
}
4747

4848
R_ASSERT (object);
49-
ObjectFactory::SERVER_BASE_CLASS *o = object->init();
50-
R_ASSERT (o);
51-
return (o);
49+
object = object->init();
50+
R_ASSERT (object);
51+
return (object);
5252
}
5353

5454
CObjectItemScript::CObjectItemScript (

src/xrServerEntities/object_item_script.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class CObjectItemScript : public CObjectItemAbstract {
1717
typedef CObjectItemAbstract inherited;
1818

1919
protected:
20-
mutable luabind::functor<ObjectFactory::CLIENT_BASE_CLASS *, luabind::policy::adopt<0>> m_client_creator;
21-
mutable luabind::functor<ObjectFactory::SERVER_BASE_CLASS *, luabind::policy::adopt<0>> m_server_creator;
20+
mutable luabind::functor<ObjectFactory::ClientObjectBaseClass *, luabind::policy::adopt<0>> m_client_creator;
21+
mutable luabind::functor<ObjectFactory::ServerObjectBaseClass *, luabind::policy::adopt<0>> m_server_creator;
2222

2323
public:
2424
CObjectItemScript (
@@ -35,7 +35,7 @@ class CObjectItemScript : public CObjectItemAbstract {
3535
const CLASS_ID &clsid,
3636
LPCSTR script_clsid
3737
);
38-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const;
38+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const;
3939
#endif
40-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const;
40+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const;
4141
};

src/xrServerEntities/object_item_single.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class CObjectItemSingle : public CObjectItemAbstract {
2323
public:
2424
IC CObjectItemSingle (const CLASS_ID &clsid, LPCSTR script_clsid);
2525
#ifndef NO_XR_GAME
26-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const;
26+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const;
2727
#endif
28-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const;
28+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const;
2929
};
3030

3131
#ifndef NO_XR_GAME
@@ -37,8 +37,8 @@ class CObjectItemSingle<_unknown_type,true> : public CObjectItemAbstract {
3737

3838
public:
3939
IC CObjectItemSingle (const CLASS_ID &clsid, LPCSTR script_clsid);
40-
virtual ObjectFactory::CLIENT_BASE_CLASS *client_object () const;
41-
virtual ObjectFactory::SERVER_BASE_CLASS *server_object (LPCSTR section) const;
40+
virtual ObjectFactory::ClientObjectBaseClass *client_object() const;
41+
virtual ObjectFactory::ServerObjectBaseClass *server_object(LPCSTR section) const;
4242
};
4343
#endif
4444

0 commit comments

Comments
 (0)