add back and splitted database

This commit is contained in:
Geoffray Levasseur committed 2026-10-28 17:59:02 +01:00
1 parent a7e65be715
commit 55ccee5b57
16 files changed
+3215 -2534

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
// This file is part of cevo-evo.
//
// This software is governed by the CeCILL license under French law and
// abiding by the rules of distribution of free software. You can use,
// modify and/or redistribute the software under the terms of the CeCILL
// license as circulated by CEA, CNRS and INRIA at the following URL
// "http://www.cecill.info".
//
// As a counterpart to the access to the source code and rights to copy,
// modify and redistribute granted by the license, users are provided only
// with a limited warranty and the software's author, the holder of the
// economic rights, and the successive licensors have only limited
// liability.
//
// In this respect, the user's attention is drawn to the risks associated
// with loading, using, modifying and/or developing or reproducing the
// software by the user in light of its specific status of free software,
// that may mean that it is complicated to manipulate, and that also
// therefore means that it is reserved for developers and experienced
// professionals having in-depth computer knowledge. Users are therefore
// encouraged to load and test the software's suitability as regards their
// requirements in conditions enabling the security of their systems and/or
// data to be ensured and, more generally, to use and operate it in the
// same conditions as regards security.
//
// The fact that you are presently reading this means that you have had
// knowledge of the CeCILL license and that you accept its terms.
#pragma once
// Database.pas's own implementation-section-private (`unit`-local) globals
// and helpers, shared across the Database.<Section>.cpp translation units
// that Database.cpp is now split into. Not part of the public Cevo/Database.h
// API - include this only from Database*.cpp files in this library. Before
// the split these lived in a single anonymous namespace inside one .cpp
// (true C++ internal linkage, matching Pascal's interface/implementation
// visibility split); now that they're needed from several translation
// units, they're plain (externally linked) Database:: symbols instead -
// still private by convention, just no longer enforced by the compiler.
#include "Cevo/Database.h"
namespace Cevo {
namespace Database {
// Equivalent of Database.pas's private `UnBuilt: array[0..nPl-1] of Integer`
// (number of units built, used to assign unique per-player unit IDs).
// Defined in Database.cpp; used by Database.MapProcessing.cpp (createUnit)
// and Database.GameInitialization.cpp (initGame).
extern std::array<int, nPl> unBuilt;
// Equivalent of Database.pas's private `BorderChanges` (sIntExpandTerritory
// and $F == 8 packed Cardinal words, 4 bits per tile in the CountryRadius
// area around a city). Defined in Database.cpp; used by Database.cpp's own
// intServer() and by Database.TerritoryCalculation.cpp.
extern std::array<std::uint32_t, 8> borderChanges;
// Equivalent of Database.pas's private FreeSlaves(). Defined in
// Database.TechRelated.cpp; used there and by Database.City.cpp.
void freeSlaves();
// Defined in Database.TerritoryCalculation.cpp; used there, by
// Database.MapProcessing.cpp (foundCity), by Database.City.cpp
// (changeCityOwner), and by Database.cpp's own intServer().
void changeTerritory(int loc, int p);
void expandTerritory(int originLoc);
} // namespace Database
} // namespace Cevo