rpgtkoolmv / corescript

http://www.rpgmakerweb.com/products/programs/rpg-maker-mv
MIT License
311 stars 75 forks source link

Delete Utils.canReadGameFiles method #187

Open Poryg1 opened 6 years ago

Poryg1 commented 6 years ago

What this method does is:

  1. take all already loaded scripts
  2. try to load the last one again. If success, ok, if not, error.

However, if the target script cannot be loaded, rpg_core.js cannot be loaded either. And when rpg_core.js is not loaded, Utils.canReadGameFiles cannot be executed. Therefore this function is completely redundant, since if loading worked perfectly, we will see it, and if not, this function cannot even execute to check for it. I also removed the code from SceneManager to make sure the game won't crash from removing the utils method.

krmbn0576 commented 6 years ago

Thx! I do not think that this method is redundant because it is trying to run XMLHttpRequest correctly. For example, if you play a game on the local system (URL starts with file:///) on Chrome, you can read the file using the <script> tag, but XMLHttpRequest is forbidden. So, canReadGameFiles is still necessary.

But, in fact, this method is not working correctly because the forbidden XMLHttpRequest raises an error asynchronously, so try - catch statements can not catch errors. This may have to be fixed ;-)

Poryg1 commented 6 years ago

Oh, I see, forgot about that one :D Well, in that case the fix is not too difficult at least, on AudioManager it was solved via onError.bind.