And this is the first C++ generator!
Hello, gas bags! Somehow, it seems fitting that they're the first... they did, after all, mess up the code/settings on the probes to wreak havoc! Hopefully I haven't! :-) I think I can simplify things a lot from here...
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "planets/planets.h"
|
#include "planets/planets.h"
|
||||||
#include "planets/elemdata.h"
|
#include "planets/elemdata.h"
|
||||||
|
|
||||||
|
extern struct GeneratorBase slyDef;
|
||||||
|
|
||||||
// This array has to be sorted in Y coordinate order then X coordinate order.
|
// This array has to be sorted in Y coordinate order then X coordinate order.
|
||||||
// Items out of order can cause crashes (better, actually) or "ghost"
|
// Items out of order can cause crashes (better, actually) or "ghost"
|
||||||
@@ -538,7 +539,7 @@ STAR_DESC starmap_array[] =
|
|||||||
{{1937, 9979}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 1, 103},
|
{{1937, 9979}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 1, 103},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{{1004, 1083}, MAKE_STAR (DWARF_STAR, GREEN_BODY, -1), SLYLANDRO_DEFINED, 2, 27},
|
{{1004, 1083}, MAKE_STAR (DWARF_STAR, GREEN_BODY, -1), CXX_DEFINED, 2, 27, &slyDef},
|
||||||
{{1776, 1395}, MAKE_STAR (DWARF_STAR, YELLOW_BODY, -1), START_COLONY_DEFINED, 0, 98},
|
{{1776, 1395}, MAKE_STAR (DWARF_STAR, YELLOW_BODY, -1), START_COLONY_DEFINED, 0, 98},
|
||||||
|
|
||||||
{{1777, 1405}, MAKE_STAR (DWARF_STAR, YELLOW_BODY, -1), 0, 0, 99},
|
{{1777, 1405}, MAKE_STAR (DWARF_STAR, YELLOW_BODY, -1), 0, 0, 99},
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ struct GenerateFunctions;
|
|||||||
|
|
||||||
typedef struct GenerateFunctions GenerateFunctions;
|
typedef struct GenerateFunctions GenerateFunctions;
|
||||||
|
|
||||||
|
struct GeneratorBase {};
|
||||||
|
|
||||||
|
typedef struct GeneratorBase GeneratorBase;
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -126,6 +130,7 @@ namespace Planets ::detail:: Generate_m
|
|||||||
}
|
}
|
||||||
|
|
||||||
class exports::Generator
|
class exports::Generator
|
||||||
|
: public GeneratorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Generator()= 0;
|
virtual ~Generator()= 0;
|
||||||
@@ -159,7 +164,7 @@ namespace Planets ::detail:: Generate_m
|
|||||||
};
|
};
|
||||||
|
|
||||||
class exports::DefaultGenerator
|
class exports::DefaultGenerator
|
||||||
: virtual public Generator
|
: public Generator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~DefaultGenerator() override;
|
~DefaultGenerator() override;
|
||||||
|
|||||||
@@ -21,17 +21,21 @@
|
|||||||
#include "../planets.h"
|
#include "../planets.h"
|
||||||
#include "../../comm.h"
|
#include "../../comm.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using namespace Planets::exports;
|
using namespace Planets::exports;
|
||||||
|
|
||||||
class GenerateSlylandro
|
class GenerateSlylandro
|
||||||
: public virtual DefaultGenerator
|
: public DefaultGenerator
|
||||||
{
|
{
|
||||||
bool
|
bool
|
||||||
generatePlanets( SolarSystem *const solarSys ) override
|
generatePlanets( SolarSystem *const solarSys ) override
|
||||||
{
|
{
|
||||||
|
std::cerr << "The C++ generator for slylandro planets was called!" << std::endl;
|
||||||
|
|
||||||
DefaultGenerator::generatePlanets( solarSys );
|
DefaultGenerator::generatePlanets( solarSys );
|
||||||
|
|
||||||
solarSys->PlanetDesc[ 3 ].data_index = RED_GAS_GIANT;
|
solarSys->PlanetDesc[ 3 ].data_index = RED_GAS_GIANT;
|
||||||
@@ -43,6 +47,8 @@ namespace
|
|||||||
bool
|
bool
|
||||||
generateOrbital( SolarSystem *const solarSys, PLANET_DESC *const world )
|
generateOrbital( SolarSystem *const solarSys, PLANET_DESC *const world )
|
||||||
{
|
{
|
||||||
|
std::cerr << "The C++ generator for slylandro orbital was called!" << std::endl;
|
||||||
|
|
||||||
if( matchWorld( solarSys, world, 3, MATCH_PLANET ) )
|
if( matchWorld( solarSys, world, 3, MATCH_PLANET ) )
|
||||||
{
|
{
|
||||||
InitCommunication( SLYLANDRO_HOME_CONVERSATION );
|
InitCommunication( SLYLANDRO_HOME_CONVERSATION );
|
||||||
@@ -54,7 +60,7 @@ namespace
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void *getSlyDef()
|
extern "C"
|
||||||
{
|
{
|
||||||
return static_cast< Generator * >( new GenerateSlylandro{} );
|
GenerateSlylandro slyDef;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user