I am going to attach the Main.cpp file and the BaseData header file so that everyone can see what I am doing and where improvements can be made or removed.
I love it when people are looking to improve.
Ok, BaseData can have a lot of redundancy removed. All your data sets
beaconSetX,
buildingSetX,
tubeSetX,
unitSetX, are the same for every X. You don't need to duplicate them, just reference the same data set each time. The data is read-only anyway. Similarly, the array
base[] references separate copies of the same data for each element. You don't need to duplicate the entries of this array, or even use an array. The only real differences exist in the array
startLocation[], which can reference the same read-only data for each entry.
struct BaseInfo base = { autosize(beaconSet), autosize(buildingSet), autosize(tubeSet), 0, 0, autosize(unitSet) };
struct StartLocation startLocation[] =
{
{ 119, 27, &base },
{ 131, 215, &base },
{ 331, 30, &base },
{ 348, 210, &base },
{ 484, 29, &base },
{ 500, 210, &base }
};
Notice
base is no longer an array, and all elements of the
startLocation array reference the same
base struct.
The design was intentional to make it easy to duplicate a base layout, which of course helps keep things even and fair.
In Main.cpp, consider using const/enum values to make code more self documenting. Contrast the following two lines:
TethysGame::CreateBeacon(mapMiningBeacon, 140, 194, 0, 2, 2);
TethysGame::CreateBeacon(mapMiningBeacon, 140, 194, OreTypeCommon, Bar1, Variant3);
The enums are declared in NonExportedEnums.h (kind of a bad name, I know) in the Outpost2Dll project.
Avoid extra code blocks without a clear reason. The enclosing braces below don't really need to be there. Block comments are usually placed above the section of code they apply to.
{
Trigger trig; // Create a trigger variable. If you don't know what that means, don't worry about it.
trig = CreateOnePlayerLeftTrigger(1, 0, "NoResponseToTrigger"); // NoResponseToTrigger is a generic catch-all function that does nothing when invoked
CreateVictoryCondition(1, 0, trig, "Eliminate your opponents."); // Use that trigger to create a victory condition
}
// You win when there is only one human opponent left or all surviving human players are allied.
// This also creates corresponding failure conditions
Prefer this instead:
// You win when there is only one human opponent left or all surviving human players are allied.
// This also creates corresponding failure conditions
Trigger trig; // Create a trigger variable. If you don't know what that means, don't worry about it.
trig = CreateOnePlayerLeftTrigger(1, 0, "NoResponseToTrigger"); // NoResponseToTrigger is a generic catch-all function that does nothing when invoked
CreateVictoryCondition(1, 0, trig, "Eliminate your opponents."); // Use that trigger to create a victory condition
There may be some more simplifications possible if you're looking for more.