Commit Graph

159 Commits

Author SHA1 Message Date
Paul Chote
e10cb5cd9c Fix an incorrect coordinate check. 2015-07-05 14:57:59 +01:00
Paul Chote
b8b27f11af Remove stub map constructor. 2015-07-05 14:57:58 +01:00
Paul Chote
0dbbc00d0a Simplify editor/importer map creation. 2015-07-05 14:57:58 +01:00
Paul Chote
41fa77d12a Fix projected world coordinate calculation for Lua API. 2015-07-05 14:57:58 +01:00
Oliver Brakmann
fc7df415d7 Merge pull request #8394 from Mailaender/map-container-nre
Fixed a null reference exception in Map.Save
2015-06-20 21:06:00 +02:00
Matthias Mailänder
330982310c avoid a null reference exception 2015-06-20 15:56:26 +02:00
Paul Chote
da3abb4e2e Tweak shroud revealing logic
The per-actor visibility now tracks all cells
inside the map area (including those outside the
currently visible bounds), but the shroud/fog is
only cleared if the cell is inside the currently
visible bounds.
2015-06-15 18:06:42 +01:00
Paul Chote
ba2d499e5d Fix a bug in Map/CellLayer.Contains. 2015-06-11 21:27:35 +01:00
Paul Chote
d21b63ca04 Add some more coordinate utility functions. 2015-06-11 20:59:35 +01:00
Paul Chote
ec576558c0 Generate shroud cells outside the map. 2015-06-07 19:15:11 +01:00
Paul Chote
bf4722fb9f Distinguish between all map cells and cells inside map bounds. 2015-06-02 21:53:25 +01:00
Oliver Brakmann
dc08b7a90a Add buttons for map file management to map chooser 2015-05-24 01:49:30 +02:00
Matthias Mailänder
9c53ff1403 Merge pull request #8103 from RoosterDragon/mapcache-better-threading
Fix graphical glitches & crashes related to map loading
2015-05-20 13:11:44 +02:00
Paul Chote
d211fe9fe1 Add the world components of the new editor. 2015-05-15 17:09:20 +01:00
RoosterDragon
3b5a672848 Always access the SheetBuilder from the main thread in MapCache.
Not doing this can occasionally this can result in a cross thread call to the backing texture which leads to bad things. This stops trying to be clever regarding the thread safety invariants exposed by SheetBuilder and does things simply and safely: All updates happen on the main thread.
2015-05-07 20:58:59 +01:00
David Jiménez
044b51742f Remove plumbing for trait unit tests. 2015-05-01 16:24:14 +12:00
Paul Chote
4b1f541f34 Reorganize actor and smudge loading.
The actor and smudge definitions are now stored
as raw MiniYamlNodes in the map.  It is now the
responsibility of the consumers to parse these
into real objects.
2015-04-30 07:06:14 +12:00
abcdefg30
c4a63eee30 Merge pull request #7875 from penev92/bleed_exposePlayerReferences
Add upgrade rules support for map PlayerReferences
2015-04-26 22:53:42 +02:00
penev92
2402b56da7 Reorganize PlayerReference loading to enable upgrade rules for them.
The PlayerReference definitions are now stored
as raw MiniYamlNodes in the map.
2015-04-26 23:16:20 +03:00
Paul Chote
8a171bb452 Don’t export certain Init types. 2015-04-26 18:12:21 +12:00
Oliver Brakmann
322801247f Merge pull request #7987 from pchote/fix-player-bogosity
Fix random country display.
2015-04-19 18:13:04 +02:00
Paul Chote
3cfa96e7a6 Fix random country display. 2015-04-20 03:33:46 +12:00
Paul Chote
ab7706073b Don’t crash when asking for the offset of an invalid subcell. 2015-04-19 15:20:45 +12:00
Oliver Brakmann
b363c2c51e Don't unnecessarily discard 24bpp map previews
Those images now get converted on-the-fly by the game.
2015-04-18 11:27:23 +02:00
RoosterDragon
9c93001c84 Convert to 32bbp internally in FastCopyIntoSprite.
This avoids the need for callers to ensure the pixel format is correct, but ensures that the copying succeeds when the format is different.
2015-04-17 18:50:49 +01:00
RoosterDragon
84dffce7c1 Added an extension method to clone bitmaps with a 32bbpArgb pixel format. 2015-04-11 21:05:46 +01:00
RoosterDragon
c1787a8368 Don't process images with the wrong pixel format in MapCache. 2015-04-11 15:20:16 +01:00
RoosterDragon
5dfcc3e9d0 Convert custom map previews that are not using PixelFormat.Format32bppArgb. 2015-04-10 19:54:02 +01:00
Matthias Mailänder
3f48c649f0 Merge pull request #7722 from penev92/bleed_diplomacyWindow
Closes #7391
2015-04-05 08:34:38 +02:00
penev92
2c108a1845 Use proper names and flags for unknown players 2015-04-04 17:24:19 +03:00
Matthias Mailänder
39b42a35a0 Merge pull request #7823 from RoosterDragon/celllayer-enumerator
Fix CellLayer.GetEnumerator
2015-04-03 10:13:16 +02:00
RoosterDragon
9c0d3d737d Fix CellLayer.GetEnumerator. 2015-04-01 22:52:36 +01:00
RoosterDragon
47e2c48068 Ensure MapCache disposes cleanly.
This prevents the map loading thread writing to disposed objects which can have unintended side effects.
2015-04-01 20:58:09 +01:00
Paul Chote
c68cb995f4 Move cell corner state into Map. 2015-03-31 20:59:52 +01:00
Paul Chote
2630537daf Fix a mistake in Map.CellContaining.
Fixes #6247.
2015-03-31 20:59:52 +01:00
Paul Chote
84e85d8a5d Rename Image -> Images. 2015-03-30 20:20:36 +01:00
Paul Chote
4be5334a0e Add support for TS-style random tile variants. 2015-03-30 19:44:53 +01:00
Paul Chote
b2458fc614 Remove GlobalFilesystem.OpenWithExts. Closes #5272. 2015-03-28 12:38:48 +00:00
Paul Chote
5d0eecd4c5 Don’t crash on bogus TerrainTiles. 2015-03-25 19:59:09 +00:00
Oliver Brakmann
6fca67e7f6 Merge pull request #7664 from penev92/bleed_harvesterInsurance
Implement Carryall edge spawn, harvester delivery by carryall and harvester insurance for D2k
2015-03-25 20:03:00 +01:00
Paul Chote
8844defb44 Fix TileSet.Save(). 2015-03-23 20:32:28 +00:00
Matthias Mailänder
2f1aae59eb don't crash so easily 2015-03-23 21:03:26 +01:00
penev92
5927e1080a Add ChooseClosestEdgeCell() method to the Map class 2015-03-22 16:58:11 +02:00
RoosterDragon
1515ac54f6 Enforce a line length limit. 2015-03-19 17:20:34 +00:00
Paul Chote
8c4ea20636 Merge pull request #7430 from Rydra/upstream/pf-optimized
[Discussion PR] Complete refactor of Pathfinder
2015-03-03 19:50:25 +00:00
David Jiménez
54ae572303 - Introduced Unit Testing capabilities to the PathFinder trait and algorithm.
Introduced also a small Unit test project to prove it.

- Separated caching capabilities from PathFinder class to increase cohesion and maintainability.
Refactored the pathfinding algorithm by extracting methods based on responsibilities like
calculating costs and reordering functions. These changes should provide a in average a small increase in
pathfinding performance and maintainability.

- Optimized the pathfinder algorithm to reuse calculations like the
MovementCost and heuristics.

- Introduced base classes, IPathSearch and IPriorityQueue interfaces,
and restructured code to ease readability and testability

- Renamed the PathFinder related classes to more appropriate names. Made the
traits rely on the interface IPathfinder instead of concrete PathFinder
implementation.

- Massive performance improvements

- Solved error with harvesters' Heuristic

- Updated the heuristic to ease redability and adjustability. D can be
adjusted to offer best paths by decreasing and more performance by
increasing it

- Refactored the CellLayer<CellInfo> creation in its own Singleton class

- Extracted the graph abstraction onto an IGraph interface, making the
Pathfinder agnostic to the definition of world and terrain. This
abstraction can help in the future to be able to cache graphs for similar
classes and their costs, speeding up the pathfinder and being able to feed
the A* algorithm with different types of graphs like Hierarchical graphs
2015-03-03 20:11:11 +01:00
Paul Chote
00a2146299 Adjust GetImage plumbing in preparation for race-specific sequences. 2015-03-02 20:46:24 +00:00
David Jiménez
8659a3e71e Introduced the interfaces IActor, ICacheStorage, ILog, IMap, IWorld a
nd IMobileInfo to separate concrete implementations and abstractions
2015-02-22 23:14:12 +01:00
RoosterDragon
82bea961ba Checked LINQ queries and collections for inefficiencies.
- Made Array.IndexOf available via extension method.
- Made ToHashSet extension method.
- Change collections queried often via Contains into sets.
- Avoid Count() extension if Count or Length property exist.
- Made Count() > 0 checks and variations calls to Any() instead.
- Don't call ToList/ToArray if there is no benefit to materializing the sequence.
- If the sequence does benefit from materialization, follow this general pattern:
  - Collection queried often via Contains use ToHashSet to speed up lookups.
  - Short lived variables use ToList. This is because ToArray requires an extra copy to output the final size.
  - Collections persisted into fields or for a long time use ToArray to minimize memory overhead.
2015-01-29 19:20:11 +00:00
Oliver Brakmann
16cf805a23 Fix wrong log channel name: Debug -> debug 2015-01-25 18:34:16 +01:00