KingHual/SA-MP-Plus — pull request #15 by v01d- (2014-08-02 21:56:33+00:00)
Title: Reorder / Linux / Checkpoints / Injection / Fixes

***For more details, check the commit details and file differences.***

## Injection

I've updated the project settings so the client output has .asi extension instead of .dll, the idea is to let an [ASI loader](http://www.gtagarage.com/mods/show.php?id=8321) automatically inject the binary into the game, instead of using a dirty hardcoded "Loader.exe" or messing with the server browser. I've tested it and it injects without problems, this same method is used by the Audio Plugin IIRC. The ASI loader can be easily distributed when an installer is added to the project.

## Linux

I added *CMakeLists.txt* files for easier compilation under Linux. I've also fixed some bugs that prevented the plugin from building/loading.

For generating a linux build, use the following commands in the project's main directory:
```sh
cd Build
mkdir Temp
cd Temp
cmake ../..
make
```

The same information has been added to README.md

## Reorder

I made several changes to the project's file layout to keep everything organized and clean:
* All include files are now located in the *Include* folder.
* *sampp.inc* is now located in *Build*.
* Output files are now located in *Build/Release* or *Build/Debug* depending on your build settings.
* Temporary files generated during the compilation process are now stored in *Build/Temp* instead of 3-4 different folders, they have also been excluded from source control as we don't need them AT ALL in the repository.
* Visual Studio's cache and other irrelevant files are excluded from source control to reduce the size of the repo (we don't need that huge .sdf file, for example).

## Fixes

Several bugs and incomplete features have been fixed:
* Removed redundant ternary operator @ ToggleInfiniteRun:CLocalPlayer.cpp
* Completed unfinished "GetLoadedModules" function and added an overload
* Fixed crashes and unexpected behaviour caused by making assumptions in GetApplicationPath (Windows/Linux)
* Fixed crashes under OnPlayerDisconnect when trying to handle players that don't use the SAMP+ client addon. Lack of status checking in GetPlayerFromPlayerid:Network.cpp was causing the server to add an invalid entry to Network::players containing a NULL pointer when the function was executed for an unconnected player. This NULL pointer would later cause a segmentation fault.
* Fixed inappropiate release of memory that should be handled by the PAWN VM, not the plugin. This was causing crashes under Linux, but not under Windows. (strange)

## Checkpoints

I've rewritten the checkpoint colour functions that were marked as "unstable", SetPlayerCheckpointColour and SetPlayerRaceCheckpointColour seem to work properly now. I've also added SetPlayerRaceCheckpointEx and SetPlayerCheckpointEx (unstable).

![sa-mp-028](https://cloud.githubusercontent.com/assets/7421701/3789098/b033de2a-1a8b-11e4-9f6f-24950d4ce733.png)

## Custom browser

Is it needed at all? With these changes you shouldn't need an external injector anymore.