Version 1.2 of the Transport Tycoon Saved Game Manager introduced the ability to create and use plug-ins to extend the Manager's functionality. This document describes how to write plug-ins for the Saved Game Manager.
If a function is marked with Version 1.2+, it should work with any version of the Saved Game Manager. However, if it's marked with Version 2.0+, it will only work with version 2.0 or higher and will be incompatible with version 1.2. In this case, you should set ExpectedVersion to 2.0. The same goes with functions marked as Version 2.1+ - they will only work with version 2.1 of the Manager.
You can write plug-ins for the Transport Tycoon Saved Game Manager quite easily. (Well, it depends on the language really). The plug-ins supplied with the Manager were written in Visual Basic, which is the preferred language for writing SGM plug-ins in. I had a shot at creating a plug-in in Delphi, but failed, because I don't really know Delphi or Pascal. I did manage to create one with Visual C++ 7.0 (from Visual Studio.NET beta 2). It took me a few hours to get it right (I had never before created a COM object in C++). See the \ManagerDir\TESTCPP directory for the source code.
Plug-ins are OLE/COM objects. The Saved Game Manager reads PLUGINS.INI to retrieve a list of object names, such as SGMTestExt. It then tries to create an instance of the SGMExtension object in this library.
The SGMExtension class has a number of functions and properties that are used by the Manager. These are:
If ExpectedVersion is set to 2.0, then the following also has to be exported:
The Manager exports a number of functions and properties. The class is TTManager.ExtFunctions. In version 2.0 of the Manager, a number of new functions have been added for dealing with games.
Please note that to create an instance of the ExtFunctions class in Visual Basic, you MUST use the following code. The way I used to do it (Dim EF As New TTManager.ExtFunctions) does not work properly.
Dim EF As Object Set EF = CreateObject("TTManager.ExtFunctions")