#ifndef BASEDATA_H
#define BASEDATA_H
#include <OP2Helper.h>
#include <BaseBuilder.h>
#define numof(array) (sizeof(array)/sizeof(array[0]))
#define autosize(array) numof(array), array
struct BeaconInfo beaconSet1[] =
{ { 10, 17, mapMiningBeacon, 1, 0, -1},
{ 5, 17, mapMiningBeacon, 1, 0, -1},
{ -5, 17, mapMiningBeacon, 0, 0, -1},
{ 0, 17, mapMiningBeacon, 0, 0, -1},
{ 15, 17, mapFumarole, -1, -1, -1},
{ 20, 17, mapFumarole, -1, -1, -1},
};
struct VehicleInfo unitSet1[] =
{
{ 14, 14, mapConVec, mapCommandCenter, 2},
{ 13, 14, mapConVec, mapStructureFactory, 2},
{ 14, 13, mapConVec, mapTokamak, 2},
{ 12, 14, mapConVec, mapStandardLab, 2},
{ 12, 13, mapConVec, mapAgridome, 2},
{ 13, 13, mapConVec, mapCommonOreSmelter, 2},
{ 9, 9, mapCargoTruck, mapNone, 2},
{ 10, 9, mapCargoTruck, mapNone, 2},
{ 9, 10, mapCargoTruck, mapNone, 2},
{ 10, 10, mapCargoTruck, mapNone, 2},
{ 10, 13, mapRoboSurveyor, mapNone, 2},
{ 11, 14, mapRoboMiner, mapNone, 2},
{ 11, 13, mapEarthworker, mapNone, 2},
{ 10, 14, mapRoboDozer, mapNone, 2},
{ 15, 10, mapLynx, mapMicrowave, 2},
{ 16, 10, mapLynx, mapMicrowave, 2},
{ 15, 9, mapLynx, mapMicrowave, 2},
{ 16, 9, mapLynx, mapMicrowave, 2},
};
struct VehicleInfo unitSet2[] =
{
{ 19, 19, mapConVec, mapCommandCenter, 2},
};
struct BaseInfo base[] =
{
{ autosize(beaconSet1), 0, 0, 0,0, 0, 0, autosize(unitSet1) },
{ autosize(beaconSet1), 0, 0, 0,0, 0, 0, autosize(unitSet2) },
};
struct StartLocation startLocation[] =
{
{ 49, 14, &base[0]},
{ 29, 14, &base[0]},
};
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Outpost2DLL.h>
#include <OP2Helper.h>
#include <BaseBuilder.h>
#include "BaseData.h"
char MapName[] = "cow.map";
char LevelDesc[] = "easy colony plymouth. or Sandbox game";
char TechtreeName[] = "multitek.TXT";
SDescBlock DescBlock = { Colony, 2, 12, 0 };
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hinstDLL);
}
return TRUE;
}
int InitProc()
{
int i;
RandomizeStartingLocations(autosize(startLocation));
Player[0].GoPlymouth();
Player[1].GoEden();
for (i = 0; i < TethysGame::NoPlayers(); i++)
{
InitPlayerResources(i);
StartLocation &sLoc = startLocation[i];
CreateBase(i, sLoc.x, sLoc.y, *sLoc.baseInfo);
Player[i].CenterViewOn(sLoc.x, sLoc.y);
}
// Misc initialization
TethysGame::CreateWreck(20, 20, (map_id)11999, 0);
TethysGame::ForceMoraleGood(-1);
if (TethysGame::UsesMorale())
TethysGame::FreeMoraleLevel(-1);
TethysGame::SetDaylightEverywhere(TethysGame::UsesDayNight() == 0);
TethysGame::SetDaylightMoves(-1);
GameMap::SetInitialLightLevel(-62);
Trigger population = CreateResourceTrigger(1, 1, resColonists, 400, 0, cmpGreaterEqual, "NoResponseToTrigger");
CreateVictoryCondition(1, 0, population, "Have 400 Colonists.");
return 1; // return 1 if OK; 0 on failure
void AIProc()
{
}
void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
{
bufDesc.bufferStart = 0;
bufDesc.length = 0;
}
int StatusProc()
{
return 0; // must return 0
}
SCRIPT_API void NoResponseToTrigger()
{
}
struct StartLocation startLocation[] =
{
{ 49, 14, &base[0]},
{ 29, 14, &base[0]},
};
Lol, easy to spot error.
You've built two base layouts, but only ever used one. That, and the only difference between the two, was the units.
RandomizeStartingLocations(autosize(startLocation));
struct StartLocation startLocation[] =
{
{ 49, 14, &base[1]},
{ 29, 14, &base[0]},
};