refactor: burg types

This commit is contained in:
Azgaar 2024-09-27 13:32:22 +02:00
parent 84c326e347
commit c04fb2bfca
5 changed files with 30 additions and 36 deletions

View file

@ -1511,20 +1511,6 @@ div.states > .burgCulture {
width: 6em;
}
div.states .burgPopulation {
width: 4.8em;
}
div.states .burgType {
width: 3em;
}
div.states .burgType > span {
padding: 0 1px;
color: #6e5e66;
transition: 0.2s;
}
div.states span.inactive {
color: #c6c2c2;
}

View file

@ -138,7 +138,7 @@
}
</style>
<link rel="preload" href="index.css?v=1.105.0" as="style" onload="this.onload=null; this.rel='stylesheet'" />
<link rel="preload" href="index.css?v=1.105.7" as="style" onload="this.onload=null; this.rel='stylesheet'" />
<link rel="preload" href="icons.css" as="style" onload="this.onload=null; this.rel='stylesheet'" />
<link rel="preload" href="libs/jquery-ui.css" as="style" onload="this.onload=null; this.rel='stylesheet'" />
</head>
@ -5280,7 +5280,7 @@
</div>
<div id="burgsOverview" class="dialog stable" style="display: none">
<div id="burgsHeader" class="header" style="grid-template-columns: 8em 6em 6em 7em 7em 4em 2em">
<div id="burgsHeader" class="header" style="grid-template-columns: 8em 6em 6em 6em 8em 6em">
<div data-tip="Click to sort by burg name" class="sortable alphabetically" data-sortby="name">Burg</div>
<div data-tip="Click to sort by province name" class="sortable alphabetically" data-sortby="province">
Province
@ -5296,7 +5296,7 @@
>
Population
</div>
<div data-tip="Click to sort by burg type" class="sortable alphabetically" data-sortby="type">Type&nbsp;</div>
<div data-tip="Click to sort by burg features" class="sortable alphabetically" data-sortby="features">Features&nbsp;</div>
</div>
<div id="burgsBody" class="table"></div>
@ -8053,7 +8053,7 @@
<script src="modules/biomes.js?v=1.99.00"></script>
<script src="modules/names-generator.js?v=1.87.14"></script>
<script src="modules/cultures-generator.js?v=1.99.05"></script>
<script src="modules/burgs-and-states.js?v=1.104.0"></script>
<script src="modules/burgs-and-states.js?v=1.105.7"></script>
<script src="modules/provinces-generator.js?v=1.104.0"></script>
<script src="modules/routes-generator.js?v=1.104.10"></script>
<script src="modules/religions-generator.js?v=1.99.05"></script>
@ -8101,7 +8101,7 @@
<script defer src="modules/ui/ai-generator.js?v=1.99.09"></script>
<script defer src="modules/ui/diplomacy-editor.js?v=1.99.00"></script>
<script defer src="modules/ui/zones-editor.js?v=1.100.00"></script>
<script defer src="modules/ui/burgs-overview.js?v=1.100.00"></script>
<script defer src="modules/ui/burgs-overview.js?v=1.105.7"></script>
<script defer src="modules/ui/routes-overview.js?v=1.104.3"></script>
<script defer src="modules/ui/rivers-overview.js?v=1.99.00"></script>
<script defer src="modules/ui/military-overview.js?v=1.99.00"></script>

View file

@ -239,16 +239,23 @@ window.BurgsAndStates = (() => {
return [x, y];
}
const getType = (i, port) => {
const cells = pack.cells;
if (port) return "Naval";
if (cells.haven[i] && pack.features[cells.f[cells.haven[i]]].type === "lake") return "Lake";
if (cells.h[i] > 60) return "Highland";
if (cells.r[i] && cells.r[i].length > 100 && cells.r[i].length >= pack.rivers[0].length) return "River";
const getType = (cellId, port) => {
const {cells, features, burgs} = pack;
if (!cells.burg[i] || pack.burgs[cells.burg[i]].population < 6) {
if (population < 5 && [1, 2, 3, 4].includes(cells.biome[i])) return "Nomadic";
if (cells.biome[i] > 4 && cells.biome[i] < 10) return "Hunting";
if (port) return "Naval";
const haven = cells.haven[cellId];
if (haven !== undefined && features[cells.f[haven]].type === "lake") return "Lake";
if (cells.h[cellId] > 60) return "Highland";
if (cells.r[cellId] && cells.fl[cellId] >= 100) return "River";
const biome = cells.biome[cellId];
const population = cells.pop[cellId];
if (!cells.burg[cellId] || population <= 5) {
if (population < 5 && [1, 2, 3, 4].includes(biome)) return "Nomadic";
if (biome > 4 && biome < 10) return "Hunting";
}
return "Generic";

View file

@ -75,7 +75,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
for (const b of filtered) {
const population = b.population * populationRate * urbanization;
totalPopulation += population;
const type = b.capital && b.port ? "a-capital-port" : b.capital ? "c-capital" : b.port ? "p-port" : "z-burg";
const features = b.capital && b.port ? "a-capital-port" : b.capital ? "c-capital" : b.port ? "p-port" : "z-burg";
const state = pack.states[b.state].name;
const prov = pack.cells.province[b.cell];
const province = prov ? pack.provinces[prov].name : "";
@ -89,7 +89,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
data-province="${province}"
data-culture="${culture}"
data-population=${population}
data-type="${type}"
data-features="${features}"
>
<span data-tip="Click to zoom into view" class="icon-dot-circled pointer"></span>
<input data-tip="Burg name. Click and type to change" class="burgName" value="${
@ -101,15 +101,16 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
${getCultureOptions(b.culture)}
</select>
<span data-tip="Burg population" class="icon-male"></span>
<input data-tip="Burg population. Type to change" class="burgPopulation" value=${si(population)} />
<div class="burgType">
<input data-tip="Burg population. Type to change" value=${si(
population
)} class="burgPopulation" style="width: 5em" />
<div style="width: 3em">
<span
data-tip="${b.capital ? " This burg is a state capital" : "Click to assign a capital status"}"
class="icon-star-empty${b.capital ? "" : " inactive pointer"}"
></span>
class="icon-star-empty${b.capital ? "" : " inactive pointer"}" style="padding: 0 1px;"></span>
<span data-tip="Click to toggle port status" class="icon-anchor pointer${
b.port ? "" : " inactive"
}" style="font-size:.9em"></span>
}" style="font-size: .9em; padding: 0 1px;"></span>
</div>
<span data-tip="Edit burg" class="icon-pencil"></span>
<span class="locks pointer ${

View file

@ -12,7 +12,7 @@
*
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
*/
const VERSION = "1.105.6";
const VERSION = "1.105.7";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
{