Skip to content

Commit 7895eee

Browse files
committed
server: Remove negative value check in prop & clothes methods
Former-commit-id: 459a234
1 parent 990ddcb commit 7895eee

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

server/src/bindings/Player.cpp

+17-25
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,9 @@ static void SetClothes(const v8::FunctionCallbackInfo<v8::Value>& info)
203203
V8_CHECK_ARGS_LEN_MIN_MAX(3, 4);
204204
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
205205

206-
V8_ARG_TO_INT(1, component);
207-
V8_ARG_TO_INT(2, drawable);
208-
V8_ARG_TO_INT(3, texture);
209-
210-
V8_CHECK(component >= 0 && drawable >= 0 && texture >= 0, "setClothes args have to be positive, -1 won't reset");
206+
V8_ARG_TO_UINT32(1, component);
207+
V8_ARG_TO_UINT32(2, drawable);
208+
V8_ARG_TO_UINT32(3, texture);
211209

212210
if(info.Length() == 3)
213211
{
@@ -227,11 +225,9 @@ static void SetDlcClothes(const v8::FunctionCallbackInfo<v8::Value>& info)
227225
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
228226

229227
V8_ARG_TO_UINT32(1, dlc);
230-
V8_ARG_TO_INT(2, component);
231-
V8_ARG_TO_INT(3, drawable);
232-
V8_ARG_TO_INT(4, texture);
233-
234-
V8_CHECK(component >= 0 && drawable >= 0 && texture >= 0, "setDlcClothes args have to be positive, -1 won't reset");
228+
V8_ARG_TO_UINT32(2, component);
229+
V8_ARG_TO_UINT32(3, drawable);
230+
V8_ARG_TO_UINT32(4, texture);
235231

236232
if(info.Length() == 4)
237233
{
@@ -250,7 +246,7 @@ static void GetClothes(const v8::FunctionCallbackInfo<v8::Value>& info)
250246
V8_CHECK_ARGS_LEN(1);
251247
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
252248

253-
V8_ARG_TO_INT(1, component);
249+
V8_ARG_TO_UINT32(1, component);
254250

255251
V8_NEW_OBJECT(clothes);
256252

@@ -268,7 +264,7 @@ static void GetDlcClothes(const v8::FunctionCallbackInfo<v8::Value>& info)
268264
V8_CHECK_ARGS_LEN(1);
269265
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
270266

271-
V8_ARG_TO_INT(1, component);
267+
V8_ARG_TO_UINT32(1, component);
272268

273269
V8_NEW_OBJECT(clothes);
274270

@@ -287,11 +283,9 @@ static void SetProps(const v8::FunctionCallbackInfo<v8::Value>& info)
287283
V8_CHECK_ARGS_LEN(3);
288284
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
289285

290-
V8_ARG_TO_INT(1, component);
291-
V8_ARG_TO_INT(2, drawable);
292-
V8_ARG_TO_INT(3, texture);
293-
294-
V8_CHECK(component >= 0 && drawable >= 0 && texture >= 0, "setProp args have to be positive, -1 won't reset use clearProp");
286+
V8_ARG_TO_UINT32(1, component);
287+
V8_ARG_TO_UINT32(2, drawable);
288+
V8_ARG_TO_UINT32(3, texture);
295289

296290
player->SetProps(component, drawable, texture);
297291
}
@@ -303,12 +297,10 @@ static void SetDlcProps(const v8::FunctionCallbackInfo<v8::Value>& info)
303297
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
304298

305299
V8_ARG_TO_UINT32(1, dlc);
306-
V8_ARG_TO_INT(2, component);
307-
V8_ARG_TO_INT(3, drawable);
308-
V8_ARG_TO_INT(4, texture);
300+
V8_ARG_TO_UINT32(2, component);
301+
V8_ARG_TO_UINT32(3, drawable);
302+
V8_ARG_TO_UINT32(4, texture);
309303

310-
V8_CHECK(component >= 0 && drawable >= 0 && texture >= 0, "setDlcProp args have to be positive, -1 won't reset use clearProp");
311-
312304
player->SetDlcProps(component, drawable, texture, dlc);
313305
}
314306

@@ -318,7 +310,7 @@ static void ClearProps(const v8::FunctionCallbackInfo<v8::Value>& info)
318310
V8_CHECK_ARGS_LEN(1);
319311
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
320312

321-
V8_ARG_TO_INT(1, component);
313+
V8_ARG_TO_UINT32(1, component);
322314

323315
player->ClearProps(component);
324316
}
@@ -329,7 +321,7 @@ static void GetProps(const v8::FunctionCallbackInfo<v8::Value>& info)
329321
V8_CHECK_ARGS_LEN(1);
330322
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
331323

332-
V8_ARG_TO_INT(1, component);
324+
V8_ARG_TO_UINT32(1, component);
333325

334326
V8_NEW_OBJECT(prop);
335327

@@ -346,7 +338,7 @@ static void GetDlcProps(const v8::FunctionCallbackInfo<v8::Value>& info)
346338
V8_CHECK_ARGS_LEN(1);
347339
V8_GET_THIS_BASE_OBJECT(player, IPlayer);
348340

349-
V8_ARG_TO_INT(1, component);
341+
V8_ARG_TO_UINT32(1, component);
350342

351343
V8_NEW_OBJECT(prop);
352344

0 commit comments

Comments
 (0)