Added seed to burg edit menu

This commit is contained in:
Youri Schuurmans 2018-09-11 14:21:55 +02:00
parent 51f46d5183
commit c3f2057718
2 changed files with 16 additions and 1 deletions

View file

@ -731,6 +731,7 @@
<button id="burgName" onmouseover="tip('Change Burg name')" class="icon-pencil"></button>
<div id="burgNameSection" style="display: none">
<input id="burgNameInput" onmouseover="tip('Populate to rename the Burg')" style="width: 117px"/>
<input id="burgSeedInput" onmouseover="tip('Populate to seed the Burg')" style="width: 50px"/>
<span id="burgNameReCulture" onmouseover="tip('Generate culture-specific name for the Burg')" class="icon-book pointer"></span>
<span id="burgNameReRandom" onmouseover="tip('Generate random name for the Burg')" class="icon-globe pointer"></span>
</div>

View file

@ -3021,6 +3021,7 @@ function fantasyMap() {
const labelGroup = burgLabels.select("#"+type);
const iconGroup = burgIcons.select("#"+type);
burgNameInput.value = manors[id].name;
burgSeedInput.value = manors[id].seed;
updateBurgsGroupOptions();
burgSelectGroup.value = labelGroup.attr("id");
burgSelectDefaultFont.value = fonts.indexOf(labelGroup.attr("data-font"));
@ -3183,6 +3184,15 @@ function fantasyMap() {
manors[id].name = this.value;
$("div[aria-describedby='burgEditor'] .ui-dialog-title").text("Edit Burg: " + this.value);
});
$("#burgSeedInput").on("input", function() {
if (this.value === "") {
tip("Seed can be blank");
return;
}
const id = +elSelected.attr("data-id");
manors[id].seed = this.value;
});
$("#burgNameReCulture, #burgNameReRandom").click(function() {
const id = +elSelected.attr("data-id");
@ -3405,11 +3415,14 @@ function fantasyMap() {
// open in MFCG
$("#burgSeeInMFCG").click(function() {
const id = +elSelected.attr("data-id");
console.log(manors[id]);
const name = manors[id].name;
const cell = manors[id].cell;
const pop = rn(manors[id].population);
const size = pop > 65 ? 65 : pop < 6 ? 6 : pop;
const s = seed + "" + id;
var bs = "";
if(manors[id].seed) bs += manors[id].seed
const s = seed + "" + id + "" + bs;
const hub = cells[cell].crossroad > 2 ? 1 : 0;
const river = cells[cell].river ? 1 : 0;
const coast = cells[cell].port !== undefined ? 1 : 0;
@ -7961,6 +7974,7 @@ function fantasyMap() {
population = population > 1e4 ? si(population) : rn(population, -1);
el.append('<span title="Population" class="icon-male"></span>');
el.append('<input title="Population. Input to change" class="burgPopulation" value="' + population + '"/>');
el.append('<input title="Seed. Input to change" class="burgSeed" value="'+ b.seed + '"/>');
var capital = states[s].capital;
var type = "z-burg"; // usual burg by default
if (b.i === capital) {el.append('<span title="Capital" class="icon-star-empty"></span>'); type = "c-capital";}