From 822e1c3004ffdc235f625707dbf71d8a3bf67dc6 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 25 Apr 2024 01:49:16 -0400 Subject: [PATCH] Sly is ready to be C++'ed. But it's still not C++'ed yet. I put it over in ilwrath space, just to easily get to it (and it has enough planets to make the right one a gas giant). --- sc2/src/uqm/plandata.c | 1 + sc2/src/uqm/planets/generate/Makeinfo | 2 +- .../uqm/planets/generate/gensly-modern.cpp | 60 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 sc2/src/uqm/planets/generate/gensly-modern.cpp diff --git a/sc2/src/uqm/plandata.c b/sc2/src/uqm/plandata.c index 5f42f0440..3a0211f56 100644 --- a/sc2/src/uqm/plandata.c +++ b/sc2/src/uqm/plandata.c @@ -538,6 +538,7 @@ STAR_DESC starmap_array[] = {{1937, 9979}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 1, 103}, #endif + {{1004, 1083}, MAKE_STAR (DWARF_STAR, GREEN_BODY, -1), SLYLANDRO_DEFINED, 2, 27}, {{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}, diff --git a/sc2/src/uqm/planets/generate/Makeinfo b/sc2/src/uqm/planets/generate/Makeinfo index bfa16f35e..777b61e94 100644 --- a/sc2/src/uqm/planets/generate/Makeinfo +++ b/sc2/src/uqm/planets/generate/Makeinfo @@ -4,4 +4,4 @@ uqm_CFILES="gendefault.c genand.c genburv.c genchmmr.c gencol.c gendru.c genthrad.c gentrap.c genutw.c genvault.c genvux.c genwreck.c genyeh.c genzfpscout.c genzoq.c" uqm_HFILES="genall.h gendefault.h" -uqm_CXXFILES="cxx-generator.cpp" +uqm_CXXFILES="cxx-generator.cpp gensly-modern.cpp" diff --git a/sc2/src/uqm/planets/generate/gensly-modern.cpp b/sc2/src/uqm/planets/generate/gensly-modern.cpp new file mode 100644 index 000000000..4bac8ecc6 --- /dev/null +++ b/sc2/src/uqm/planets/generate/gensly-modern.cpp @@ -0,0 +1,60 @@ +//Copyright Paul Reiche, Fred Ford. 1992-2002 +// Adapted by ADAM David Alan Martin 2024 + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "genall.h" +#include "../planets.h" +#include "../../comm.h" + + +namespace +{ + using namespace Planets::exports; + + class GenerateSlylandro + : public virtual DefaultGenerator + { + bool + generatePlanets( SolarSystem *const solarSys ) override + { + DefaultGenerator::generatePlanets( solarSys ); + + solarSys->PlanetDesc[ 3 ].data_index = RED_GAS_GIANT; + solarSys->PlanetDesc[ 3 ].NumPlanets = 1; + + return true; + } + + bool + generateOrbital( SolarSystem *const solarSys, PLANET_DESC *const world ) + { + if( matchWorld( solarSys, world, 3, MATCH_PLANET ) ) + { + InitCommunication( SLYLANDRO_HOME_CONVERSATION ); + return true; + } + + return DefaultGenerator::generateOrbital( solarSys, world ); + } + }; +} + +extern "C" void *getSlyDef() +{ + return static_cast< Generator * >( new GenerateSlylandro{} ); +}