@@ -58,12 +58,18 @@ PyObject *py_ue_get_num_players(ue_PyUObject *self, PyObject * args) {
5858 UWorld *world = ue_get_uworld (self);
5959 if (!world)
6060 return PyErr_Format (PyExc_Exception, " unable to retrieve UWorld from uobject" );
61-
61+ #if ENGINE_MINOR_VERSION < 14
62+ AGameMode *game_mode = world->GetAuthGameMode ();
63+ #else
6264 AGameModeBase *game_mode = world->GetAuthGameMode ();
65+ #endif
6366 if (!game_mode)
6467 return PyErr_Format (PyExc_Exception, " unable to retrieve GameMode from world" );
65-
68+ #if ENGINE_MINOR_VERSION < 14
69+ return PyLong_FromLong (game_mode->NumPlayers );
70+ #else
6671 return PyLong_FromLong (game_mode->GetNumPlayers ());
72+ #endif
6773}
6874
6975PyObject *py_ue_get_num_spectators (ue_PyUObject *self, PyObject * args) {
@@ -73,11 +79,17 @@ PyObject *py_ue_get_num_spectators(ue_PyUObject *self, PyObject * args) {
7379 UWorld *world = ue_get_uworld (self);
7480 if (!world)
7581 return PyErr_Format (PyExc_Exception, " unable to retrieve UWorld from uobject" );
76-
82+ #if ENGINE_MINOR_VERSION < 14
83+ AGameMode *game_mode = world->GetAuthGameMode ();
84+ #else
7785 AGameModeBase *game_mode = world->GetAuthGameMode ();
86+ #endif
7887 if (!game_mode)
7988 return PyErr_Format (PyExc_Exception, " unable to retrieve GameMode from world" );
80-
89+ #if ENGINE_MINOR_VERSION < 14
90+ return PyLong_FromLong (game_mode->NumSpectators );
91+ #else
8192 return PyLong_FromLong (game_mode->GetNumSpectators ());
93+ #endif
8294}
8395
0 commit comments