refactor: generate relations

This commit is contained in:
Azgaar 2022-09-04 22:28:50 +03:00
parent 73431ec743
commit 136e71eae9
7 changed files with 85 additions and 66 deletions

View file

@ -7,7 +7,7 @@ import {initLayers, renderLayer, restoreLayers} from "layers";
// @ts-expect-error js module
import {drawScaleBar, Rulers} from "modules/measurers";
// @ts-expect-error js module
import {unfog, downloadFile} from "modules/ui/editors";
import {unfog} from "modules/ui/editors";
// @ts-expect-error js module
import {applyMapSize, randomizeOptions} from "modules/ui/options";
// @ts-expect-error js module
@ -76,8 +76,6 @@ async function generate(options?: IGenerationOptions) {
// if (route === 2) drawPoint(pack.cells.p[index], {color: "black"});
// });
downloadDiplomacyData();
WARN && console.warn(`TOTAL: ${rn((performance.now() - timeStart) / 1000, 2)}s`);
// showStatistics();
INFO && console.groupEnd();
@ -86,19 +84,6 @@ async function generate(options?: IGenerationOptions) {
}
}
function downloadDiplomacyData() {
const states = pack.states.filter(s => s.i && !s.removed);
const valid = states.map(s => s.i);
let data = "," + states.map(s => s.name).join(",") + "\n"; // headers
states.forEach(s => {
const rels = s.diplomacy.filter((v, i) => valid.includes(i));
data += s.name + "," + rels.join(",") + "\n";
});
// downloadFile(data, "relations.csv");
}
function showGenerationError(error: Error) {
clearMainTip();
ERROR && console.error(error);