basic game files port
This commit is contained in:
1 parent
8436242032
commit
9f24650296
10 files changed
+836
-1
No files matched your search
@@ -0,0 +1,42 @@
|
||||
#include "Cevo/CityProcessing.h"
|
||||
#include "Cevo/Database.h"
|
||||
|
||||
namespace Cevo {
|
||||
namespace CityProcessing {
|
||||
|
||||
void getCityAreaInfo(int p, int loc, TCityAreaInfo &cityAreaInfo)
|
||||
{
|
||||
// Original also has `{$IFOPT O-}Assert(1 shl P and InvalidTreatyMap = 0)`
|
||||
// here - a debug-only overflow-checking assertion with no effect on
|
||||
// release behavior, not ported.
|
||||
Database::Vicinity21Loc radius;
|
||||
Database::v21ToLoc(loc, radius);
|
||||
for (int v21 = 0; v21 <= 26; ++v21) {
|
||||
const int loc1 = radius[v21];
|
||||
if (loc1 < 0 || loc1 >= Database::mapSize) {
|
||||
cityAreaInfo.Available[v21] = faInvalid;
|
||||
} else {
|
||||
const int p1 = static_cast<int>(Database::realMap[loc1] >> 27);
|
||||
if (p1 < nPl && p1 != p && Database::rw[p].Treaty[p1] >= trPeace)
|
||||
cityAreaInfo.Available[v21] = faTreaty;
|
||||
else if (Database::zocMap[loc1] > 0 && Database::occupant[loc1] != p &&
|
||||
Database::rw[p].Treaty[Database::occupant[loc1]] < trAlliance)
|
||||
cityAreaInfo.Available[v21] = faSiege;
|
||||
else if (Database::usedByCity[loc1] != -1 && Database::usedByCity[loc1] != loc)
|
||||
cityAreaInfo.Available[v21] = faNotAvailable;
|
||||
else
|
||||
cityAreaInfo.Available[v21] = faAvailable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool canCityGrow(int p, int cix)
|
||||
{
|
||||
const TCity &city = (*Database::rw[p].City)[cix];
|
||||
return city.Size < MaxCitySize &&
|
||||
(city.Size < NeedAqueductSize || (city.Built[imAqueduct] == 1 && city.Size < NeedSewerSize) ||
|
||||
city.Built[imSewer] == 1);
|
||||
}
|
||||
|
||||
} // namespace CityProcessing
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user