| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d9f1570 commit 6b8045d
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,12 +46,6 @@ extern CServerCommandManager* GetServerCommand(const char* szName, | |||
| 46 | 46 | void export_server_command_manager(scope); | |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | - //----------------------------------------------------------------------------- | ||
| 50 | - // Overloads. | ||
| 51 | - //----------------------------------------------------------------------------- | ||
| 52 | - BOOST_PYTHON_FUNCTION_OVERLOADS(get_server_command_overloads, GetServerCommand, 1, 3) | ||
| 53 | - | ||
| 54 | - | ||
| 55 | 49 | //----------------------------------------------------------------------------- | |
| 56 | 50 | // Declare the _commands._server module. | |
| 57 | 51 | //----------------------------------------------------------------------------- | |
@@ -61,10 +55,10 @@ DECLARE_SP_SUBMODULE(_commands, _server) | |||
| 61 | 55 | ||
| 62 | 56 | // Helper functions... | |
| 63 | 57 | def("get_server_command", | |
| 64 | - GetServerCommand, | ||
| 65 | - get_server_command_overloads("Gets the ServerCommandDispatcher instance using just the name or also the helptext and/or flags", | ||
| 66 | - args("name", "help_text", "flags") | ||
| 67 | - )[reference_existing_object_policy()] | ||
| 58 | + &GetServerCommand, | ||
| 59 | + "Gets the ServerCommandDispatcher instance using just the name or also the helptext and/or flags", | ||
| 60 | + ("name", arg("help_text")=object(), arg("flags")=0), | ||
| 61 | + reference_existing_object_policy() | ||
| 68 | 62 | ); | |
| 69 | 63 | } | |
| 70 | 64 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,8 +40,8 @@ class IEngineSoundExt | |||
| 40 | 40 | { | |
| 41 | 41 | public: | |
| 42 | 42 | static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, | |
| 43 | - float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM, const Vector *pOrigin = NULL, const Vector *pDirection = NULL, | ||
| 44 | - tuple origins = tuple(), bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) | ||
| 43 | + float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection, | ||
| 44 | + tuple origins, bool bUpdatePositions, float soundtime, int speakerentity) | ||
| 45 | 45 | { | |
| 46 | 46 | CUtlVector<Vector> *pUtlVecOrigins = NULL; | |
| 47 | 47 | CUtlVector<Vector> vecOrigins; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,12 +40,6 @@ | |||
| 40 | 40 | extern IEngineTrace* enginetrace; | |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | - //--------------------------------------------------------------------------------- | ||
| 44 | - // Overloads. | ||
| 45 | - //--------------------------------------------------------------------------------- | ||
| 46 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_single_player_shared_memory_space_overload, GetSinglePlayerSharedMemorySpace, 1, 2); | ||
| 47 | - | ||
| 48 | - | ||
| 49 | 43 | //--------------------------------------------------------------------------------- | |
| 50 | 44 | // IVEngineServer visitor function. | |
| 51 | 45 | //--------------------------------------------------------------------------------- | |
@@ -122,10 +116,9 @@ T IVEngineServer_Visitor(T cls) | |||
| 122 | 116 | ||
| 123 | 117 | .def("get_single_player_shared_memory_space", | |
| 124 | 118 | &IVEngineServer::GetSinglePlayerSharedMemorySpace, | |
| 125 | - get_single_player_shared_memory_space_overload( | ||
| 126 | - "Finds or creates a shared memory_space.", | ||
| 127 | - args("name", "ent_num") | ||
| 128 | - )[reference_existing_object_policy()] | ||
| 119 | + "Finds or creates a shared memory_space.", | ||
| 120 | + ("name", arg("ent_num")=MAX_EDICTS), | ||
| 121 | + reference_existing_object_policy() | ||
| 129 | 122 | ) | |
| 130 | 123 | ||
| 131 | 124 | /* | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,18 +91,6 @@ DECLARE_SP_MODULE(_engines) | |||
| 91 | 91 | } | |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | - //--------------------------------------------------------------------------------- | ||
| 95 | - // Overloads. | ||
| 96 | - //--------------------------------------------------------------------------------- | ||
| 97 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(precache_model_overload, PrecacheModel, 1, 2); | ||
| 98 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(precache_sentence_file_overload, PrecacheSentenceFile, 1, 2); | ||
| 99 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(precache_decal_overload, PrecacheDecal, 1, 2); | ||
| 100 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(precache_generic_overload, PrecacheGeneric, 1, 2); | ||
| 101 | - | ||
| 102 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(precache_sound_overload, PrecacheSound, 1, 3); | ||
| 103 | - BOOST_PYTHON_FUNCTION_OVERLOADS(emit_sound_overload, IEngineSoundExt::EmitSound, 7, 15); | ||
| 104 | - | ||
| 105 | - | ||
| 106 | 94 | //--------------------------------------------------------------------------------- | |
| 107 | 95 | // Exports IVEngineServer. | |
| 108 | 96 | //--------------------------------------------------------------------------------- | |
@@ -138,26 +126,20 @@ void export_engine_server(scope _engines) | |||
| 138 | 126 | ||
| 139 | 127 | .def("precache_model", | |
| 140 | 128 | &IVEngineServer::PrecacheModel, | |
| 141 | - precache_model_overload( | ||
| 142 | - "Precaches a model and returns an integer containing its index.", | ||
| 143 | - args("s", "preload") | ||
| 144 | - ) | ||
| 129 | + "Precaches a model and returns an integer containing its index.", | ||
| 130 | + ("s", arg("preload")=false) | ||
| 145 | 131 | ) | |
| 146 | 132 | ||
| 147 | 133 | .def("precache_decal", | |
| 148 | 134 | &IVEngineServer::PrecacheDecal, | |
| 149 | - precache_decal_overload( | ||
| 150 | - "Precaches a decal file and returns an integer containing its index.", | ||
| 151 | - args("s", "preload") | ||
| 152 | - ) | ||
| 135 | + "Precaches a decal file and returns an integer containing its index.", | ||
| 136 | + ("s", arg("preload")=false) | ||
| 153 | 137 | ) | |
| 154 | 138 | ||
| 155 | 139 | .def("precache_generic", | |
| 156 | 140 | &IVEngineServer::PrecacheGeneric, | |
| 157 | - precache_generic_overload( | ||
| 158 | - "Precaches a generic asset file and returns an integer containing its index.", | ||
| 159 | - args("s", "preload") | ||
| 160 | - ) | ||
| 141 | + "Precaches a generic asset file and returns an integer containing its index.", | ||
| 142 | + ("s", arg("preload")=false) | ||
| 161 | 143 | ) | |
| 162 | 144 | ||
| 163 | 145 | .def("is_model_precached", | |
@@ -748,10 +730,8 @@ void export_engine_sound(scope _engines) | |||
| 748 | 730 | ||
| 749 | 731 | .def("precache_sound", | |
| 750 | 732 | &IEngineSound::PrecacheSound, | |
| 751 | - precache_sound_overload( | ||
| 752 | - args("sample", "preload", "is_ui_sound"), | ||
| 753 | - "Precaches a particular sample." | ||
| 754 | - ) | ||
| 733 | + ("sample", arg("preload")=false, arg("is_ui_sound")=false), | ||
| 734 | + "Precaches a particular sample." | ||
| 755 | 735 | ) | |
| 756 | 736 | ||
| 757 | 737 | .def("is_sound_precached", | |
@@ -774,10 +754,11 @@ void export_engine_sound(scope _engines) | |||
| 774 | 754 | ||
| 775 | 755 | .def("emit_sound", | |
| 776 | 756 | &IEngineSoundExt::EmitSound, | |
| 777 | - emit_sound_overload( | ||
| 778 | - args("filter", "entity_index", "channel", "sample", "volume", "attenuation", "flags", "pitch", "origin", "direction", "origins", "update_positions", "sound_time", "speaker_entity"), | ||
| 779 | - "Emits a sound from an entity." | ||
| 780 | - ) | ||
| 757 | + ("filter", "entity_index", "channel", "sample", | ||
| 758 | + "volume", "attenuation", | ||
| 759 | + arg("flags")=0, arg("pitch")=PITCH_NORM, arg("origin")=object(), arg("direction")=object(), | ||
| 760 | + arg("origins")=tuple(), arg("update_positions")=true, arg("sound_time")=0.0f, arg("speaker_entity")=INVALID_ENTITY_INDEX), | ||
| 761 | + "Emits a sound from an entity." | ||
| 781 | 762 | ) | |
| 782 | 763 | ||
| 783 | 764 | // TODO: Can we use IVEngineServer::SentenceNameFromIndex() and then call IEngineSound::EmitSound()? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,8 +40,8 @@ class IEngineSoundExt | |||
| 40 | 40 | { | |
| 41 | 41 | public: | |
| 42 | 42 | static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, | |
| 43 | - float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM, const Vector *pOrigin = NULL, const Vector *pDirection = NULL, | ||
| 44 | - tuple origins = tuple(), bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1) | ||
| 43 | + float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection, | ||
| 44 | + tuple origins, bool bUpdatePositions, float soundtime, int speakerentity) | ||
| 45 | 45 | { | |
| 46 | 46 | CUtlVector<Vector> *pUtlVecOrigins = NULL; | |
| 47 | 47 | CUtlVector<Vector> vecOrigins; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,18 +58,6 @@ DECLARE_SP_MODULE(_events) | |||
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | - //----------------------------------------------------------------------------- | ||
| 62 | - // Overloads. | ||
| 63 | - //----------------------------------------------------------------------------- | ||
| 64 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_bool_overload, GetBool, 1, 2); | ||
| 65 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_int_overload, GetInt, 1, 2); | ||
| 66 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_float_overload, GetFloat, 1, 2); | ||
| 67 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_string_overload, GetString, 1, 2); | ||
| 68 | - | ||
| 69 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(create_event_overload, CreateEvent, 1, 2); | ||
| 70 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fire_event_overload, FireEvent, 1, 2); | ||
| 71 | - | ||
| 72 | - | ||
| 73 | 61 | //----------------------------------------------------------------------------- | |
| 74 | 62 | // Exports IGameEvent. | |
| 75 | 63 | //----------------------------------------------------------------------------- | |
@@ -99,34 +87,26 @@ void export_igameevent(scope _events) | |||
| 99 | 87 | ||
| 100 | 88 | .def("get_bool", | |
| 101 | 89 | &IGameEvent::GetBool, | |
| 102 | - get_bool_overload( | ||
| 103 | - args("key_name", "default_value"), | ||
| 104 | - "Returns the value of the key name as a bool." | ||
| 105 | - ) | ||
| 90 | + ("key_name", arg("default_value")=false), | ||
| 91 | + "Returns the value of the key name as a bool." | ||
| 106 | 92 | ) | |
| 107 | 93 | ||
| 108 | 94 | .def("get_int", | |
| 109 | 95 | &IGameEvent::GetInt, | |
| 110 | - get_int_overload( | ||
| 111 | - args("key_name", "default_value"), | ||
| 112 | - "Returns the value of the key name as an int." | ||
| 113 | - ) | ||
| 96 | + ("key_name", arg("default_value")=0), | ||
| 97 | + "Returns the value of the key name as an int." | ||
| 114 | 98 | ) | |
| 115 | 99 | ||
| 116 | 100 | .def("get_float", | |
| 117 | 101 | &IGameEvent::GetFloat, | |
| 118 | - get_float_overload( | ||
| 119 | - args("key_name", "default_value"), | ||
| 120 | - "Returns the value of the key name as a float." | ||
| 121 | - ) | ||
| 102 | + ("key_name", arg("default_value")=0.0f), | ||
| 103 | + "Returns the value of the key name as a float." | ||
| 122 | 104 | ) | |
| 123 | 105 | ||
| 124 | 106 | .def("get_string", | |
| 125 | 107 | &IGameEvent::GetString, | |
| 126 | - get_string_overload( | ||
| 127 | - args("key_name", "default_value"), | ||
| 128 | - "Returns the value of the key name as a string." | ||
| 129 | - ) | ||
| 108 | + ("key_name", arg("default_value")=""), | ||
| 109 | + "Returns the value of the key name as a string." | ||
| 130 | 110 | ) | |
| 131 | 111 | ||
| 132 | 112 | .def("set_bool", | |
@@ -222,22 +202,19 @@ void export_igameeventmanager(scope _events) | |||
| 222 | 202 | ||
| 223 | 203 | .def("create_event", | |
| 224 | 204 | &IGameEventManager2::CreateEvent, | |
| 225 | - create_event_overload( | ||
| 226 | - "Creates an event by name but doesn't fire it. Returns NULL if the event\ | ||
| 227 | - is not known or no listener is registered for it. Setting should_force to\ | ||
| 228 | - True forces the creation of the event even if no listener for it is active.", | ||
| 229 | - args("event_name", "bForce") | ||
| 230 | - )[reference_existing_object_policy()] | ||
| 205 | + "Creates an event by name but doesn't fire it. Returns NULL if the event\ | ||
| 206 | + is not known or no listener is registered for it. Setting should_force to\ | ||
| 207 | + True forces the creation of the event even if no listener for it is active.", | ||
| 208 | + ("event_name", arg("bForce")=false), | ||
| 209 | + reference_existing_object_policy() | ||
| 231 | 210 | ) | |
| 232 | 211 | ||
| 233 | 212 | .def("fire_event", | |
| 234 | 213 | &IGameEventManager2::FireEvent, | |
| 235 | - fire_event_overload( | ||
| 236 | - "Fires a server event created by create_event. If dont_broadcast is set\ | ||
| 237 | - to False (which it is by default), the event is not sent to clients.\ | ||
| 238 | - Returns true if the event is fired off successfully.", | ||
| 239 | - args("game_event", "dont_broadcast") | ||
| 240 | - ) | ||
| 214 | + "Fires a server event created by create_event. If dont_broadcast is set\ | ||
| 215 | + to False (which it is by default), the event is not sent to clients.\ | ||
| 216 | + Returns true if the event is fired off successfully.", | ||
| 217 | + ("game_event", arg("dont_broadcast")=false) | ||
| 241 | 218 | ) | |
| 242 | 219 | ||
| 243 | 220 | .def("fire_event_client_side", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,19 +48,6 @@ DECLARE_SP_MODULE(_keyvalues) | |||
| 48 | 48 | } | |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | - //--------------------------------------------------------------------------------- | ||
| 52 | - // Overloads. | ||
| 53 | - //--------------------------------------------------------------------------------- | ||
| 54 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(find_key_overload, FindKey, 1, 2); | ||
| 55 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_int_overload, GetInt, 0, 2); | ||
| 56 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_uint64_overload, GetUint64, 0, 2); | ||
| 57 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_float_overload, GetFloat, 0, 2); | ||
| 58 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_string_overload, GetString, 0, 2); | ||
| 59 | - BOOST_PYTHON_FUNCTION_OVERLOADS(get_color_overload, KeyValuesExt::GetColor, 2, 3); | ||
| 60 | - BOOST_PYTHON_FUNCTION_OVERLOADS(get_bool_overload, KeyValuesExt::GetBool, 2, 3); | ||
| 61 | - BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(is_empty_overload, IsEmpty, 0, 1); | ||
| 62 | - | ||
| 63 | - | ||
| 64 | 51 | //--------------------------------------------------------------------------------- | |
| 65 | 52 | // Exports KeyValues. | |
| 66 | 53 | //--------------------------------------------------------------------------------- | |
@@ -100,7 +87,7 @@ void export_keyvalues(scope _keyvalues) | |||
| 100 | 87 | "Loads KeyValues data from a file into this KeyValues instance.", | |
| 101 | 88 | args("file_name") | |
| 102 | 89 | ) | |
| 103 | - | ||
| 90 | + | ||
| 104 | 91 | .def("save_to_file", | |
| 105 | 92 | &KeyValuesExt::SaveToFile, | |
| 106 | 93 | args("file_name"), | |
@@ -109,19 +96,18 @@ void export_keyvalues(scope _keyvalues) | |||
| 109 | 96 | ||
| 110 | 97 | .def("find_key", | |
| 111 | 98 | GET_METHOD(KeyValues *, KeyValues, FindKey, const char *, bool), | |
| 112 | - find_key_overload( | ||
| 113 | - "Finds a KeyValue. Creates it if create_key is set.", | ||
| 114 | - args("key_name", "create_key") | ||
| 115 | - )[reference_existing_object_policy()] | ||
| 99 | + "Finds a KeyValue. Creates it if create_key is set.", | ||
| 100 | + ("key_name", arg("create_key")=false), | ||
| 101 | + reference_existing_object_policy() | ||
| 116 | 102 | ) | |
| 117 | - | ||
| 103 | + | ||
| 118 | 104 | .def("find_key_by_symbol", | |
| 119 | 105 | static_cast< KeyValues* (KeyValues::*)( int ) const >(&KeyValues::FindKey), | |
| 120 | 106 | "Finds a subkey by an integer identifier.", | |
| 121 | 107 | args("key"), | |
| 122 | 108 | reference_existing_object_policy() | |
| 123 | 109 | ) | |
| 124 | - | ||
| 110 | + | ||
| 125 | 111 | .def("create_new_key", | |
| 126 | 112 | &KeyValues::CreateNewKey, | |
| 127 | 113 | "Creates a new child key with an autogenerated name. The name is guaranteed to be\ | |
@@ -180,58 +166,44 @@ void export_keyvalues(scope _keyvalues) | |||
| 180 | 166 | ||
| 181 | 167 | .def("get_int", | |
| 182 | 168 | GET_METHOD(int, KeyValues, GetInt, const char *, int), | |
| 183 | - get_int_overload( | ||
| 184 | - "Returns the integer value for the given key name.", | ||
| 185 | - args("key_name", "default_value") | ||
| 186 | - ) | ||
| 169 | + "Returns the integer value for the given key name.", | ||
| 170 | + ("key_name", arg("default_value")=0) | ||
| 187 | 171 | ) | |
| 188 | 172 | ||
| 189 | 173 | .def("get_uint64", | |
| 190 | 174 | GET_METHOD(uint64, KeyValues, GetUint64, const char *, uint64), | |
| 191 | - get_uint64_overload( | ||
| 192 | - "Gets the 64-bit integer value for the given key name.", | ||
| 193 | - args("key_name", "default_value") | ||
| 194 | - ) | ||
| 175 | + "Gets the 64-bit integer value for the given key name.", | ||
| 176 | + ("key_name", arg("default_value")=0) | ||
| 195 | 177 | ) | |
| 196 | 178 | ||
| 197 | 179 | .def("get_float", | |
| 198 | 180 | GET_METHOD(float, KeyValues, GetFloat, const char *, float), | |
| 199 | - get_float_overload( | ||
| 200 | - "Returns the floating point value for the given key name.", | ||
| 201 | - args("key_name", "default_value") | ||
| 202 | - ) | ||
| 181 | + "Returns the floating point value for the given key name.", | ||
| 182 | + ("key_name", arg("default_value")=0.0f) | ||
| 203 | 183 | ) | |
| 204 | 184 | ||
| 205 | 185 | .def("get_string", | |
| 206 | 186 | GET_METHOD(const char *, KeyValues, GetString, const char *, const char *), | |
| 207 | - get_string_overload( | ||
| 208 | - "Returns the string value for the given key name.", | ||
| 209 | - args("key_name", "default_value") | ||
| 210 | - ) | ||
| 187 | + "Returns the string value for the given key name.", | ||
| 188 | + ("key_name", arg("default_value")="") | ||
| 211 | 189 | ) | |
| 212 | 190 | ||
| 213 | 191 | .def("get_color", | |
| 214 | 192 | &KeyValuesExt::GetColor, | |
| 215 | - get_color_overload( | ||
| 216 | - "Returns the color value of the given key name.", | ||
| 217 | - args("key_name", "default_value") | ||
| 218 | - ) | ||
| 193 | + "Returns the color value of the given key name.", | ||
| 194 | + ("key_name", arg("default_value")=object()) | ||
| 219 | 195 | ) | |
| 220 | 196 | ||
| 221 | 197 | .def("get_bool", | |
| 222 | 198 | &KeyValuesExt::GetBool, | |
| 223 | - get_bool_overload( | ||
| 224 | - "Returns the boolean value for the given key name.", | ||
| 225 | - args("key_name", "default_value") | ||
| 226 | - ) | ||
| 199 | + "Returns the boolean value for the given key name.", | ||
| 200 | + ("key_name", arg("default_value")=false) | ||
| 227 | 201 | ) | |
| 228 | 202 | ||
| 229 | 203 | .def("is_empty", | |
| 230 | 204 | GET_METHOD(bool, KeyValues, IsEmpty, const char *), | |
| 231 | - is_empty_overload( | ||
| 232 | - "Returns true if this key or the given key is empty.", | ||
| 233 | - args("key_name") | ||
| 234 | - ) | ||
| 205 | + "Returns true if this key or the given key is empty.", | ||
| 206 | + (arg("key_name")=object()) | ||
| 235 | 207 | ) | |
| 236 | 208 | ||
| 237 | 209 | .def("set_string", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments