Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
476 stars 75 forks source link

Game run from this save always crashes #1559

Closed balwierz closed 1 year ago

balwierz commented 1 year ago

win32 version v20230302-60d3d9470be818b02f1af32f53a545bd8d30d041 Steps to reproduce:

dfhg.zip

PS. Also at the same game there started to appear less serious bugs before: Some goods are not transported near the blue player's harbour. Blue player cannot attack the enemy's harbour although it is visible, there are enough soldiers etc. Blue player has some buildings not being built (despite enough resources and builder present) near the harbour.

Spikeone commented 1 year ago

@balwierz probably same as #1520

wichern commented 1 year ago

What I see in the game is that the harbour is being attacked. The crash happens right when the enemy soldier enters it: Screenshot from 2023-03-23 11-36-57

The crash occurs, because this condition is not true: https://github.com/Return-To-The-Roots/s25client/blob/master/libs/s25main/figures/noFigure.cpp#L429

The actual value of the GOT at that position is GO_Type::Fire.

When simply adding an if guard for this condition in noFigure::GoHome, another check fails: https://github.com/Return-To-The-Roots/s25client/blob/master/libs/s25main/buildings/nobBaseWarehouse.h#L220

The problem is somehow related to the fact that at this moment an expedition was about to start from this harbour and calling DestroyBuilding() cause adding figures. I don't quite understand what is supposed to happen with figures here though.

wichern commented 1 year ago

I think I found the bug. I will create a pull request.