missing map editor implementation
This commit is contained in:
1 parent
28a7acc6ac
commit
89ef44503a
2 files changed
+34
No files matched your search
@@ -257,6 +257,10 @@ void completeJob(int p, int loc, int job);
|
||||
|
||||
// --- Map Editor ---
|
||||
|
||||
// Allocates the supervisor's (player 0) map-editor-only Map/MapObservedLast/
|
||||
// Territory buffers for standalone map editing (no other player, no
|
||||
// initGame()). Must be paired with releaseMapEditor().
|
||||
void initMapEditor();
|
||||
// Converts a tile to ocean if it has no grass-or-better neighbor, to shore
|
||||
// otherwise; returns true if the terrain type actually changed.
|
||||
bool checkShore(int loc);
|
||||
|
||||
@@ -30,9 +30,39 @@
|
||||
|
||||
#include "Cevo/Database.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace Cevo {
|
||||
namespace Database {
|
||||
|
||||
void initMapEditor()
|
||||
{
|
||||
calculatePrimitive();
|
||||
occupant.fill(-1);
|
||||
observeLevel.fill(0);
|
||||
TPlayerContext &player = rw[0];
|
||||
resourceMask[0] = 0xFFFFFFFFu;
|
||||
player.Map = reinterpret_cast<TTileList *>(new std::uint32_t[static_cast<std::size_t>(mapSize)]());
|
||||
player.MapObservedLast = reinterpret_cast<TTileObservedLastList *>(new std::int16_t[static_cast<std::size_t>(mapSize)]);
|
||||
std::memset(*player.MapObservedLast, 0xFF, static_cast<std::size_t>(mapSize) * 2);
|
||||
player.Territory = reinterpret_cast<TOwnerList *>(new std::int8_t[static_cast<std::size_t>(mapSize)]);
|
||||
std::memset(*player.Territory, 0xFF, static_cast<std::size_t>(mapSize));
|
||||
player.Un = nullptr;
|
||||
player.Model = nullptr;
|
||||
player.City = nullptr;
|
||||
player.EnemyUn = nullptr;
|
||||
player.EnemyCity = nullptr;
|
||||
player.EnemyModel = nullptr;
|
||||
for (int p1 = 0; p1 < nPl; ++p1)
|
||||
player.EnemyReport[p1] = nullptr;
|
||||
player.nUn = 0;
|
||||
player.nModel = 0;
|
||||
player.nCity = 0;
|
||||
player.nEnemyUn = 0;
|
||||
player.nEnemyCity = 0;
|
||||
player.nEnemyModel = 0;
|
||||
}
|
||||
|
||||
bool checkShore(int loc)
|
||||
{
|
||||
const std::uint32_t oldTile = realMap[loc];
|
||||
|
||||
Reference in new issue
Block a user