reyandme / kam_remake

"KaM Remake" is an RTS game remake written in Delphi from scratch.
http://www.kamremake.com
GNU Affero General Public License v3.0
124 stars 29 forks source link

Linux FPC Lazarus: fix compilation KM_TerrainPainter unit #194

Closed dpronin closed 9 months ago

dpronin commented 9 months ago

fix ambiguous call of GetLength in TKMTerrainPainter.ApplyHeight

reyandme commented 9 months ago

Does FPC give an error on that line in case there is no cast to Integer? If yes, then it would be very inconvinient to always do such a cast when use this and similar methods. There is no point in overriden method names in that case, better to use a separate method name instead, smth like GetLengthI f.e.

dpronin commented 9 months ago

Despite there are 3 methods defined in KromUtils unit and all of them are marked with overload on Linux platform with FPC-3.2.2 + Lazarus-3.0 the compiler is confused which one should be selected to call

Functions look like

function GetLength(ix,iy,iz: single): single; overload;
function GetLength(ix,iy: single): single; overload;
function GetLength(ix,iy: integer): single; overload;

I suspect that types single and integer compete and conflict

I think that I could introduce GetLengthI with concrete types (Integer), as you have offered, that would call GetLength with integer parameters. If it fails I will bring the algorithm out from GetLength to GetLengthI and call GetLengthI from GetLength

dpronin commented 9 months ago

@reyandme done

reyandme commented 9 months ago

Thank you