Skip to content

Commit 9d080c1

Browse files
committed
Renamed EntityGenerator on the C++ side to CEntityGenerator
1 parent f16809b commit 9d080c1

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

src/core/modules/commands/command_wrap_python.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( get_server_command_overloads, GetServerCommand,
158158

159159
void export_server_command()
160160
{
161-
// TODO: Rename
162161
class_<CServerCommandManager, boost::noncopyable>("ServerCommandDispatcher", no_init)
163162
.def("add_callback",
164163
&CServerCommandManager::AddCallback,
@@ -186,7 +185,6 @@ void export_server_command()
186185
//-----------------------------------------------------------------------------
187186
void export_client_command()
188187
{
189-
// TODO: Rename
190188
class_<CClientCommandManager, boost::noncopyable>("ClientCommandDispatcher", no_init)
191189
.def("add_callback",
192190
&CClientCommandManager::AddCallback,
@@ -226,7 +224,6 @@ void export_client_command()
226224
//-----------------------------------------------------------------------------
227225
void export_say_command()
228226
{
229-
// TODO: Rename
230227
class_<CSayCommandManager, boost::noncopyable>("SayCommandDispatcher", no_init)
231228
.def("add_callback",
232229
&CSayCommandManager::AddCallback,

src/core/modules/entities/entities_generator_wrap.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
#include "modules/conversions/conversions_wrap.h"
3535

3636
// ----------------------------------------------------------------------------
37-
// EntityGenerator Constructor.
37+
// CEntityGenerator Constructor.
3838
// ----------------------------------------------------------------------------
39-
EntityGenerator::EntityGenerator( PyObject* self ):
39+
CEntityGenerator::CEntityGenerator( PyObject* self ):
4040
IPythonGenerator<edict_t>(self),
4141
m_iEntityIndex(0),
4242
m_szClassName(NULL),
@@ -46,9 +46,9 @@ EntityGenerator::EntityGenerator( PyObject* self ):
4646
}
4747

4848
// ----------------------------------------------------------------------------
49-
// EntityGenerator Copy-Constructor.
49+
// CEntityGenerator Copy-Constructor.
5050
// ----------------------------------------------------------------------------
51-
EntityGenerator::EntityGenerator( PyObject* self, const EntityGenerator& rhs ):
51+
CEntityGenerator::CEntityGenerator( PyObject* self, const CEntityGenerator& rhs ):
5252
IPythonGenerator<edict_t>(self),
5353
m_iEntityIndex(rhs.m_iEntityIndex),
5454
m_uiClassNameLen(rhs.m_uiClassNameLen),
@@ -58,9 +58,9 @@ EntityGenerator::EntityGenerator( PyObject* self, const EntityGenerator& rhs ):
5858
}
5959

6060
// ----------------------------------------------------------------------------
61-
// EntityGenerator Constructor (takes a filter string).
61+
// CEntityGenerator Constructor (takes a filter string).
6262
// ----------------------------------------------------------------------------
63-
EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName):
63+
CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName):
6464
IPythonGenerator<edict_t>(self),
6565
m_iEntityIndex(0),
6666
m_uiClassNameLen(strlen(szClassName)),
@@ -70,9 +70,9 @@ EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName):
7070
}
7171

7272
// ----------------------------------------------------------------------------
73-
// EntityGenerator Constructor (takes a filter string and a boolean flag).
73+
// CEntityGenerator Constructor (takes a filter string and a boolean flag).
7474
// ----------------------------------------------------------------------------
75-
EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName, bool bExactMatch):
75+
CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName, bool bExactMatch):
7676
IPythonGenerator<edict_t>(self),
7777
m_iEntityIndex(0),
7878
m_uiClassNameLen(strlen(szClassName)),
@@ -82,17 +82,17 @@ EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName, bool b
8282
}
8383

8484
// ----------------------------------------------------------------------------
85-
// EntityGenerator Destructor.
85+
// CEntityGenerator Destructor.
8686
// ----------------------------------------------------------------------------
87-
EntityGenerator::~EntityGenerator()
87+
CEntityGenerator::~CEntityGenerator()
8888
{
8989
delete[] m_szClassName;
9090
}
9191

9292
// ----------------------------------------------------------------------------
9393
// Returns the next valid edict_t instance.
9494
// ----------------------------------------------------------------------------
95-
edict_t* EntityGenerator::getNext()
95+
edict_t* CEntityGenerator::getNext()
9696
{
9797
edict_t* pEdict = NULL;
9898
while(m_iEntityIndex < gpGlobals->maxEntities)
@@ -125,7 +125,7 @@ edict_t* EntityGenerator::getNext()
125125
//---------------------------------------------------------------------------------
126126
// Private function, creates a copy of the class name string.
127127
//---------------------------------------------------------------------------------
128-
void EntityGenerator::makeStringCopy(const char* szClassName, unsigned int uiClassNameLen)
128+
void CEntityGenerator::makeStringCopy(const char* szClassName, unsigned int uiClassNameLen)
129129
{
130130
if (uiClassNameLen > 0)
131131
{

src/core/modules/entities/entities_generator_wrap.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ struct edict_t;
4141
// ----------------------------------------------------------------------------
4242
// Declare the generator class.
4343
// ----------------------------------------------------------------------------
44-
class EntityGenerator: public IPythonGenerator<edict_t>
44+
class CEntityGenerator: public IPythonGenerator<edict_t>
4545
{
4646
public:
47-
EntityGenerator(PyObject* self);
48-
EntityGenerator(PyObject* self, const EntityGenerator& rhs);
49-
EntityGenerator(PyObject* self, const char* szClassName);
50-
EntityGenerator(PyObject* self, const char* szClassName, bool exactMatch);
51-
virtual ~EntityGenerator();
47+
CEntityGenerator(PyObject* self);
48+
CEntityGenerator(PyObject* self, const CEntityGenerator& rhs);
49+
CEntityGenerator(PyObject* self, const char* szClassName);
50+
CEntityGenerator(PyObject* self, const char* szClassName, bool exactMatch);
51+
virtual ~CEntityGenerator();
5252

5353
protected:
5454
virtual edict_t* getNext();
@@ -61,6 +61,6 @@ class EntityGenerator: public IPythonGenerator<edict_t>
6161
bool m_bExactMatch;
6262
};
6363

64-
BOOST_SPECIALIZE_HAS_BACK_REFERENCE(EntityGenerator)
64+
BOOST_SPECIALIZE_HAS_BACK_REFERENCE(CEntityGenerator)
6565

6666
#endif

src/core/modules/entities/entities_wrap_python.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,23 @@ void export_edict()
445445
}
446446

447447
//-----------------------------------------------------------------------------
448-
// Exports EntityGenerator.
448+
// Exports CEntityGenerator.
449449
//-----------------------------------------------------------------------------
450450
void export_entity_generator()
451451
{
452-
// TODO: Rename
453-
BOOST_GENERATOR_CLASS(EntityGenerator)
454-
CLASS_CONSTRUCTOR(const char*)
455-
CLASS_CONSTRUCTOR(const char*, bool)
456-
BOOST_END_CLASS()
452+
class_<CEntityGenerator>("EntityGenerator")
453+
.def(init<const char*>())
454+
.def(init<const char*, bool>())
455+
456+
.def("__iter__",
457+
&CEntityGenerator::iter,
458+
"Returns the iterable object."
459+
)
460+
461+
.def("__next__",
462+
&CEntityGenerator::next,
463+
"Returns the next valid instance.",
464+
reference_existing_object_policy()
465+
)
466+
;
457467
}

0 commit comments

Comments
 (0)