1dot13 / source

Source code for the game executable of the Jagged Alliance 2 v1.13 project
102 stars 18 forks source link

Reduce code duplication #233

Closed Asdow closed 1 year ago

Asdow commented 1 year ago

This came about when I was looking at display cover functionality, again, and noticed that in the hot loop, we were using functions CenterX & CenterY to calculate coordinates for X and Y separately, duplicating work.

While going through the code for references to these functions, also noticed a lack of a utility function for calculating direction based on center coordinates, even though there was a clear need for one.

I'd like to chip away at the stupid amount of duplicate code we have and maybe this could serve as a starting point?