Fix elevation calculation and polar snowline threshold preventing unit movement

This commit is contained in:
bart
2026-11-08 20:44:55 +01:00
parent df6eac62ca
commit 9fe4a631e4
3 changed files with 12 additions and 7 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ mountain_rock_height_km: 2.3 # Height in km >= 2.3 is rocky mountain
snow_height_km: 3.1 # Altitude in km >= 3.1 is high peak snow
polar_snow_line_enabled: true # Whether latitude reduces snowline altitude
polar_snow_line_base_km: 2.5 # Base snowline at temperate latitudes
polar_snow_factor_start: 0.40 # Latitude distFromCenter where polar cooling starts
polar_snow_factor_end: 0.85 # Latitude distFromCenter where sea-level snowline is reached
polar_snow_factor_start: 0.88 # Latitude distFromCenter where polar cooling starts (polar caps only)
polar_snow_factor_end: 0.98 # Latitude distFromCenter where sea-level snowline is reached
# Slope and elevation movement penalties
# Elevation difference (deltaH in km) between hex centers
+6 -1
View File
@@ -1546,9 +1546,14 @@ void QSceneRenderer::mousePressEvent(QMouseEvent *event)
update();
return;
} else if (event->button() == Qt::RightButton) {
// Right click: Move selected unit directly to hex!
// Right click: Attack enemy unit or move selected unit directly to hex!
if (selected) {
Unit *enemy = GameManager::instance().getUnitAt(hitX, hitY);
if (enemy && enemy->playerId != selected->playerId) {
GameManager::instance().commandAttack(enemy);
} else {
GameManager::instance().commandMoveSelected(hitX, hitY, m_point, m_numPoints05);
}
update();
return;
}
+3 -3
View File
@@ -12,8 +12,8 @@ TerrainMovementConfig::TerrainMovementConfig()
snowHeightKm(3.1f),
polarSnowLineEnabled(true),
polarSnowLineBaseKm(2.5f),
polarSnowFactorStart(0.40f),
polarSnowFactorEnd(0.85f),
polarSnowFactorStart(0.88f),
polarSnowFactorEnd(0.98f),
uphillSlopeMultiplier(4.0f),
downhillSlopeBonusMultiplier(2.0f),
minStepCost(0.25f),
@@ -143,7 +143,7 @@ QString TerrainMovementManager::getTerrainType(int tx, int ty, Matrix2D<TerrainP
return "water";
}
float heightKm = (tp.height / 255.0f) * 3.5f + 1.0f;
float heightKm = (tp.height / 255.0f) * 3.5f;
// 2. High peak snow
if (heightKm >= m_config.snowHeightKm) {