HDIAndrew / EFS

12 stars 0 forks source link

Naval Units moving onto certain river hex crashes game #33

Closed Xenotrenium closed 2 years ago

Xenotrenium commented 2 years ago

Description:

Expected behavior: Allow naval units passage through rivers or not

Actual behavior: Game allows you to travel through rivers as long as you end up in an "ocean" hex as a target. Game actually crashes when selecting a specific river hex.

This GIF shows everything you need to know efsLONG

The river hexes to the north of the lake tile are ok targets and will not crash the game. Every other river tile to the south will crash however.

Game version:

EFS15a3

Steps to reproduce:

Start as Decados Navigate to Severus Find and select one of your naval units Try to move your units onto the hex I described in the GIF

Additional information:

MODables.zip sav.zip

_I. Before Running the Game.txt _II. Running the Game.txt

Matt-Caspermeyer commented 2 years ago

Can you verify if this happens in V1.4? I seem to remember it does, but I can't remember. Hopefully I'll be able to look into this later in the week or next week...

Matt-Caspermeyer commented 2 years ago

Probably never mind with the verify with V1.4 as I have a fix and want to discuss here:

There was a situation when drawing a path where a condition wasn't considered in HEX::DrawMovePath in the situation for Water (Naval / Underwater) units. The condition was when drawing a path with rivers and deltas where the unit can move on the base deltas, but not combined movement terrains involving a 0, meaning the unit couldn't travel to that location.

Since the while (TRUE) statement could only get out if specific criteria happened, it would get stuck if movePoints -= glGroup.MoveCost( destX, destY ) did not change from while iteration to iteration. I've added an additional condition to the while (TRUE) loop to check if movePoints is the same as it was last iteration. If it is, then it returns FALSE indicating that the unit cannot move to the hex.

Solves Allowing Water Move Types to Move on Deltas / Rivers This change deals with allowing Water Move Types (Naval / Underwater) to be able to move through delta and river hexes when they are combined with terrain that the Water units have 0 movement.

Instead of multiplying (when 0, it 0's the movement) it adds (so it doesn't technically increase the movement, but it does increase the totalTerrainLayers) and then it multiplies the total by the number of terrain layers to compute the movement cost.

This seems like a good compromise to allow Water units to move into Delta and River hexes with mixed terrain types where their movement is 0.

I tried this out with the 4 Water units on Severus with Decados and it was fun being able to move the units through Delta and River hexes. Note that they cannot move into a combined river and road hex (the road takes precedence) and so that works as expected, to.

This will be in the next update if it gets approved and merged this week sometime.

Xenotrenium commented 2 years ago

Works - it's actually kind of fun having the movement be dynamic this way. Certain rivers with certain land terrain makes the river harder or easier to traverse for naval units.