Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
It looks good, but one thing I noticed is the way you extract the data from each entry.
It obviously works so I'm not saying it is wrong, but it could be optimized quite a bit.
What you currently do is search the whole line for "posX", then search the whole line for "posY", and so on (with all possible data/elements), which means each line is processed multiple times.
You could instead extract each keyword in one run and then write the data to the target step by step as they are found.
So for example a line with 3 elements ("posX", "posY", "posZ") can be looped through to find the keywords/elements, and everytime one is found you write the data to the target variable or array. That way you only process small parts of the line for each element and save a bit processing time. For huge map files this results in quite a speed difference.
Also, what I personally miss a bit is the fact that you cannot decide what happens with items that were found. If I see it right, it basically just creates the objects that are found.
You could think of adding a callback that is called for each loaded item, with item type, position etc. Then the user could decide what to do with a loaded item (create a dynamic object, a player class, a vehicle, or a custom item).
Right now it only creates static objects with CreateObject, if I were to use the Streamer Plugin I had to edit the Include to change attributes like Stream Distance or Virtual Worlds. I think everyone uses the Streamer Plugin nowadays so I think at least adding support and some customization for that would be a great thing!
Add virtualworld, interior, playerid and stream/draw distance arguments to the "LoadMapFile" function so I could for example load specific maps into world 3.
Other than that it works well, good job. If you add some customization and streamer support it will be really useful!
Posts: 2
Threads: 0
Joined: Apr 2018
Reputation:
0
So good work, +rep Styajkin
Posts: 2
Threads: 0
Joined: Apr 2018
Reputation:
0
Nice, Styajkin-Sipotyajkin