Open benskywalker opened 9 months ago
Just pushed out some more improvements. We now have a way to calculate whether a city is coastal, which does apply to unit production (lake cities can not build galleys). I've also added the logic for land isthmuses, which is working for the purposes of calculating lakes (small lakes separated from the ocean by a non-tile isthmus do not count as part of the ocean anymore).
I was reading the IsLake implementation and it got me thinking how we deal with Tiles throughout the entire code base. I was going to suggest that searchedWater be a HashSet but I realised, as you've implemented it, that there's probably no difference in performance when there's only 21 tiles in the list/set. Since we can determine the index of a Tile given it's x,y coords, we could uniquely identify tiles by their index, and use bitsets in a lot of places. Especially for TileKnowledge, it would save a lot of memory allocations to use bitsets instead of HashSets of tiles
I'm sorry, I deleted my previous comment because I was definitely commenting out of my ignorance about bitsets. That sounds like a very good idea for efficiency, and it would save a lot of unnecessary references for simple stuff. Because of the memory saved, it might be feasible to calculate things like IsLake for all tiles at the start of the game, and then it could just be a single bit.
This PR should solve issue #94. I have added the BFC tile logic for AI settlers, and it is working.
I left some log statements in we'll probably want to take out once this is ready to merge.
I also added the structure for calculating the irrigation and mining bonus for terrain types. The only issue is it looks like biq.cs is not pulling that information in yet. That's not really my area - @QuintillusCFC , that data would be in the biq file somewhere, right? Terr.cs does have a section for these bonuses, but it isn't getting input yet.
I'm just opening the PR so we can see where we're at on this