From b6bb961d7cf99bdf3c47f954e386c75a36518258 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 8 Dec 2019 21:19:45 +0200 Subject: [PATCH] Resolved #1422 - resources are now spread over different terrains as much as possible --- .../PolicyIcons/{Facism.png => Fascism.png} | Bin android/assets/ExtraImages/Icon.png | Bin 2078 -> 4680 bytes core/src/com/unciv/logic/map/MapGenerator.kt | 27 ++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) rename android/Images/PolicyIcons/{Facism.png => Fascism.png} (100%) diff --git a/android/Images/PolicyIcons/Facism.png b/android/Images/PolicyIcons/Fascism.png similarity index 100% rename from android/Images/PolicyIcons/Facism.png rename to android/Images/PolicyIcons/Fascism.png diff --git a/android/assets/ExtraImages/Icon.png b/android/assets/ExtraImages/Icon.png index 3042df68c0c3dde3492c954ff98a4c797447df9b..a4fca2d6e14cfee1c4ba0e7daa20777069e351e4 100644 GIT binary patch literal 4680 zcmV-O61VM%P)004&%004{+008|`004nN004b?008NW002DY000@xb3BE2000Uv zX+uL$Nkc;*P;zf(X>4Tx07%E3mUmQC*A|D*y?1({%`gH|hTglt0MdJtUPWP;8DJ;_ z4l^{dA)*2iMMRn+NKnLp(NH8-M6nPQRImpm2q-ZaMN}+rM%Ih2ti1Q~^84egZ|$@9 zx%=$B&srA%lBX}1mj+7#kjfMAgFKw+5s^`J>;QlP9$S?PR%=$HTzo3l9?ED;xoI3-JvF1F8#m>QQXW*8-A zz9>Nv%ZWK*kqtikEV84R*{M9Xh{ZXlvs2k(?iKO2Od&_ah_8qXGr62B5#JKAMv5?% zE8;ie*i;TP0{|3BY!`4?i6S-;F^L}%f`(o2L0Dz>ZZynda zx(`h}FNp#{x{a}MR#uh~m%}m=7xWMPPlvyuufAs_KJJh5&|Nw4Oks+EF0LCZEhSCJ zr)Q)ySsc3IpNIG#2mW;)20@&74xhslMTCi_jLS<9wVTK03b<)JI+ypKn)naH{-njZ z7KzgM5l~}{fYfy=Kz{89C<+lE(fh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z5B-q<2rDUF)+^;#E#ATq@*P2s?$X(?Gb{=(3IW{G~XZu^M99Vmv%rU
z_93!+Ik@4G4bqDe4J-@(wtGi%c6JsTdz!JnVk>$)y_g@9iI=lqfQnN|vt`R@Fx)1!
zj~_n{jYfmq++4)O#Gs2(ljnIv>-(V|zD^@GWMG)?VP@D|d0e$bVs+t`YIDuS3DR(J
zF4p~?rD3dBL9mo!Ls?*tq<@@_QZ6tJ9h8Q8B@IW@X?J+j@YsofG#ujqYqLW1_^Myv
z38@f;C~3%M$M$|kSC+j{!eCo*^7Q{2mUJ9;8C#-HrVV(YP@%IOxIt
z1MlMGXQw6O-CcH=FF%HknpiY`orb!aqf*gfxzB2XzwxV|TG7+#JAW~qKmR3O|NB10
z_-Mv;U^MLw&%qFO0x2`-{pwm^P#2=DwNcgv(rR|#-+wv{hpk7J+?+`{pjDs4?bBE}
z0;WcbNQm>m<-FikjzXROKW0^rN*&mbvzo~-pU=pMq+m%pG_V3+!u;L+z@u~`7O(qg%kQ&)G%Bny36
zK(Mw{E2TrJTl2ip81rmVQK5Fp{dwr^?Zu7ei*z20M`B_sY=5>EI&ki#6l90e-$;j2
z7JTX;6~c5O>@m`zbT=JJn{3Uy+`X!ulR1N0*IwHrR#uwI1cBRZwVM3D4+1uX@f;XKa`L=f
zs-=Hjd|%F8SAV{~MteJ}h+|=8Is5J`{P)y3lZPMPU^Sb{Wz~e-$^k!**{50kuc`YI
z38#8xqY>L_>)T?nm`bTLvg?eQwLg()
 
+            // If possible, we want to equalize the base terrains upon which
+            //  the resources are found, so we save how many have been
+            //  found for each base terrain and try to get one from the lowerst
+            val baseTerrainsToChosenTiles = HashMap()
+            for(tileInfo in availableTiles){
+                if(tileInfo.baseTerrain !in baseTerrainsToChosenTiles)
+                    baseTerrainsToChosenTiles.put(tileInfo.baseTerrain,0)
+            }
+
             for (i in 1..numberOfResources) {
                 if (availableTiles.isEmpty()) break
-                val chosenTile = availableTiles.random()
+                val orderedKeys = baseTerrainsToChosenTiles.entries
+                        .sortedBy { it.value }.map { it.key }
+                val firstKeyWithTilesLeft = orderedKeys
+                        .first { availableTiles.any { tile -> tile.baseTerrain== it} }
+                val chosenTile = availableTiles.filter { it.baseTerrain==firstKeyWithTilesLeft }.random()
                 availableTiles = availableTiles.filter { it.arialDistanceTo(chosenTile) > distanceBetweenResources }
                 chosenTiles.add(chosenTile)
+                baseTerrainsToChosenTiles[firstKeyWithTilesLeft] = baseTerrainsToChosenTiles[firstKeyWithTilesLeft]!!+1
             }
             // Either we got them all, or we're not going to get anything better
             if (chosenTiles.size == numberOfResources || distanceBetweenResources == 1) return chosenTiles