Commit Graph

4580 Commits

Author SHA1 Message Date
Yair Morgenstern
1e7eff9d1e Can no longer gift units to enemy City States 2022-05-05 18:36:46 +03:00
Yair Morgenstern
467a0aa742 Resolved crash due to sending 'localized message' from exception 2022-05-05 18:29:34 +03:00
Yair Morgenstern
28a207813b Resolved #6701 - No crash from Science victory AI units that cannot head towards capital 2022-05-05 17:41:11 +03:00
letstalkaboutdune
035b6528a7
New Demographics Scoreboard (#6645)
* Healing parity

Adjusted healing values for parity with CV

* New Demographics system for victory screen rankings

Added a new game setup checkbox option to use a ranking system on the victory screen which is more in line with the Civ V Demographics window. Created the UI element and game parameter but the demographics screen still needs to be implemented.

Also removed unnecessary comments from adjustments to healing values in a previous update.

* Demographics table init

Beginning to build structure of Demographics rankings table.

* Update VictoryScreen.kt

Attempt at getting more of the Demographics table implemented

* Update VictoryScreen.kt

Continued building the structure of the Demographics table

* Demographics first implementation

Finished first pass of Demographics screen.

* Minor text formatting

Improved some text formatting in code and comments.

* Update MapUnit.kt

Minor comment cleanup.

* SomeTroglodyte's Feedback, pt. 1

Implemented feedback given by SomeTroglodyte in PR #6645.

* Organized into functions

Split up Rankings table creation and Demographics table creation into new functions

* Update template.properties

Fixed missing space.

* Implementing more PR #6645 feedback

Added needed translation templates, used enum class instead of array for headers, moved checkbox to Options -> Display instead of new game

* Implemented rest of PR #6645 feedback

Simplified logic for finding player's rank, value, best/worst civ value, and filtered out defeated civs from the display and calculations

* Dead Civs get 0 in all categories

Added simple check if a civ is dead when computing score. If they are dead then they get 0 and go to the bottom of the scoreboard.

* Update VictoryScreen.kt

Further cleaned up code for better reuse and simpler logic with fewer loops.

* Update CivilizationInfo.kt

Simplified implementation of return 0 for stats when civ is defeated.

* Update CivilizationInfo.kt

Removed commented-out line of code.

* Fixed duplicate rank bug

Adjusted method of determining best and worst civs so that duplicates don't occur.

* Update VictoryScreen.kt

One-lined the handling of logic in buildDemographicsTable()

* Update VictoryScreen.kt

Moved static header row to new function.
2022-05-05 14:42:35 +02:00
Yair Morgenstern
b258b34c89 Use a UniqueMap to have hashmap finding instead of array iteration and string comparison for MapUnit getUnique(string) - see #6695 2022-05-05 12:29:04 +03:00
Yair Morgenstern
d285bc1ec7 When updating civ resources, only update stats if anything has changed - see #6695 2022-05-05 12:16:34 +03:00
Yair Morgenstern
79dc3c08d1 Cache city-wide uniques in addStatPercentBonusesFromBuildings and updateTileStats, don't build maps in Stats - see #6695 2022-05-05 11:14:31 +03:00
Yair Morgenstern
c6795d7e91 Cache city-wide uniques in CityConstructions.getStats() for reuse between buildings - see #6695 2022-05-05 10:39:40 +03:00
Yair Morgenstern
333582980f Ignore temporary uniques if not relevant - see #6695 2022-05-05 09:51:17 +03:00
Yair Morgenstern
fe2c98bc54 Lazy initialize of Yield group - see #6695 2022-05-05 09:50:35 +03:00
Timo T
cf6543bc29
Fix Sweden not being able to gift great people to city states (#6690) 2022-05-05 09:09:15 +03:00
Yair Morgenstern
20d580976d Don't create unneeded filters in getMatchingUniquesWithNonLocalEffects - see #6695 2022-05-04 22:59:14 +03:00
Yair Morgenstern
6812caf3b3 Placeholder and Conditional function optimization - see #6695 2022-05-04 22:56:15 +03:00
Yair Morgenstern
7986134929 Update latest fastlane changelog entry when generating translation files 2022-05-04 19:03:47 +03:00
Yair Morgenstern
0aa1dbeda4 Added owner-style-specific improvements 2022-05-04 15:23:04 +03:00
SomeTroglodyte
75239ca1d9
Optimize String to Stat and Translation mod list somewhat (#6669)
* Accelerate Stat.values().firstOrNull and tr.activeMods a bit

* Use Stat.safeValueOf and its Map in existing code
2022-05-04 10:12:40 +03:00
Yair Morgenstern
deac3d6f67 Minor performance improvement for border strings 2022-05-04 10:11:27 +03:00
SomeTroglodyte
cec9975b4d
Implement fastlane step 2: Translating (#6643)
* Implement fastlane step 2: Translating

* Placing the Font family Label before the Thread is nicer
2022-05-03 09:16:22 +02:00
Jack Rainy
5d1a09b214
Allow city connections via open borders and own harbors only (#6656)
* Simplified tileFilter predicate

* Use only own harbors

* Allow city connections via open borders only

* Basic unit tests

* Advanced unit tests

* The maps and the legend for the tests

* CR changes: barbarians will not let the trades happen

* CR changes: get rid of question signs, "let" "Elvis" pass away
2022-05-03 08:10:29 +03:00
Timo T
ded648f6b1
Fix minimap actor leak (#6659)
* Formatting

* Fix minimap actor leak

The minimap update method tried to update borders only on tiles that changed owners, which is fine if that was what it did. But only the "remove old borders" part was in the "changed owners" branch, not "add new borders", so what actually happened was that each update all borders where the tile owner didn't change got added again, which is basically all borders.

This caused a huge slowdown the more actions you do on the world map in a single turn (i.e. move a lot of units). When a new turn starts, the minimap gets completely thrown away and rebuilt, so then it's fine again.

This changes the minimap to properly add/remove borders when something actually changes.

* Refactor: Split classes up into separate files

Also, split up the Minimap.init method into smaller methods to make it a bit more readable

* Finish up comment
2022-05-03 08:07:17 +03:00
Xander Lenstra
da2d3450b8
Fixed provides [amount] [resource] on buildings not accepting conditionals (#6664)
* Fixed `provides [amount] [resource]` not accepting conditionals
This was due to it still using `getLocalMatchingUniques` without 
providing a `StateForConditionals`, and then manually filtering them if 
they didn't provide conditionals. This of course doesn't work anymore, 
as `getLocalMatchingUniques` then assumes that all conditionals aren't 
satisfied.
Also refactored a loop over `uniqueObjects` with `isOfType()` to just 
use `getMatchingUniques()`.

* Only initialize StateForConditionals once

* Actually this is more moddable
2022-05-03 08:01:54 +03:00
SomeTroglodyte
515c9bbcae
Show available resources from CityScreen (bottom right info only) (#6667) 2022-05-03 07:59:42 +03:00
Xander Lenstra
c55b14eaa7
Implemented most easy things from comments on moddable victory PR (#6600)
* Implemented most easy things from comments on moddable victory PR
Also added religious victory condition

* Fixed tests

* Fixed compile problems & missing string

* Fixed typo
2022-05-03 07:56:24 +03:00
alexban011
898b1ca056
check for internet before starting a mp game to avoid freeze (#6679)
* Fixed issue #6649 by checking for internet connection before starting the game if "online multiplayer" is selected
Many thanks to SomeTroglodyte for most of the code and for explanations

* check for internet before starting a mp game to avoid freeze

Fixed issue #6649 by checking for internet connection before starting the game if "online multiplayer" is selected.

Many thanks to SomeTroglodyte for most of the code and for explanations. A slight modification has been done to the code to catch an error caused by InetAddress

* Revert "Merge remote-tracking branch 'origin/master-noInternet' into master-noInternet"

This reverts commit bd6474b50d, reversing
changes made to f52ad60b51.
2022-05-02 23:41:08 +02:00
Jack Rainy
031cb4fc14
Enable scrolling for the oversized popups (#6668) 2022-05-02 13:56:34 +02:00
SomeTroglodyte
4d6058a9d4
Fix TileInfo.neighbors being incomplete in rare circumstances (#6644)
* Fix incomplete neighbors first seen as continents up to expectations

* Fix incomplete neighbors - more comments
2022-05-01 06:49:28 +03:00
Jack Rainy
ac2f31f553
Protect the cities from the fallout spawning (#6640) 2022-05-01 00:09:00 +03:00
SomeTroglodyte
9b5f70e868
Show number of global followers in Religion Overview (#6654) 2022-05-01 00:07:48 +03:00
Xander Lenstra
1ac2ecb9e8
Fixed improvements with unfulfilled 'Only Available' still buildable (#6646) 2022-04-30 23:58:52 +03:00
SomeTroglodyte
52586a2101
Map editor2.2 (#6641)
* Readability overloads for `getComplexRuleset`

* Enable loading maps containing missing ruleset objects with fix and message

* Fix bungled `noMapsAvailable` and follow minor criticism
2022-04-30 23:58:03 +03:00
Xander Lenstra
1a050bdaa6
Fixed a crash when a plane tried to enter a full city (#6652)
This would only occur if the plane was damaged and looking for a spot to 
heal, and had no tile to go to with >0 healing. It would then try to 
head towards the nearest city, regardless of whether it could enter 
that. As it's an air unit, 'head towards' means 'fly there directly this 
turn', which obviously caused crashes if the unit couldn't enter that 
tile.
2022-04-30 23:08:48 +03:00
Yair Morgenstern
8133f40f74 Don't allow trade routes through enemy cities - #6633 2022-04-29 09:47:51 +03:00
Yair Morgenstern
702f477e49
Added placeholder parameter location in a way that enables nested translations (#6632)
* Added placeholder parameter location in a way that enables nested translations - see #6474

* Simplified
2022-04-28 13:32:55 +02:00
Jack Rainy
487ad69d28
Correct swap of the full-loaded carriers (#6634)
* Correct swap of the full-loaded carriers

* Code comments
2022-04-28 13:31:46 +02:00
Xander Lenstra
2b9b68488d
Very likely fixed a new 4.0.9 crash. (#6627)
Not sure what exactly happened, but this should fix it. Also updated it 
to use the new victory milestones instead of the apollo project
2022-04-27 19:00:58 +03:00
Jack Rainy
6e88828240
Correct calculation of the production for the Settlers (#6590)
* Correct contribution to the Settler production

* Correct indicator of the food usage during Settler production

* More precise calculation of the food to production conversion

* Revert of starvation avoidance during Settler production

* Minor tweaks
2022-04-27 09:16:11 +03:00
SomeTroglodyte
8891883998
Resources UI (#6596)
* More info for Resources in Civilopedia

* Remove duplicates for Resource requirements in Civilopedia

* Resource overview link resource label to Civilopedia

* Resource overview stay if clicking can't notify (resources not existing on map)

* Resource overview display of resources produced by buildings
2022-04-27 09:15:49 +03:00
Xander Lenstra
933e769d8e
Changed milestone build globally text to make it more understandable (#6613)
* Changed milestone build globally text to make it more understandable

* Actually this is probably just as clear, gramatically more correct and
more imperative like the other milestones

* Fixed tests

* Reworded again
2022-04-27 09:15:33 +03:00
ultradian
d2f0e32229
Making SpecialistAllocationTable an ExpanderTab (#6614)
* Make SpecialistAllocationTable an ExpanderTab

* Make Specialist ExpanderTab translatable
2022-04-27 09:14:19 +03:00
SomeTroglodyte
996c58e1fb
Some improvements to Map Editor - step 1 (#6622) 2022-04-27 08:19:04 +03:00
letstalkaboutdune
26c87bcc36
Healing parity (#6612)
Adjusted healing values for parity with CV
2022-04-26 12:31:30 +03:00
Jack Rainy
27718bd605
Correct swapping of the carriers with payloads (#6594)
* Comments are added

* Correct swap of carriers with payloads
2022-04-26 09:06:32 +02:00
Xander Lenstra
be9ae1d8d8
Typed all belief automation uniques (#6601)
* Typed all belief automation uniques

* Might as well change this

* Fixed tests
2022-04-26 10:02:33 +03:00
Jack Rainy
7d15e3dc53
Display wonders built in other civs correctly (#6604) 2022-04-25 23:26:31 +02:00
SomeTroglodyte
23c23e5566
Unique docs writer makeover (#6516)
* Comments to 'link' implementation (matchFilter) to UniqueParameterType

* Comments to 'link' UniqueParameterType to implementation (matchFilter)

* Fix two mistakes in UniqueParameterType

* Make "and" filter logic for MapUnit and BaseUnit modular, fix mistake

* Make UnitMovementMemory immutable and without lateinit

* Keep UniqueType comment promise that instances can override parameter types

* Reorg UniqueDocsWriter so UniqueParameterType-specific text is moved to the enum

Also some minor improvements - e.g. abbreviations sorted & consistent punctuation, less memory allocations, a/b/c type params get an example,...

* New abilities for UniqueDocsWriter concerning UniqueTarget and inheritsFrom (initially deactivated)

* Actually implement the wish for distinction between absolute and relative amounts

* Change UniqueParameterType.UnitName.docExample to Xander's choice
2022-04-24 22:47:19 +03:00
Xander Lenstra
34105efdda
Moddable victories (#6161)
* Added a moddable (but not yet functional) file for victories

* Spaceship parts are units now

* Fixed tests

* Added milestone objects

* Made 'our status' table in VictoryScreen dependend on file

* Updated VictoryManager to use the new Milestone system

* Fixed bug where in vanilla too many spaceship parts could beb uild

* Whoops

* Updated global victory table to use the jsons

* Updated the new game screen to show the new victory types
Also started with the deprecation of VictorType

* Did some translation stuff, also finally fixed the tests

* Removed VictoryType and reworked AI to use Milestones instead

* Add some checks for the victory file; tested that custom victories work
Also moves some code to a better spot and fixes compilation errors

* Fixed some things I thought about while falling asleep
Most notably: built -> build; fixed spaceship part construction 
priority; removed more code for the old system

* Fixed translation issues on the victory screen
2022-04-24 22:45:38 +03:00
Xander Lenstra
0a5fc3cf33
Fixed the internal name & parameter of a unique (#6577) 2022-04-20 17:02:31 +03:00
Yair Morgenstern
34664e6071 Fixed bug with aircraft rejection reasons 2022-04-20 12:50:30 +03:00
Yair Morgenstern
18be173ab8 Mod land units with missile and nuke uniques no longer crash the game 2022-04-20 12:32:40 +03:00
Yair Morgenstern
c5c06a2456 improvementFilter accepts uniques as well 2022-04-20 09:37:00 +03:00