Commit Graph

14236 Commits

Author SHA1 Message Date
Stian Grenborgen 94bf55cd16 Adjusts breakpoint for colony panel (window/fullscreen). 2024-01-02 18:08:57 +01:00
Stian Grenborgen 4cfcf1e43f The ColonyPanel can now be displayed as a fullscreen panel. 2024-01-02 18:08:57 +01:00
Stian Grenborgen 1b0d267494 The FreeColProgressBar and ConstructionPanel now have a max font size to avoid overflowing layouts. Building images are now sized so that images of different dimensions can be used. Updates the ConstructionPanel layout. 2024-01-02 18:08:57 +01:00
Stian Grenborgen 4f5d9bc9f9 Moving the buttons in the colony panel to the same line as the warehouse. This allows the construction panel to have a larger size. The colony is now automatically reopened after changing the font size and/or scaling factor. 2024-01-02 18:08:57 +01:00
Stian Grenborgen 53fb3c5cf6 Make the debug buttons in the colony panel less distracting. 2024-01-01 22:00:04 +01:00
Stian Grenborgen 19f71137d9 Massive redesign of the colony panel with background images and other styling. Buildings are now randomly distributed in the colony based on the available space (this is annoying when resizing the colony panel, but otherwise really good). The sizes of various panels have been tweaked to work both on small and large displays ... and panels that previously often required scrollbars have now been repositioned and made bigger. 2024-01-01 22:00:03 +01:00
Stian Grenborgen 31154cd8ac Removing unneeded ; 2024-01-01 22:00:03 +01:00
Stian Grenborgen 45ad080205 Units placed in cargo is now in color. 2024-01-01 22:00:03 +01:00
Stian Grenborgen d665a4276f A FreeColPanel can now explicitly set the border to be used on the JInternalFrame. 2024-01-01 22:00:03 +01:00
Stian Grenborgen 2567d30062 The WrapLayout now renders more components in the next row if this reduces the width without increasing the height. Using the improved layout for the warehouse dialog. 2024-01-01 22:00:03 +01:00
Stian Grenborgen 0c8f29975b Adding support for complex borders (added decorations next to the corners). 2024-01-01 22:00:03 +01:00
Stian Grenborgen 6135a10263 The size of the file chooser now scales according to the scaling factor. Some of the icons are still not scaled, but the entire panel should instead be replaced by a customized panel for FreeCol. 2023-12-31 12:01:36 +01:00
Stian Grenborgen 6c54d042e4 The scrollbar now scales using the UI scaling factor. 2023-12-31 12:01:36 +01:00
Stian Grenborgen 8968c75297 Makes the AI mission debug text easier to read when there are units on neighboring tiles. 2023-12-31 11:59:05 +01:00
Stian Grenborgen d2d0baa68a Some code cleaning of amount types when dragging. 2023-12-28 12:20:29 +01:00
Stian Grenborgen 4d5efcb91b Check the validity of goods transfers (except equipping units) before showing the dialog where the player can set the amount (BR#3344). 2023-12-28 10:38:47 +01:00
Stian Grenborgen 870592ad18 Makes the debug AI extra mission information easier to read. 2023-12-28 09:43:33 +01:00
Stian Grenborgen 672b14aaea Better handling of buildings of different sizes. Properly places more than three workers in buildings (if allowed by mods). 2023-12-27 21:30:58 +01:00
Stian Grenborgen 7e83f0c8d5 Adds compatibility code for adding 75% scaling options to stored client options. 2023-12-27 12:04:37 +01:00
Stian Grenborgen c95425a99a Stops internal frames from getting a smaller size than the minimum. 2023-12-27 11:33:04 +01:00
Stian Grenborgen 6f9e4f6545 Removes the black background from the colony tiles panel. The colony tiles panels now has room for forest/mountain extending beyond the base tile. 2023-12-27 11:33:04 +01:00
Stian Grenborgen 3221600148 Fixes unintended rendering differences between systems.
There was a bug in the version of MigLayout we used, prior to this commit, that applied DPI scaling even when that option was disabled (we do our own DPI scaling) for default/logical pixels.
2023-12-11 20:56:45 +01:00
Stian Grenborgen c48ef135ca Deactivates cache debug and updates the Javadoc. 2023-12-10 16:22:53 +01:00
Stian Grenborgen 0c6109419f Handles low memory being assigned to FreeCol.
This is performed by:
* Deactivates map scaling above 100%.
* Deactivates the loading of high resolution images.
* Deactivates smooth map scrolling.

It should now be possible to run FreeCol with only 512MB of memory assigned.
2023-12-10 15:42:42 +01:00
Stian Grenborgen da05dbdb5e Automatically frees the low-priority-cache when memory runs out. 2023-12-10 14:53:05 +01:00
Stian Grenborgen 6cb9e505f3 Adding better error handling when loading mods. 2023-12-03 11:08:04 +01:00
Stian Grenborgen 4c3c7696e6 Added "preserve-attributes" that, if true, preserves the attributes of a specification element. 2023-12-03 08:59:29 +01:00
Stian Grenborgen 039b14b0be Mods can now reference abstract types from the base rule without extending a specific base rule. 2023-12-03 08:41:45 +01:00
Stian Grenborgen 0c230e99fb Deactivate using bitmask on lowest setting in order to let players experiment with the difference. 2023-08-12 14:32:16 +02:00
Stian Grenborgen a16f9b32b5 Using compatible images for rendering instead of ARGB. Forcing usage of bitmask for transparency on lowest quality setting. 2023-08-12 13:44:32 +02:00
Stian Grenborgen 3a1cf9191e Removes usage of an intermediate image when rendering tile overlays. This makes rendering of tile overlays a little faster. 2023-08-11 16:54:38 +02:00
Stian Grenborgen 3c91272621 Deactivating sync for now since it sometimes causes tearing. 2023-08-03 20:03:57 +02:00
Stian Grenborgen 13e54e2bb0 Painting is now performed asynchronously while scrolling. This allows smooth scrolling after the tile caches have been updated with the current zoom level.
Remaining work:
* Move the actual painting code from MapViewer to a new class -- so that state fields like MapViewerBounds are not accidentally used.
* Reuse buffers in MapAsyncPainter.
* Handle fast scrolling direction changes. For example in MapAsyncPainter.scrollFocusOnBufferSize.
2023-08-03 19:27:59 +02:00
Stian Grenborgen c469435d4f Adding delayed update of the minimap. This is necessary for really large map in order to avoid stuttering terrain animations while moving units. 2023-08-02 12:05:26 +02:00
Stian Grenborgen f983adddb5 The minimap is now rendered using a buffer image. This is needed in order to get sufficient performance when scrolling on the main map -- since painting the minimap just takes too long. 2023-08-02 11:15:46 +02:00
Stian Grenborgen 8d001b94fd Fixes a scrolling issue when the terrain animations are turned off. Resets the scrolling speed when the scrolling stops. 2023-07-28 09:39:28 +02:00
Stian Grenborgen 2fd179387a Extends the scrolling area and stops scrolling when the mouse is on the menu bar. 2023-07-28 09:02:14 +02:00
Stian Grenborgen d68f54e953 Rewrites the positionMap calculations. Allows scrolling pixel-by-pixel. The focus tile is now placed exactly in the center. Allowing scrolling past the borders of a map so that edge tiles can also be placed in focus. 2023-07-28 08:56:39 +02:00
Stian Grenborgen 62fd6987ab Adjusts sizes for the buildings in the colony panel. The height requirement of a building no longer changes when a worker is added. The vertical gap between buildings are now reduced on small screens. 2023-06-11 14:30:37 +02:00
Stian Grenborgen c9379c201b A single click now also focus on explored tiles. 2023-06-11 14:16:46 +02:00
Stian Grenborgen a30935bc96 Unit dragging can now only be started by clicking on the unit. In addition, the drag can now be started for units that are currently not the active unit. 2023-06-11 14:06:21 +02:00
Stian Grenborgen 7a1b489c63 Focus is now changed on the mapboard with a single mouse click. The active unit is kept when opening a colony panel. 2023-06-11 13:43:47 +02:00
Stian Grenborgen ba94de3705 The confirm declaration dialog now fits on small screen. 2023-06-11 11:54:51 +02:00
Stian Grenborgen 416d0e0caf Simplifies the code somewhat. 2023-06-11 11:34:30 +02:00
Stian Grenborgen 77ac0ec849 Moves drawing of the menu bar status text to a utility method. 2023-06-11 11:34:08 +02:00
Stian Grenborgen 6b976523ac Allows panels to cover the entire mapboard area (that is, all the frame except the menu bar). This is needed for some panels on very small screen. 2023-06-11 11:32:46 +02:00
Stian Grenborgen 77b71fdd6a Scales the panel showing the signing of the Declaration of Independence. 2023-06-11 11:29:07 +02:00
Stian Grenborgen ad6d09d4bf Reduces the spacing above the ok button. 2023-06-11 11:14:56 +02:00
Stian Grenborgen a97bb10117 Makes the ColonyPanel work better on small screen. When specifying layouts using MigLayout, numbers without units are now scaled using the current interface scaling factor. 2023-06-11 11:03:40 +02:00
Stian Grenborgen 2591943d4d Fixes hidden OK-button on small screens. 2023-06-10 21:40:41 +02:00
Stian Grenborgen 6a6efc1b0a The WarehouseDialog is now a resizable panel. 2023-06-08 20:22:39 +02:00
Stian Grenborgen 07465c6df7 Adding WrapLayout that is a FlowLayout that can easily wrap components on a new line and increase height when necessary.
The code seem to be originally from:
https://tips4java.wordpress.com/2008/11/06/wrap-layout/

It has been copied across multiple GPL licensed projects (unmodified) without a reference to the original after the author stated that: "You can use/modify the code however you wish."

Any future changes to this file is licensed as the rest of FreeCol.
2023-06-08 20:22:39 +02:00
Stian Grenborgen e45f4d428a Fixes the focus order of radio buttons when using the arrow keys for navigation. 2023-05-23 19:07:19 +02:00
Stian Grenborgen fe99698c1e Adds styling for radio buttons and checkbox/radio menu items. 2023-05-23 19:07:19 +02:00
Stian Grenborgen 4f4d481a88 Adds partially transparent selection effect on top level menus. 2023-05-20 19:43:25 +02:00
Stian Grenborgen edf47c35e7 Adding new styling for the menubar. 2023-05-20 19:05:57 +02:00
Stian Grenborgen d60fb12a93 Reduces the contrast for the menu button backgrounds by making it partially transparent. 2023-05-20 19:03:08 +02:00
Stian Grenborgen 06abc66dd0 Adding missing file. 2023-05-20 12:41:09 +02:00
Stian Grenborgen ea28fd7756 Hides the unit order buttons when in the map editor. 2023-05-20 12:09:03 +02:00
Stian Grenborgen a09ee4f10f Show the top level menus (menubar) in a button like style. This increases the contrast between the text and background texture without having to apply the brighter color to the entire menu bar. 2023-05-20 12:01:15 +02:00
Stian Grenborgen 10ca820998 Updating version number. 2023-05-20 11:52:27 +02:00
Stian Grenborgen 0c9c7b0ec1 Fixes an issue where the texture paint is not removed after use. This stopped text etc from being rendered. 2023-05-20 11:24:57 +02:00
Stian Grenborgen 5e1479cfcb Updating the face of Peter Minuit to be more realisticly colored. 2023-05-20 10:57:39 +02:00
Stian Grenborgen 53c96b7a29 Removing ClassicMapControls since CornerMapControls is skinable. The latter can be expanded with more functionality if needed. 2023-05-19 22:22:13 +02:00
Stian Grenborgen 13a490ce67 Fixes options that cannot be found. The bug was caused by optionMap not being updated after reading options. 2023-05-19 22:22:13 +02:00
Stian Grenborgen c4101225fa Fixes a bug preventing the REF from surrendering. The bug was triggered when having non-military unit(s) in Europe and all land military units defeated. The fix is simply removing the check (that is really not needed). 2023-05-11 16:28:24 +02:00
Stian Grenborgen 23da6fe46b Fixes BR#3332 that was caused be a NPE. 2023-05-11 16:18:09 +02:00
Stian Grenborgen c6177db774 Highscores can now be added and displayed. 2023-05-06 17:26:41 +02:00
Stian Grenborgen 2d668b5676 Adjusting the number of colonies being built (fewer) and reduces cheating. The AI trade profit modifier is now reduced linearly until a turn number determined by a new option. The AI difficulty and colony expansion has been tuned for the default (small) map. We might want to make the number of colonies being built by the AI depend on the map size. 2023-05-06 10:02:23 +02:00
Stian Grenborgen 8b1288cb77 Military unit wishes and transports are now centrally managed. 2023-05-05 19:16:18 +02:00
Stian Grenborgen 470106d806 Removes the destination check for the base transport priority since the method is only called during construction of the mission. 2023-05-05 19:09:16 +02:00
Stian Grenborgen ccb75288d3 Only consider transportables going to the next location on the transport list when queuing extra cargo. 2023-05-05 19:06:05 +02:00
Stian Grenborgen 1315bdb5f3 AI: Allows better use of the tranport's capacity by filling it with all possible resources that should be going to the same destination. This was a capability that was present for years in FreeCol, but was lost in a refacturing someone did in 2008. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 20b08818e9 Adding a separate method for getting all transportables. Changing the amount of urgent transportables seem to have little effect. Deactivating for now. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 18ec0e754a Uses changeMission instead of setMission since the former handles dispose and setting transportation priority. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 146923ee2e Fixes slow AI turns caused by not being able to build new colonies. This is a temporary fix that should be removed when BuildColonyMissions are building colonies according to a grand plan (and the costly searches per unit therefor can be avoided). 2023-05-02 21:21:05 +02:00
Stian Grenborgen 18c969071e (Debug menu) Avoid getting the skip dialog when stopping the skipping of turns. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 7f38d76c58 Adding asserts for ensuring that the EDT is used when updating the GUI. Run with "-ea" to enable checking. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 3345d42808 Doing the animations on the EDT. This fixes a concurrent modification exception that sometimes prevented animations from displaying properly. 2023-05-02 21:21:05 +02:00
Stian Grenborgen 955ba1ca5d Starts game option settings fresh every time. We should probably add support for loading and saving options back in. 2023-04-30 12:22:26 +02:00
Stian Grenborgen 5e80b3e2d9 Speeds up AI turns by reusing existing defend settlement missions. This will mostly produce the same result as doing path finding every turn -- although in some special cases (that I think can be ignored) will produce a poorer result. 2023-04-30 10:20:13 +02:00
Stian Grenborgen 63fcca2f2a The map generator option for controlling the number of rivers to be generated now produced different results according to the selected value. Enabled generation of rivers that are only two tiles long (the previous limit was three). Map generator options are no longer stored nor loaded since this causes issues when changing the default options. It might be a good idea to support loading/saving of map generator options using the dialog. 2023-04-23 15:33:36 +02:00
Stian Grenborgen 9981570e24 Allows the founding father selection to be postponed without an error message. We can choose to force the choice to be made before the turn has ended, but that is currently not implemented. 2023-04-23 10:58:44 +02:00
Stian Grenborgen 1a1cb33420 The menu bar needs to be recreated after actions are recreated. 2023-04-23 10:37:21 +02:00
Stian Grenborgen cc72b7d261 Units in Europe are no longer included in the list of possible active units. The previous behaviour of having them included seems to have been deliberate, but causes several problems. If someone wants to include units in Europe in the list of possible active units, then this should only be added as an option. In that case, please do test that all unit actions either work or are disabled. 2023-04-23 10:02:36 +02:00
Stian Grenborgen ba940440f8 Fixes activation of improvement actions after reconnecting. Obsolete improvement actions are now removed when loading savegames etc. 2023-04-23 09:26:40 +02:00
Stian Grenborgen ef8cbf23aa Immediately aborts the escort unit mission if the protected unit gets destroyed. 2023-02-11 17:59:14 +01:00
Stian Grenborgen d84b2f5a4b Fixes a couple of NPEs caused by missing &. 2023-02-11 17:28:20 +01:00
Stian Grenborgen 07ed3eda55 Uses a cache for turns to reach. This fixes a performance issue that is caused by the turns to reach a given tile being calculated multiple times. 2023-02-11 11:44:35 +01:00
Stian Grenborgen 8c420d3a5b Explicitly ignore candidate tiles with infinite cost. 2023-02-05 13:24:36 +01:00
Stian Grenborgen f03e0e9ad5 Fixes a bug that aborted pathfinding when encountering a tile that the CostDecider marks as an illegal move. For example, this happened if there was a lost city rumour in the search area of a wagon train on a trade route. 2023-02-05 12:42:47 +01:00
Stian Grenborgen 3291a5fb23 Handles the cases of forced repair (classic combat model) and volunatary repair (hitpoints model) differently. 2023-01-18 22:24:11 +01:00
Stian Grenborgen d20be439b8 Panels/internal frames no longer disappears when switching to window mode from fullscreen. This is solved by resizing and relocating internal frames when the application frame changes size, so that all windows remain visible. 2023-01-17 18:00:06 +01:00
Stian Grenborgen a5f5467735 The start game panel can now be scaled smaller than the initial size. Places the chat panel below the table. 2023-01-16 21:05:13 +01:00
artoo b98c68fa97
TrainPanel: allow 5 columns wrap to better support more units; (#131)
mods can overcrowd the default of 3 easily
2023-01-16 18:24:06 +01:00
Stian Grenborgen 26ebe2b718 Fixes a NPE at initalization of the game. 2023-01-15 16:47:21 +01:00
Stian Grenborgen 3f49df9781 Disable ranged attack button for non-offensive units. 2023-01-15 16:36:54 +01:00
Stian Grenborgen bd865f20f6 Recreate order buttons on demand so that mods can define other order buttons without having to restart the game in order to get them applied. 2023-01-15 16:30:40 +01:00
Stian Grenborgen f6d89ed403 Fixes an issue that allowed a malicious client to attack with a unit that had no moves left. 2023-01-15 15:46:21 +01:00
Stian Grenborgen bae0f31651 Adds ranged combat to FreeCol. The "Hitpoints and Combat" mod uses the ranged combat for artillery and ships, and also contains adjustments to the ships' hitpoints. 2023-01-15 15:41:47 +01:00