Sometime `TextField.cursorPosition` becomes greater than `TextField.text.length` for unknown reasons
In those cases we need to bring the cursor down to its maximum possible position which is `TextField.text.length`
Otherwise we will get `java.lang.StringIndexOutOfBoundsException` thrown from `kotlin.text.substring`
Not knowing the reason why it happens, I followed the libGDX implementation from here:
e03b757cae/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/TextField.java (L689)
And it seems to have fixed the errors we were getting
* Disabled CS buttons when at war; CS keep influence when at war with ally
This PR does two things:
- When you are at war with a city state, you can no longer give them
money, demand stuff, etc.
- When at war with the ally of a city state, your influence is frozen,
and after the end of the conflict set back to its original value.
To implement this last thing, I had to split the getter of `influence`
off of the underlying field, as otherwise when copying over the old
value in `.clone()`, we would copy over -60 when at war, instead of the
original value. Most of the changes in that PR are a result of that.
Also resets the `simulateUntilTurns` variable after completing
simulations
* Updated comment
* Refactor: Move classes into their own files
* Handle 404 FileNotFound in UncivServer
* Refactor: Rename method
* Make GameSaver.saveGame throw the exception by default if it is not handled
* Add possibility to work with FileHandles in GameSaver
* Make OnlineMultiplayerGameSaver load the multiplayerServer setting each time it does something
This theoretically makes it unnecessary for the OnlineMultiplayerGameSaver to be re-instantiated each time it is used
* Refactor: Remove duplicated code
* Refactor: Extract NextTurnButton from WorldScreen
* Refactor: Remove WorldScreen-specific code from OptionsPopup
* Use kotlin coroutines everywhere instead of plain threads
This probably also cuts down on our raw thread usage, improving performance, since we now use a cached thread pool (in addition to coroutines being able to reuse threads anyway)
* Improve deep load from notification
* Refactor: Give music download coroutine the proper name
* Make Civilopedia independent of worldScreen or gameInfo
* Make Civilopedia callable from Main Menu
* Era category for Civilopedia
* Era category for Civilopedia - atlas
* Replacements for existing UniqueTypes
* More typed uniques are added
* Migration to the typed uniques
* Minor optimization
* More general approach on UniqueType usage
* Better wording for the UniqueType
* Resolved#6767 - AI will not declare war if it definitely can't take a city
* Not sure what would happen if you try to calculate damage for civilian attacker and don't care to find out
* Added rate limit handling to dropbox
+ some refactor to make the whole file one object
* Added error messages on rate limit reached
+ refactored some popup code to reduce repetition
* Fixed merge error
* Made variables private
* Fixed file upload not working
because of missing override flag for dropbox
* Stop multiplayer refresher if rate limit reached
* Fixed typo
* Various code changes/fixes
- ErrorResponse var name has to be `error` because that's how DropBox's json property is named
- Change FileStorageRateLimitReached exception to store the seconds remaining as its own property instead of in the message
- Use toIntOrNull to avoid setting defaults in two places
* Fixed missed exception message
Co-authored-by: Azzurite <azzurite@gmail.com>
* Ranged units should use ranged strength when defending against ranged attacks.
* Renamed variable plus some minor style cleanup
Co-authored-by: OptimizedForDensity <>
* vpn/proxy issues when creating new mp game
replaced redundant ping with opening a connection to dropbox to fix the proxy issue
* updated error message to include dropbox
* check multiplayerServer url if the user is playing on it
* use `https://content.dropboxapi.com` instead of `https://www.dropbox.com`
* fixed proxy issues on android
if connected to proxy but no internet access it will freeze for a couple seconds (until it finishes the for loop) but it works
* forgot to add the imports
* removed android sdk network check to fix proxy issues
* check for internet now separate from check for multiplayerServer
removed frunctions from PlatformSpecificHelpers__
* added improvements made by touhidurrr
* removed unused imports and replaced setter with property access syntax
Co-authored-by: Md. Touhidur Rahman <46617994+touhidurrr@users.noreply.github.com>
* Hide the names of unmet yet alive civs in the victory screen.
Mainly affects the DestroyAllPlayers victory but the CaptureAllCapitals (as capital name) and WorldReligion victory code is updated accordingly.
* Redundant condition since dead civs can't hold cities.
* Formatting + undid CaptureAllCapitals name obscuring since there could be some cases where the known capital name suddenly becomes unknown.
* Parameterized if statement
* Hide other capital names until the tile is explored.
* New constant for an unknown city name.
Co-authored-by: OptimizedForDensity <>
* Renamed tile.hasUnique, deprecated `Indestructable`, unique for citadels
Also refactored the consumption of (great) people out of UnitActions.
* Reworked when improvements can be build somewhere for more clarity
* Made resources improvable by multiple improvements; Offshore Platform
* Fix compatability
* WIP
* Fixed the tests, but better
* I suppose I might as well update this now that we're a version later
* Move UncivServer to own module (and jar)
* UncivServer isalive logged
* Separate UncivServer - some wiki hints
* Separate UncivServer - how to build UncivServer.jar
Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
* Fix Barbarian Camp Spawned notification not revealing the camp on the map in multiplayer
* Fix lastSeenImprovement not being cloned
* Use HashMapVector2 in BarbarianManager
* Fix value not having its class written out for proper deserializing
* Refactor: various code improvements
* More verbose error handling
* Better handling of the missing mods exceptions
* Place GitHub routines where it is used the most
* Move a shared routine to the shared class
* Download missing mods
* Minor refactoring
* Minor fix: Handling corner cases
* Adds a debug option to simulate up to some amount of turns
Note that the option popup only appears _after_ closing the option menu,
which is very counterintuitive, but a direct result of how opening
popups is implemented.
I'm fine if this PR is rejected as a result of that, but it is quite a
useful option to have nonetheless.
* Reworked it so its just an internal text field + button
* Fixed the weird crashes and made UI interactive during simulation
* Create turn notifier for when the game is running for Windows
If playing on Desktop, you often put the game into background, but still want to know if it's your turn. A standard Windows function for that is `FlashWindow` from winuser.h, which is implemented here
* Fix: Use the window from the listener instead of the static one from libGDL
* Only notify if it's the turn of the player that is playing
* Always notify spectators of the next players' turn
* Refactor: Move notifier into GeneralPlatformSpecificHelpers
* Only load Windows DLL when we're actually on Windows