Skip to content

Commit 6f5fe7d

Browse files
committed
Changed CPlayerGenerator and CEntityGenerator to PlayerGenerator and EntityGenerator. Made appropriate changes within the Python API for this name change.
Changed C++ side <type>CommandManager objects to <type>CommandDispatcher. This was done because Python already has <type>CommandManager classes, and we want to avoid duplicate names.
1 parent 815fab4 commit 6f5fe7d

File tree

10 files changed

+46
-46
lines changed

10 files changed

+46
-46
lines changed

addons/source-python/packages/source-python/filters/players.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from configobj import ConfigObj
99

1010
# Source.Python Imports
11-
from player_c import CPlayerGenerator
11+
from player_c import PlayerGenerator
1212
from core import GameEngine
1313
from core import GAME_NAME
1414
from paths import SP_DATA_PATH
@@ -54,7 +54,7 @@ class PlayerIter(_IterObject):
5454
manager = PlayerIterManager
5555

5656
# Store the base iterator
57-
iterator = staticmethod(CPlayerGenerator)
57+
iterator = staticmethod(PlayerGenerator)
5858

5959

6060
# =============================================================================

addons/source-python/packages/source-python/filters/weapons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# >> IMPORTS
55
# =============================================================================
66
# Source.Python Imports
7-
from entity_c import CEntityGenerator
7+
from entity_c import EntityGenerator
88
from public import public
99
# Entities
1010
from entities.entity import BaseEntity
@@ -41,7 +41,7 @@ def iterator():
4141
'''Iterates over only weapon entities'''
4242

4343
# Loop through all entities on the server
44-
for edict in CEntityGenerator():
44+
for edict in EntityGenerator():
4545

4646
# Is the entity a weapon?
4747
if edict.get_class_name() in WeaponManager:

addons/source-python/packages/source-python/players/games/csgo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# >> IMPORTS
55
# =============================================================================
66
# Source.Python Imports
7-
from entity_c import CEntityGenerator
7+
from entity_c import EntityGenerator
88
# Entities
99
from entities.entity import BaseEntity
1010
from entities.helpers import index_from_edict
@@ -100,7 +100,7 @@ def has_c4(self):
100100
'''Returns whether or not the player is carrying C4'''
101101

102102
# Loop through all c4 entities on the server
103-
for edict in CEntityGenerator('weapon_c4'):
103+
for edict in EntityGenerator('weapon_c4'):
104104

105105
# Get the entity's index
106106
index = index_from_edict(edict)

src/core/modules/commands/command_wrap_python.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( get_server_command_overloads, GetServerCommand,
159159
void export_server_command()
160160
{
161161
// TODO: Rename
162-
class_<CServerCommandManager, boost::noncopyable>("ServerCommandManager", no_init)
162+
class_<CServerCommandManager, boost::noncopyable>("ServerCommandDispatcher", no_init)
163163
.def("add_callback",
164164
&CServerCommandManager::AddCallback,
165165
"Adds a callback to the server command's list.",
@@ -175,7 +175,7 @@ void export_server_command()
175175

176176
def("get_server_command",
177177
GetServerCommand,
178-
get_server_command_overloads("Gets the ServerCommandManager instance using just the name or also the helptext and/or flags",
178+
get_server_command_overloads("Gets the ServerCommandDispatcher instance using just the name or also the helptext and/or flags",
179179
args("name", "help_text", "flags")
180180
)[reference_existing_object_policy()]
181181
);
@@ -187,7 +187,7 @@ void export_server_command()
187187
void export_client_command()
188188
{
189189
// TODO: Rename
190-
class_<CClientCommandManager, boost::noncopyable>("ClientCommandManager", no_init)
190+
class_<CClientCommandManager, boost::noncopyable>("ClientCommandDispatcher", no_init)
191191
.def("add_callback",
192192
&CClientCommandManager::AddCallback,
193193
"Adds a callback to the client command's list.",
@@ -203,7 +203,7 @@ void export_client_command()
203203

204204
def("get_client_command",
205205
GetClientCommand,
206-
"Returns the ClientCommandManager instance for the given command",
206+
"Returns the ClientCommandDispatcher instance for the given command",
207207
args("name"),
208208
reference_existing_object_policy()
209209
);
@@ -227,7 +227,7 @@ void export_client_command()
227227
void export_say_command()
228228
{
229229
// TODO: Rename
230-
class_<CSayCommandManager, boost::noncopyable>("SayCommandManager", no_init)
230+
class_<CSayCommandManager, boost::noncopyable>("SayCommandDispatcher", no_init)
231231
.def("add_callback",
232232
&CSayCommandManager::AddCallback,
233233
"Adds a callback to the say command's list.",
@@ -243,7 +243,7 @@ void export_say_command()
243243

244244
def("get_say_command",
245245
GetSayCommand,
246-
"Returns the SayCommandManager instance for the given command",
246+
"Returns the SayCommandDispatcher instance for the given command",
247247
args("name"),
248248
reference_existing_object_policy()
249249
);

src/core/modules/entities/entities_generator_wrap.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
#include "boost/python/iterator.hpp"
3434

3535
// ----------------------------------------------------------------------------
36-
// CEntityGenerator Constructor.
36+
// EntityGenerator Constructor.
3737
// ----------------------------------------------------------------------------
38-
CEntityGenerator::CEntityGenerator( PyObject* self ):
38+
EntityGenerator::EntityGenerator( PyObject* self ):
3939
IPythonGenerator<edict_t>(self),
4040
m_iEntityIndex(0),
4141
m_szClassName(NULL),
@@ -45,9 +45,9 @@ CEntityGenerator::CEntityGenerator( PyObject* self ):
4545
}
4646

4747
// ----------------------------------------------------------------------------
48-
// CEntityGenerator Copy-Constructor.
48+
// EntityGenerator Copy-Constructor.
4949
// ----------------------------------------------------------------------------
50-
CEntityGenerator::CEntityGenerator( PyObject* self, const CEntityGenerator& rhs ):
50+
EntityGenerator::EntityGenerator( PyObject* self, const EntityGenerator& rhs ):
5151
IPythonGenerator<edict_t>(self),
5252
m_iEntityIndex(rhs.m_iEntityIndex),
5353
m_uiClassNameLen(rhs.m_uiClassNameLen),
@@ -57,9 +57,9 @@ CEntityGenerator::CEntityGenerator( PyObject* self, const CEntityGenerator& rhs
5757
}
5858

5959
// ----------------------------------------------------------------------------
60-
// CEntityGenerator Constructor (takes a filter string).
60+
// EntityGenerator Constructor (takes a filter string).
6161
// ----------------------------------------------------------------------------
62-
CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName):
62+
EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName):
6363
IPythonGenerator<edict_t>(self),
6464
m_iEntityIndex(0),
6565
m_uiClassNameLen(strlen(szClassName)),
@@ -69,9 +69,9 @@ CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName):
6969
}
7070

7171
// ----------------------------------------------------------------------------
72-
// CEntityGenerator Constructor (takes a filter string and a boolean flag).
72+
// EntityGenerator Constructor (takes a filter string and a boolean flag).
7373
// ----------------------------------------------------------------------------
74-
CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName, bool bExactMatch):
74+
EntityGenerator::EntityGenerator(PyObject* self, const char* szClassName, bool bExactMatch):
7575
IPythonGenerator<edict_t>(self),
7676
m_iEntityIndex(0),
7777
m_uiClassNameLen(strlen(szClassName)),
@@ -81,17 +81,17 @@ CEntityGenerator::CEntityGenerator(PyObject* self, const char* szClassName, bool
8181
}
8282

8383
// ----------------------------------------------------------------------------
84-
// CEntityGenerator Destructor.
84+
// EntityGenerator Destructor.
8585
// ----------------------------------------------------------------------------
86-
CEntityGenerator::~CEntityGenerator()
86+
EntityGenerator::~EntityGenerator()
8787
{
8888
delete[] m_szClassName;
8989
}
9090

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

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 CEntityGenerator: public IPythonGenerator<edict_t>
44+
class EntityGenerator: public IPythonGenerator<edict_t>
4545
{
4646
public:
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();
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();
5252

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

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

6666
#endif

src/core/modules/entities/entities_wrap_python.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,12 @@ void export_edict()
445445
}
446446

447447
//-----------------------------------------------------------------------------
448-
// Exports CEntityGenerator.
448+
// Exports EntityGenerator.
449449
//-----------------------------------------------------------------------------
450450
void export_entity_generator()
451451
{
452452
// TODO: Rename
453-
BOOST_GENERATOR_CLASS(CEntityGenerator)
453+
BOOST_GENERATOR_CLASS(EntityGenerator)
454454
CLASS_CONSTRUCTOR(const char*)
455455
CLASS_CONSTRUCTOR(const char*, bool)
456456
BOOST_END_CLASS()

src/core/modules/players/players_generator_wrap.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@
3838
extern IPlayerInfoManager* playerinfomanager;
3939

4040
// ----------------------------------------------------------------------------
41-
// CPlayerGenerator Constructor.
41+
// PlayerGenerator Constructor.
4242
// ----------------------------------------------------------------------------
43-
CPlayerGenerator::CPlayerGenerator( PyObject* self ):
43+
PlayerGenerator::PlayerGenerator( PyObject* self ):
4444
IPythonGenerator<IPlayerInfo>(self),
4545
m_iEntityIndex(0)
4646
{
4747
}
4848

4949
// ----------------------------------------------------------------------------
50-
// CPlayerGenerator Copy-Constructor.
50+
// PlayerGenerator Copy-Constructor.
5151
// ----------------------------------------------------------------------------
52-
CPlayerGenerator::CPlayerGenerator( PyObject* self, const CPlayerGenerator& rhs ):
52+
PlayerGenerator::PlayerGenerator( PyObject* self, const PlayerGenerator& rhs ):
5353
IPythonGenerator<IPlayerInfo>(self),
5454
m_iEntityIndex(rhs.m_iEntityIndex)
5555
{
5656
}
5757

5858
// ----------------------------------------------------------------------------
59-
// CPlayerGenerator Destructor.
59+
// PlayerGenerator Destructor.
6060
// ----------------------------------------------------------------------------
61-
CPlayerGenerator::~CPlayerGenerator()
61+
PlayerGenerator::~PlayerGenerator()
6262
{
6363
}
6464

6565
// ----------------------------------------------------------------------------
6666
// Returns the next valid IPlayerInfo instance.
6767
// ----------------------------------------------------------------------------
68-
IPlayerInfo* CPlayerGenerator::getNext()
68+
IPlayerInfo* PlayerGenerator::getNext()
6969
{
7070
IPlayerInfo* pPlayerInfo = NULL;
7171
while(m_iEntityIndex < gpGlobals->maxClients)

src/core/modules/players/players_generator_wrap.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ class IPlayerInfo;
4141
// ----------------------------------------------------------------------------
4242
// Declare the generator class.
4343
// ----------------------------------------------------------------------------
44-
class CPlayerGenerator: public IPythonGenerator<IPlayerInfo>
44+
class PlayerGenerator: public IPythonGenerator<IPlayerInfo>
4545
{
4646
public:
47-
CPlayerGenerator(PyObject* self);
48-
CPlayerGenerator(PyObject* self, const CPlayerGenerator& rhs);
49-
virtual ~CPlayerGenerator();
47+
PlayerGenerator(PyObject* self);
48+
PlayerGenerator(PyObject* self, const PlayerGenerator& rhs);
49+
virtual ~PlayerGenerator();
5050

5151
protected:
5252
virtual IPlayerInfo* getNext();
@@ -55,6 +55,6 @@ class CPlayerGenerator: public IPythonGenerator<IPlayerInfo>
5555
int m_iEntityIndex;
5656
};
5757

58-
BOOST_SPECIALIZE_HAS_BACK_REFERENCE(CPlayerGenerator)
58+
BOOST_SPECIALIZE_HAS_BACK_REFERENCE(PlayerGenerator)
5959

6060
#endif

src/core/modules/players/players_wrap_python.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,6 @@ void export_netinfo()
198198

199199
void export_player_generator()
200200
{
201-
BOOST_GENERATOR_CLASS(CPlayerGenerator)
201+
BOOST_GENERATOR_CLASS(PlayerGenerator)
202202
BOOST_END_CLASS()
203203
}

0 commit comments

Comments
 (0)