File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,14 @@ cs_bool CPE_IsModelDefined(cs_byte id) {
2929 return customModels [id ] != NULL || id < 15 ;
3030}
3131
32+ cs_bool CPE_IsModelDefinedPtr (CPEModel * model ) {
33+ for (cs_int16 i = 0 ; i < 256 ; i ++ ) {
34+ if (customModels [i ] == model )
35+ return true;
36+ }
37+ return false;
38+ }
39+
3240cs_str CPE_GetDefaultModelName (void ) {
3341 return customModels [0 ] ? customModels [0 ]-> name : originalModelNames [0 ];
3442}
@@ -39,6 +47,7 @@ CPEModel *CPE_GetModel(cs_byte id) {
3947
4048cs_bool CPE_DefineModel (cs_byte id , CPEModel * model ) {
4149 if (!model -> part || !model -> partsCount ) return false;
50+ if (CPE_IsModelDefinedPtr (model )) return false;
4251 customModels [id ] = model ;
4352 for (ClientID i = 0 ; i < MAX_CLIENTS ; i ++ ) {
4453 Client * client = Clients_List [i ];
Original file line number Diff line number Diff line change 55#include "types/client.h"
66
77API cs_bool CPE_IsModelDefined (cs_byte id );
8+ API cs_bool CPE_IsModelDefinedPtr (CPEModel * model );
89API cs_str CPE_GetDefaultModelName (void );
910API CPEModel * CPE_GetModel (cs_byte id );
1011API cs_bool CPE_DefineModel (cs_byte id , CPEModel * model );
You can’t perform that action at this time.
0 commit comments