Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): template map sizes from the template, pooled floods

Olcay Seyganf54e5c3a8f13
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ab5dd984..7dc3e1a61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ found and fixed — EA's own, not port damage.**
## A Random tab in the map list
- Select Map has a third tab beside Official and Unofficial. Pick a map type from the official maps (or Surprise me), a size from Tiny to Extra Large and the number of players, and a new map is made from them on the spot, in the skirmish, LAN and online rooms alike. The preview and its start positions are that map before you accept it, so there is no guessing what you will land on. New Map rolls another with the same choice, and so does every change you make. Extra Large still seats eight.
+- A map built from an official map takes its sizes from that map. Medium gives every player the ground one seat has on the original, so four players on a Twilight Flame map get 337 cells a side where they had 304, and eight get 477 where they had 416; Extra Large for eight is 708. Surprise me keeps the sizes it always had.
- The player count starts at the number of seats already taken in the room. The tab, the map type and the size you used last are remembered for the next time.
- In a LAN or online room the other players do not download anything: the map's name carries its recipe, and their own game builds the same map from it and checks it against yours. A room that records stats keeps to the official list.
- Random maps used to be reachable only by a hidden command-line switch that added five rows to the skirmish list.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/RandomMapGenerator.h b/GeneralsMD/Code/GameEngine/Include/Common/RandomMapGenerator.h
index 388926ebc..d3d1fe5f8 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/RandomMapGenerator.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/RandomMapGenerator.h
@@ -89,6 +89,14 @@ public:
duel map. */
static Int cellsFor( RandomMapSize size, Int numPlayers );
+ /** The same for a map built from a shipped one: Medium gives each player the ground a seat has
+ on the template, the other sizes a fixed share more or less of it. An empty or uninstalled
+ template falls back to the plain table. */
+ static Int cellsFor( RandomMapSize size, Int numPlayers, const AsciiString& templatePath );
+
+ /** That rule on a template's playable cells and seats, for the tests. */
+ static Int cellsForTemplate( RandomMapSize size, Int numPlayers, Int cellsX, Int cellsY, Int seats );
+
/** Settings clamped the way generate() clamps them, so callers can report the truth. A template
drops the style, and one that is not an installed shipped map is dropped itself. */
static void clampSettings( RandomMapSettings& settings );
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/RandomMapTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/RandomMapTemplate.h
index fc557bb27..b73299846 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/RandomMapTemplate.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/RandomMapTemplate.h
@@ -57,6 +57,10 @@ struct RMGTemplateReport
first read. FALSE when no such map is installed. */
extern Bool rmgTemplateCRC( const AsciiString& templatePath, UnsignedInt *crcOut );
+/** A shipped map's playable cells across and down and its number of seats, kept after the first read.
+ FALSE when no such map is installed or it is not a skirmish map the reader knows. */
+extern Bool rmgTemplateShape( const AsciiString& templatePath, Int *cellsX, Int *cellsY, Int *seats );
+
/** "maps\twilight flame\twilight flame.map" to "twilight flame" and back; only a shipped map's own
folder-and-file shape has a token, since the token is what the generated map's name carries. */
extern Bool rmgTemplateToken( const AsciiString& templatePath, AsciiString& tokenOut );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index b12c380dd..65f641006 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -470,7 +470,8 @@ Int parseMapName(char *args[], int num)
lists it like any hand-made map and -autoskirmish starts on it. The same seed gives the same
map on every machine, so both sides of a network game can be handed the same command line.
The size is either a cell count outright or one of the five sizes, which are counts
- that grow with the number of players rather than fixed ones. A style name last ("twilight")
+ that grow with the number of players rather than fixed ones; with a template they come from the
+ ground a seat has on it, and no size word means its Medium. A style name last ("twilight")
makes a map in that shipped map's style and adds "_<style>" to the name. */
//=============================================================================
Int parseRandomMap(char *args[], int num)
@@ -489,13 +490,14 @@ Int parseRandomMap(char *args[], int num)
if (num > eaten && isdigit((UnsignedByte)args[eaten][0]))
settings.m_numPlayers = atoi( args[eaten++] );
+ // a size word becomes cells once the template is known, since a template's sizes are its own
+ RandomMapSize size = RANDOM_MAP_SIZE_COUNT;
if (num > eaten && isdigit((UnsignedByte)args[eaten][0]))
{
settings.m_playableCells = atoi( args[eaten++] );
}
else if (num > eaten)
{
- RandomMapSize size = RANDOM_MAP_SIZE_COUNT;
if (strcasecmp( args[eaten], "tiny" ) == 0)
size = RANDOM_MAP_SIZE_TINY;
else if (strcasecmp( args[eaten], "small" ) == 0)
@@ -508,10 +510,7 @@ Int parseRandomMap(char *args[], int num)
size = RANDOM_MAP_SIZE_HUGE;
if (size != RANDOM_MAP_SIZE_COUNT)
- {
- settings.m_playableCells = RandomMapGenerator::cellsFor( size, settings.m_numPlayers );
eaten++;
- }
}
if (num > eaten && RandomMapGenerator::styleNamed( args[eaten] ) != 0)
@@ -533,7 +532,11 @@ Int parseRandomMap(char *args[], int num)
RandomMapGenerator::clampSettings( checked );
if (checked.m_template.isEmpty())
DEBUG_LOG(("-randommap: no shipped map '%s' installed, generating without a template\n", settings.m_template.str()));
+ else if (settings.m_playableCells <= 0 && size == RANDOM_MAP_SIZE_COUNT)
+ size = RANDOM_MAP_SIZE_NORMAL;
}
+ if (size != RANDOM_MAP_SIZE_COUNT)
+ settings.m_playableCells = RandomMapGenerator::cellsFor( size, settings.m_numPlayers, settings.m_template );
AsciiString path;
if (!stageRandomMap( settings, path ))
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapGenerator.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapGenerator.cpp
index 266aad705..173160382 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapGenerator.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapGenerator.cpp
@@ -47,6 +47,7 @@
#include "Common/MapObject.h"
#include "Common/MapReaderWriterInfo.h"
#include "GameLogic/FPUControl.h"
+#include "Common/JobSystem.h"
/** The sentinel WorldHeightMap::ParseBlendTileData asserts on after every blend entry. It is
FLAG_VAL in WorldHeightMap.h, which lives in GameEngineDevice and so cannot be included from
@@ -1060,6 +1061,9 @@ private:
Real outwardBearing( Real cellX, Real cellY ) const;
Bool findContestedSite( Int startA, Int startB, Real minWalk, Real clearance, RMGPoint *out ) const;
void floodDistancesFromCell( Int startX, Int startY, std::vector<Int>& dist ) const;
+ void floodDistancesFromCell( Int startX, Int startY, std::vector<Int>& dist, std::vector<Int>& queue ) const;
+ void floodFromEveryStart( std::vector< std::vector<Int> >& dist );
+ static void floodFromStartJob( Int start, void *context );
void walkFromStarts( std::vector< std::vector<Int> >& walk, std::vector<Int>& owner,
std::vector<Int>& lead );
Bool findSiteByWalk( const std::vector< std::vector<Int> >& walk, const std::vector<Int>& owner,
@@ -1087,6 +1091,7 @@ private:
std::map<Int, Short> m_blendLookup; ///< tile and shape to the table entry that holds them
std::vector<RMGSite> m_sites; ///< everything placed so far, with its elbow room
std::vector<char> m_routeLock; ///< cells on a walk to somebody's money, which pads leave alone
+ std::vector< std::vector<Int> > m_floodQueues; ///< a breadth-first queue a start, kept between floods
std::vector<char> m_baseLevelled; ///< cells a base blend has touched
std::vector<UnsignedByte> m_baseUnder; ///< and the ground it blended there
std::vector<UnsignedByte> m_baseResult; ///< and what it left, so a second levelling can tell
@@ -5420,6 +5425,14 @@ Bool RMGLayout::findSiteOnCompass( Real centreX, Real centreY, Real targetRadius
}
void RMGLayout::floodDistancesFromCell( Int startX, Int startY, std::vector<Int>& dist ) const
+{
+ std::vector<Int> queue( m_width * m_height );
+ floodDistancesFromCell( startX, startY, dist, queue );
+}
+
+/** The same with the queue in hand, a cell per map cell, so a pool job that floods allocates nothing
+ once dist is that size too. */
+void RMGLayout::floodDistancesFromCell( Int startX, Int startY, std::vector<Int>& dist, std::vector<Int>& queue ) const
{
Int width = m_width;
dist.assign( width * m_height, -1 );
@@ -5429,15 +5442,14 @@ void RMGLayout::floodDistancesFromCell( Int startX, Int startY, std::vector<Int>
if( !passableAtCell( startX, startY ) )
return;
- std::vector<Int> queue;
dist[startY * width + startX] = 0;
- queue.push_back( startY * width + startX );
+ queue[0] = startY * width + startX;
+ Int tail = 1;
static const Int offsetX[4] = { 1, -1, 0, 0 };
static const Int offsetY[4] = { 0, 0, 1, -1 };
- UnsignedInt head = 0;
- while( head < queue.size() )
+ for( Int head = 0; head < tail; )
{
Int index = queue[head++];
Int x = index % width;
@@ -5456,11 +5468,43 @@ void RMGLayout::floodDistancesFromCell( Int startX, Int startY, std::vector<Int>
continue;
dist[next] = here + 1;
- queue.push_back( next );
+ queue[tail++] = next;
}
}
}
+struct RMGStartFloods
+{
+ const RMGLayout *layout;
+ std::vector< std::vector<Int> > *dist;
+ std::vector< std::vector<Int> > *queues;
+};
+
+void RMGLayout::floodFromStartJob( Int start, void *context )
+{
+ RMGStartFloods *floods = (RMGStartFloods *)context;
+ const RMGLayout *layout = floods->layout;
+ Int x = (Int)(layout->m_starts[start].m_cellX + 0.5f) + RMG_BORDER_CELLS;
+ Int y = (Int)(layout->m_starts[start].m_cellY + 0.5f) + RMG_BORDER_CELLS;
+ layout->floodDistancesFromCell( x, y, (*floods->dist)[start], (*floods->queues)[start] );
+}
+
+/** A flood from every start, on the pool: each writes only its own start's arrays, sized here first. */
+void RMGLayout::floodFromEveryStart( std::vector< std::vector<Int> >& dist )
+{
+ const Int players = (Int)m_starts.size();
+ const Int cells = m_width * m_height;
+ dist.resize( players );
+ m_floodQueues.resize( players );
+ for( Int i = 0; i < players; i++ )
+ {
+ dist[i].resize( cells );
+ m_floodQueues[i].resize( cells );
+ }
+ RMGStartFloods floods = { this, &dist, &m_floodQueues };
+ JobSystem::parallel_for( players, 1, floodFromStartJob, &floods );
+}
+
/** The dock worth fighting over: a cell both players can walk to, as even a walk
from each as the ground allows. Euclidean midpoints miss a cliff between the
two starts; the two floods do not. */
@@ -5535,13 +5579,7 @@ void RMGLayout::walkFromStarts( std::vector< std::vector<Int> >& walk, std::vect
buildPassability();
Int players = (Int)m_starts.size();
- walk.resize( players );
- for( Int i = 0; i < players; i++ )
- {
- Int x = (Int)(m_starts[i].m_cellX + 0.5f) + RMG_BORDER_CELLS;
- Int y = (Int)(m_starts[i].m_cellY + 0.5f) + RMG_BORDER_CELLS;
- floodDistancesFromCell( x, y, walk[i] );
- }
+ floodFromEveryStart( walk );
Int cells = m_width * m_height;
owner.assign( cells, -1 );
@@ -6632,12 +6670,13 @@ void RMGLayout::addApproachPaths( Int *waypointID )
/* The starts are playable-area cells and the flood runs on map cells, border included. These
paths used to flood from the start's playable cell read as a map cell, twenty cells short on
both axes, so every waypoint but the last stood on ground offset from the real route. */
- std::vector<Int> dist;
+ std::vector< std::vector<Int> > floods;
+ floodFromEveryStart( floods );
for( UnsignedInt target = 0; target < m_starts.size(); target++ )
{
const Int targetX = (Int)(m_starts[target].m_cellX + 0.5f) + RMG_BORDER_CELLS;
const Int targetY = (Int)(m_starts[target].m_cellY + 0.5f) + RMG_BORDER_CELLS;
- floodDistancesFromCell( targetX, targetY, dist );
+ const std::vector<Int>& dist = floods[target];
for( UnsignedInt from = 0; from < m_starts.size(); from++ )
{
@@ -7308,6 +7347,29 @@ Int RandomMapGenerator::cellsFor( RandomMapSize size, Int numPlayers )
return cells;
}
+Int RandomMapGenerator::cellsForTemplate( RandomMapSize size, Int numPlayers, Int cellsX, Int cellsY, Int seats )
+{
+ // area against Medium, in percent: Extra Large for eight on Twilight Flame is 708 across
+ static const Int AREA_PERCENT[RANDOM_MAP_SIZE_COUNT] = { 45, 70, 100, 140, 220 };
+ const Int PERCENT = 100;
+
+ if( numPlayers < MIN_PLAYERS ) numPlayers = MIN_PLAYERS;
+ if( numPlayers > MAX_PLAYERS ) numPlayers = MAX_PLAYERS;
+ double area = (double)cellsX * cellsY * numPlayers * AREA_PERCENT[size] / ( (double)seats * PERCENT );
+ Int cells = (Int)sqrt( area );
+ if( cells < MIN_CELLS ) cells = MIN_CELLS;
+ if( cells > MAX_CELLS ) cells = MAX_CELLS;
+ return cells;
+}
+
+Int RandomMapGenerator::cellsFor( RandomMapSize size, Int numPlayers, const AsciiString& templatePath )
+{
+ Int cellsX, cellsY, seats;
+ if( templatePath.isEmpty() || !rmgTemplateShape( templatePath, &cellsX, &cellsY, &seats ) )
+ return cellsFor( size, numPlayers );
+ return cellsForTemplate( size, numPlayers, cellsX, cellsY, seats );
+}
+
void RandomMapGenerator::clampSettings( RandomMapSettings& settings )
{
if( settings.m_numPlayers < MIN_PLAYERS ) settings.m_numPlayers = MIN_PLAYERS;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
index a57b3936e..78e35f664 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
@@ -5112,6 +5112,20 @@ Int repairReach( std::vector<Int>& heights, Int W, Int H, const Plan& plan, cons
// The synthesis
//-----------------------------------------------------------------------------
+/** The exemplar, unpacked the way the map loader unpacks it. */
+static Bool unpackExemplar( const std::vector<char>& exemplarBytes, std::vector<char>& raw )
+{
+ if( !CompressionManager::isDataCompressed( &exemplarBytes[0], (Int)exemplarBytes.size() ) )
+ {
+ raw = exemplarBytes;
+ return TRUE;
+ }
+ Int size = CompressionManager::getUncompressedSize( &exemplarBytes[0], (Int)exemplarBytes.size() );
+ raw.resize( size );
+ std::vector<char> packed( exemplarBytes );
+ return CompressionManager::decompressData( &packed[0], (Int)packed.size(), &raw[0], size ) == size;
+}
+
Bool rmgSynthesise( const RandomMapSettings& clamped, const std::vector<char>& exemplarBytes,
RMGCivilianTest civilian, std::vector<char>& mapBytes, std::vector<char> *previewBytes,
RMGTemplateReport *report )
@@ -5120,21 +5134,12 @@ Bool rmgSynthesise( const RandomMapSettings& clamped, const std::vector<char>& e
UnsignedInt callersFPMode = getFPMode();
setFPMode();
- // the exemplar, unpacked the way the map loader unpacks it
std::vector<char> raw;
- if( CompressionManager::isDataCompressed( &exemplarBytes[0], (Int)exemplarBytes.size() ) )
+ if( !unpackExemplar( exemplarBytes, raw ) )
{
- Int size = CompressionManager::getUncompressedSize( &exemplarBytes[0], (Int)exemplarBytes.size() );
- raw.resize( size );
- std::vector<char> packed( exemplarBytes );
- if( CompressionManager::decompressData( &packed[0], (Int)packed.size(), &raw[0], size ) != size )
- {
- restoreFPMode( callersFPMode );
- return FALSE;
- }
+ restoreFPMode( callersFPMode );
+ return FALSE;
}
- else
- raw = exemplarBytes;
// the template is a file off the disk or a mod: bytes that end early refuse it rather than read past it
Exemplar src;
@@ -5822,6 +5827,42 @@ Bool rmgTemplateCRC( const AsciiString& templatePath, UnsignedInt *crcOut )
return TRUE;
}
+struct TemplateShape { Int cellsX, cellsY, seats; };
+
+Bool rmgTemplateShape( const AsciiString& templatePath, Int *cellsX, Int *cellsY, Int *seats )
+{
+ // the size buttons ask on every click; a map that would not load is kept as no seats
+ static std::map<AsciiString, TemplateShape> theShapes;
+ std::map<AsciiString, TemplateShape>::const_iterator it = theShapes.find( templatePath );
+ if( it == theShapes.end() )
+ {
+ TemplateShape shape = { 0, 0, 0 };
+ std::vector<char> bytes, raw;
+ if( TheFileSystem == NULL || !readTemplate( templatePath, bytes ) )
+ return FALSE;
+ SynthMap map;
+ try
+ {
+ if( unpackExemplar( bytes, raw ) && map.load( raw ) )
+ {
+ shape.cellsX = map.playX;
+ shape.cellsY = map.playY;
+ shape.seats = (Int)map.starts.size();
+ }
+ }
+ catch( const ShortMap& fault )
+ {
+ DEBUG_LOG(( "random map: the template '%s' ends at byte %d of a chunk, %d wanted at %d\n",
+ templatePath.str(), fault.size, fault.count, fault.pos ));
+ }
+ it = theShapes.insert( std::make_pair( templatePath, shape ) ).first;
+ }
+ *cellsX = it->second.cellsX;
+ *cellsY = it->second.cellsY;
+ *seats = it->second.seats;
+ return it->second.seats > 0;
+}
+
Bool rmgTemplateToken( const AsciiString& templatePath, AsciiString& tokenOut )
{
AsciiString lower = templatePath;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
index c3302a9bd..20a628604 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
@@ -1177,7 +1177,7 @@ static void stageRandomTabMap(void)
RandomMapSettings settings;
settings.m_seed = (Int)((Clock_Milliseconds() + 7919u * ++theRolls) & 0x7fffffff);
settings.m_numPlayers = theRandomPlayers;
- settings.m_playableCells = RandomMapGenerator::cellsFor((RandomMapSize)theRandomSize, theRandomPlayers);
+ settings.m_playableCells = RandomMapGenerator::cellsFor((RandomMapSize)theRandomSize, theRandomPlayers, theRandomTemplate);
settings.m_template = theRandomTemplate;
stageRandomMap(settings, theStagedMap);
theStagedMap.toLower();
@@ -1198,7 +1198,7 @@ static void showRandomTab(Bool open)
// reopening the picker shows the map it made last time, unless the room changed under it
const Bool sameChoice = !theStagedMap.isEmpty()
&& theStagedSettings.m_numPlayers == theRandomPlayers
- && theStagedSettings.m_playableCells == RandomMapGenerator::cellsFor((RandomMapSize)theRandomSize, theRandomPlayers)
+ && theStagedSettings.m_playableCells == RandomMapGenerator::cellsFor((RandomMapSize)theRandomSize, theRandomPlayers, theRandomTemplate)
&& theStagedSettings.m_template == theRandomTemplate;
if (sameChoice)
showStagedMap();
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 9fe3457e9..7cc8b4828 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -10745,6 +10745,24 @@ TEST(map_size_is_chosen_and_then_grows_with_the_players)
CHECK_EQ( theRMGParse.m_boundaryX, settings.m_playableCells );
}
+TEST(a_template_map_gives_each_player_the_ground_a_seat_has_on_the_template)
+{
+ // Twilight Flame: 486 by 469 playable, eight seats
+ const Int TEMPLATE_X = 486, TEMPLATE_Y = 469, TEMPLATE_SEATS = 8;
+
+ CHECK_EQ( RandomMapGenerator::cellsForTemplate( RANDOM_MAP_SIZE_NORMAL, 8, TEMPLATE_X, TEMPLATE_Y, TEMPLATE_SEATS ), 477 );
+ CHECK_EQ( RandomMapGenerator::cellsForTemplate( RANDOM_MAP_SIZE_NORMAL, 4, TEMPLATE_X, TEMPLATE_Y, TEMPLATE_SEATS ), 337 );
+ CHECK_EQ( RandomMapGenerator::cellsForTemplate( RANDOM_MAP_SIZE_HUGE, 8, TEMPLATE_X, TEMPLATE_Y, TEMPLATE_SEATS ), 708 );
+ for( Int size = 0; size + 1 < RANDOM_MAP_SIZE_COUNT; size++ )
+ for( Int players = RandomMapGenerator::MIN_PLAYERS; players <= RandomMapGenerator::MAX_PLAYERS; players++ )
+ CHECK( RandomMapGenerator::cellsForTemplate( (RandomMapSize)size, players, TEMPLATE_X, TEMPLATE_Y, TEMPLATE_SEATS ) <
+ RandomMapGenerator::cellsForTemplate( (RandomMapSize)( size + 1 ), players, TEMPLATE_X, TEMPLATE_Y, TEMPLATE_SEATS ) );
+
+ // no template, or one this machine does not have, is the plain table
+ CHECK_EQ( RandomMapGenerator::cellsFor( RANDOM_MAP_SIZE_LARGE, 6, AsciiString::TheEmptyString ),
+ RandomMapGenerator::cellsFor( RANDOM_MAP_SIZE_LARGE, 6 ) );
+}
+
//-------------------------------------------------------------------------------------------------
/** A generated map is not playable if a start cannot walk to the money, or has only one way out
of its own base. The flood here is the pathfinder's own: four neighbours, a cliff when the
@@ -11461,8 +11479,12 @@ TEST(a_template_map_comes_out_the_same_twice_and_every_start_walks_to_every_othe
std::vector<char> first, second, preview;
RMGTemplateReport report;
+ // once inline and once on a pool: the floods the generator forks must not change a byte
+ const Int POOL_WORKERS = 4;
CHECK( rmgSynthesise( settings, exemplar, NULL, first, &preview, &report ) );
+ JobSystem::init( POOL_WORKERS );
CHECK( rmgSynthesise( settings, exemplar, NULL, second, NULL, NULL ) );
+ JobSystem::shutdown();
CHECK( !first.empty() && first == second );
CHECK( first.size() > 4 && memcmp( &first[0], "CkMp", 4 ) == 0 );
CHECK_EQ( report.m_cutOffStarts, 0 );
@@ -11545,6 +11567,8 @@ TEST(write_the_maps_RMG_TEMPLATE_DUMP_names)
std::vector<char> exemplar;
CHECK( readWholeFile( source, exemplar ) );
const char *next = dump + read;
+ // the pool the game starts, so the time is the one a player waits
+ JobSystem::init();
RandomMapSettings settings;
while( sscanf( next, " %d,%d,%d%n", &settings.m_seed, &settings.m_numPlayers, &settings.m_playableCells, &read ) == 3 )
{
@@ -11581,6 +11605,7 @@ TEST(write_the_maps_RMG_TEMPLATE_DUMP_names)
report.m_roads, report.m_trees, report.m_scenery, report.m_cutOffStarts, report.m_cutOffSites, report.m_cutOffTech,
report.m_notes.str() );
}
+ JobSystem::shutdown();
}
//-------------------------------------------------------------------------------------------------