mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
feat: like temp likeness, 1.106.6
This commit is contained in:
parent
f15bccd610
commit
04c6fb3ee7
4 changed files with 65 additions and 57 deletions
26
index.html
26
index.html
|
|
@ -3403,15 +3403,19 @@
|
|||
<input id="burgPopulation" type="number" min="0" step="1" style="width: 9em" />
|
||||
</div>
|
||||
|
||||
<div data-tip="Burg mean annual temperature and real-world city for comparison">
|
||||
<div class="label">Temperature:</div>
|
||||
<span id="burgTemperature"></span>, like in
|
||||
<span id="burgTemperatureLikeIn"></span>
|
||||
<i
|
||||
id="burgTemperatureGraph"
|
||||
data-tip="Show temperature graph for the burg"
|
||||
class="icon-chart-area pointer"
|
||||
></i>
|
||||
<div data-tip="Burg average yearly temperature" style="display: flex; justify-content: space-between">
|
||||
<div>
|
||||
<div class="label">Temperature:</div>
|
||||
<span id="burgTemperature"></span>
|
||||
</div>
|
||||
<div style="display: flex; gap: 0.5em">
|
||||
<i class="icon-info-circled" id="burgTemperatureLikeIn"></i>
|
||||
<i
|
||||
id="burgTemperatureGraph"
|
||||
data-tip="Show temperature graph for the burg"
|
||||
class="icon-chart-area pointer"
|
||||
></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-tip="Burg height above mean sea level">
|
||||
|
|
@ -8110,7 +8114,7 @@
|
|||
<script defer src="modules/ui/biomes-editor.js?v=1.99.05"></script>
|
||||
<script defer src="modules/ui/namesbase-editor.js?v=1.105.11"></script>
|
||||
<script defer src="modules/ui/elevation-profile.js?v=1.99.00"></script>
|
||||
<script defer src="modules/ui/temperature-graph.js?v=1.99.00"></script>
|
||||
<script defer src="modules/ui/temperature-graph.js?v=1.106.6"></script>
|
||||
<script defer src="modules/ui/routes-editor.js?v=1.104.3"></script>
|
||||
<script defer src="modules/ui/routes-creator.js?v=1.104.3"></script>
|
||||
<script defer src="modules/ui/route-group-editor.js?v=1.103.8"></script>
|
||||
|
|
@ -8121,7 +8125,7 @@
|
|||
<script defer src="modules/ui/rivers-editor.js?v=1.106.0"></script>
|
||||
<script defer src="modules/ui/rivers-creator.js?v=1.106.0"></script>
|
||||
<script defer src="modules/ui/relief-editor.js?v=1.99.00"></script>
|
||||
<script defer src="modules/ui/burg-editor.js?v=1.102.00"></script>
|
||||
<script defer src="modules/ui/burg-editor.js?v=1.106.6"></script>
|
||||
<script defer src="modules/ui/units-editor.js?v=1.104.0"></script>
|
||||
<script defer src="modules/ui/notes-editor.js?v=1.99.06"></script>
|
||||
<script defer src="modules/ui/ai-generator.js?v=1.105.22"></script>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ function editBurg(id) {
|
|||
|
||||
const temperature = grid.cells.temp[pack.cells.g[b.cell]];
|
||||
byId("burgTemperature").innerHTML = convertTemperature(temperature);
|
||||
byId("burgTemperatureLikeIn").innerHTML = getTemperatureLikeness(temperature);
|
||||
byId("burgTemperatureLikeIn").dataset.tip =
|
||||
"Average yearly temperature is like in " + getTemperatureLikeness(temperature);
|
||||
byId("burgElevation").innerHTML = getHeight(pack.cells.h[b.cell]);
|
||||
|
||||
// toggle features
|
||||
|
|
@ -530,46 +531,47 @@ function editBurg(id) {
|
|||
}
|
||||
|
||||
// in °C, array from -1 °C; source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature
|
||||
const meanTempCityMap = {
|
||||
"-5": "Snag (Yukon)",
|
||||
"-4": "Yellowknife (Canada)",
|
||||
"-3": "Okhotsk (Russia)",
|
||||
"-2": "Fairbanks (Alaska)",
|
||||
"-1": "Nuuk (Greenland)",
|
||||
0: "Murmansk (Russia)",
|
||||
1: "Arkhangelsk (Russia)",
|
||||
2: "Anchorage (Alaska)",
|
||||
3: "Tromsø (Norway)",
|
||||
4: "Reykjavik (Iceland)",
|
||||
5: "Harbin (China)",
|
||||
6: "Stockholm (Sweden)",
|
||||
7: "Montreal (Canada)",
|
||||
8: "Prague (Czechia)",
|
||||
9: "Copenhagen (Denmark)",
|
||||
10: "London (England)",
|
||||
11: "Antwerp (Belgium)",
|
||||
12: "Paris (France)",
|
||||
13: "Milan (Italy)",
|
||||
14: "Washington (D.C.)",
|
||||
15: "Rome (Italy)",
|
||||
16: "Dubrovnik (Croatia)",
|
||||
17: "Lisbon (Portugal)",
|
||||
18: "Barcelona (Spain)",
|
||||
19: "Marrakesh (Morocco)",
|
||||
20: "Alexandria (Egypt)",
|
||||
21: "Tegucigalpa (Honduras)",
|
||||
22: "Guangzhou (China)",
|
||||
23: "Rio de Janeiro (Brazil)",
|
||||
24: "Dakar (Senegal)",
|
||||
25: "Miami (USA)",
|
||||
26: "Jakarta (Indonesia)",
|
||||
27: "Mogadishu (Somalia)",
|
||||
28: "Bangkok (Thailand)",
|
||||
29: "Niamey (Niger)",
|
||||
30: "Khartoum (Sudan)"
|
||||
};
|
||||
|
||||
function getTemperatureLikeness(temperature) {
|
||||
if (temperature < -5) return "Yakutsk";
|
||||
const cities = [
|
||||
"Snag (Yukon)",
|
||||
"Yellowknife (Canada)",
|
||||
"Okhotsk (Russia)",
|
||||
"Fairbanks (Alaska)",
|
||||
"Nuuk (Greenland)",
|
||||
"Murmansk", // -5 - 0
|
||||
"Arkhangelsk",
|
||||
"Anchorage",
|
||||
"Tromsø",
|
||||
"Reykjavik",
|
||||
"Riga",
|
||||
"Stockholm",
|
||||
"Halifax",
|
||||
"Prague",
|
||||
"Copenhagen",
|
||||
"London", // 1 - 10
|
||||
"Antwerp",
|
||||
"Paris",
|
||||
"Milan",
|
||||
"Batumi",
|
||||
"Rome",
|
||||
"Dubrovnik",
|
||||
"Lisbon",
|
||||
"Barcelona",
|
||||
"Marrakesh",
|
||||
"Alexandria", // 11 - 20
|
||||
"Tegucigalpa",
|
||||
"Guangzhou",
|
||||
"Rio de Janeiro",
|
||||
"Dakar",
|
||||
"Miami",
|
||||
"Jakarta",
|
||||
"Mogadishu",
|
||||
"Bangkok",
|
||||
"Aden",
|
||||
"Khartoum"
|
||||
]; // 21 - 30
|
||||
if (temperature > 30) return "Mecca";
|
||||
return cities[temperature + 5] || null;
|
||||
if (temperature < -5) return "Yakutsk (Russia)";
|
||||
if (temperature > 30) return "Mecca (Saudi Arabia)";
|
||||
return meanTempCityMap[temperature] || null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,13 @@ function showBurgTemperatureGraph(id) {
|
|||
|
||||
// Standard deviation for average temperature for the year from [0, 1] to [min, max]
|
||||
const yearSig = lstOut[0] * 62.9466411977018 + 0.28613807855649165;
|
||||
|
||||
// Standard deviation for the difference between the minimum and maximum temperatures for the year
|
||||
const yearDelTmpSig =
|
||||
lstOut[1] * 13.541688670361175 + 0.1414213562373084 > yearSig
|
||||
? yearSig
|
||||
: lstOut[1] * 13.541688670361175 + 0.1414213562373084;
|
||||
|
||||
// Expected value for the difference between the minimum and maximum temperatures for the year
|
||||
const yearDelTmpMu = lstOut[2] * 15.266666666666667 + 0.6416666666666663;
|
||||
|
||||
|
|
@ -60,7 +62,7 @@ function showBurgTemperatureGraph(id) {
|
|||
const minT = burgTemp - Math.max(yearSig + delT, 15);
|
||||
const maxT = burgTemp + (burgTemp - minT);
|
||||
|
||||
const chartWidth = Math.max(window.innerWidth / 2, 580);
|
||||
const chartWidth = Math.max(window.innerWidth / 2, 520);
|
||||
const chartHeight = 300;
|
||||
|
||||
// drawing starting point from top-left (y = 0) of SVG
|
||||
|
|
@ -107,9 +109,9 @@ function showBurgTemperatureGraph(id) {
|
|||
});
|
||||
|
||||
drawGraph();
|
||||
|
||||
$("#alert").dialog({
|
||||
title: "Annual temperature in " + b.name,
|
||||
width: "auto",
|
||||
title: "Average temperature in " + b.name,
|
||||
position: {my: "center", at: "center", of: "svg"}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||
*/
|
||||
|
||||
const VERSION = "1.106.5";
|
||||
const VERSION = "1.106.6";
|
||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue