Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Index: JSGame.cpp
  2. ===================================================================
  3. --- JSGame.cpp (revision 1149)
  4. +++ JSGame.cpp (working copy)
  5. @@ -184,18 +184,28 @@
  6. JSObject* lvl = NULL;
  7. uint x = 0, y = 0, dx = 0, dy = 0, reductionType = 0, radius = 20;
  8.  
  9. - if(!JS_ConvertArguments(cx, argc, argv, "ouuuu/uu", &lvl, &x, &y, &dx, &dy, &reductionType, &radius))
  10. + if(!JS_ConvertArguments(cx, argc, argv, "uuuuu/uu", &lvl, &x, &y, &dx, &dy, &reductionType, &radius))
  11. return JS_FALSE;
  12. + Level* level;
  13. + if (!(JSVAL_IS_OBJECT(argv[0]))){
  14. + level = GetLevel(JSVAL_TO_INT(argv[0]));
  15. + }else{
  16. + myArea* area = (myArea*)JS_GetPrivate(cx, lvl);
  17. + if(!area)
  18. + THROW_ERROR(cx, "Could not retrieve area data!");
  19.  
  20. + level = GetLevel(area->AreaId);
  21. + }
  22. + if (JSVAL_IS_BOOLEAN(argv[5])){
  23. + if(JSVAL_TO_BOOLEAN(argv[5]))
  24. + reductionType = 2;
  25. + else
  26. + reductionType = 1;
  27. + }
  28. if(reductionType == 3 && !(JSVAL_IS_FUNCTION(cx, argv[7]) && JSVAL_IS_FUNCTION(cx, argv[8])))
  29. THROW_ERROR(cx, "Invalid function values for reduction type");
  30.  
  31. - myArea* area = (myArea*)JS_GetPrivate(cx, lvl);
  32. - if(!area)
  33. - THROW_ERROR(cx, "Could not retrieve area data!");
  34.  
  35. - Level* level = GetLevel(area->AreaId);
  36. -
  37. D2Map map(level->pMisc->pAct, level);
  38.  
  39. Point start(x, y), end(dx, dy);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement