Commit Graph

80 Commits

Author SHA1 Message Date
RoosterDragon
727084c5fc Run spell check over solution 2021-12-05 19:23:43 +01:00
darkademic
c51327c4cc Make yaml check utility load each map separately to reduce memory usage. 2021-12-04 20:07:19 +01:00
RoosterDragon
0f01df5474 Avoid string allocations in MiniYaml parsing.
- Stream lines in as memory rather than needing to realise a string for each line, via a new method in StreamExts.
- Use span to avoid string allocations during parsing until we want to realise the node itself, in MiniYaml.FromLines.
- Change several callsites to use the streaming extension method rather than string method where possible.
2021-11-15 13:20:34 +01:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
Paul Chote
d89f14dcbc Limit resource center queries to 50 maps at a time. 2021-05-09 15:37:30 +02:00
teinarss
e12ff2c59d Remove our own ReadOnlyDictionary and update usages 2021-04-03 11:33:31 +02:00
teinarss
d60c05eff3 Change to use pattern matching 2021-03-27 17:29:20 +01:00
teinarss
7073279ab8 Replace WebClient with HttpClient 2021-03-07 16:04:57 +00:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
Paul Chote
df1191db5b Don't crash if a null uid is given to QueryRemoteMapDetails. 2021-01-30 13:44:51 +01:00
Paul Chote
151cea96e9 Remove Platform.IsPathRelativeToSupportDirectory. 2020-11-22 16:42:46 +01:00
RoosterDragon
8fb65fd9bf Use string pooling in MiniYaml to de-duplicate strings in memory.
These config files often contain many repeated strings which result in different string references in memory. By using a pool, we can detect when the strings are equal and reuse an existing reference as strings are immutable.

The FromLines will now use a pool to de-duplicate strings for a single call. By allowing a pool to be provided as a parameter, we can reuse even more strings. The MapCache defines such a pool so that strings are reused across all maps in the cache for even more savings.
2020-10-12 21:57:08 +02:00
teinarss
9c4fd0e3d3 Use Null-Propagation Operator 2020-08-19 18:11:07 +01:00
teinarss
27f1a7ab27 Use out var syntax 2020-08-19 18:11:07 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
Paul Chote
c253aaeb9d Replace for(;;) with while (true). 2019-06-08 18:46:03 +02:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Unknown
7184f5f97e Fix QueryRemoteMapDetails multi-map status updates 2018-12-25 11:14:48 +13:00
Noam
4e7a35b50f add NoAvailableMaps exception.
modify ChooseInitialMap to throw NoAvailalbeMaps exception if no maps were loaded.
implement Utilities.TryWithPrompt - safe execution of a provided action with ability to prompt user on error.
2018-09-19 12:52:51 +02:00
RoosterDragon
7bc5bd5791 Force buffered sheets to commit data to a texture on buffer release.
Previously ReleaseBuffer did not immediately null out the buffer, instead the releaseBufferOnCommit flag allows it to be nulled when the texture is next access and the pending changes from the buffer are committed to it. Now the texture is committed immediately, thus the buffer is null once ReleaseBuffer returns.

Once loaded, we force a GC to reclaim temporary memory used during loading. Previously the buffer would not be null as it was pending commit to the texture and thus could not be reclaimed. As soon as we rendered the first frame, the buffer is nulled but we are now in a low GC state - and the buffer will not be reclaimed until the next gen 2 GC which may be dozens of minutes away.

This change ensures the buffer is null in time for the post-load GC, and thus can be reclaimed before we start rendering.
2018-04-29 18:11:48 +02:00
Paul Chote
8ea1da1046 Apply map upgrade rules without instantiating the Map object.
This avoids a crash that stops the maps from being updated
when the base mod ruleset is not valid (e.g. a trait is missing a
FieldLoader.Required property).  This also significantly improves the
upgrade performance.
2018-03-21 12:15:23 +01:00
Peter Antal
3ce2417a06 Create SupportDirPrefix and IsPathRelativeToSupportDirectory() as members on Platform class. 2018-03-10 12:54:01 +00:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
abcdefg30
27345c1f6a Fix map linting crashing for not existing directories 2017-10-08 18:23:25 +01:00
Paul Chote
a1347a7f32 Populate MapLocations from LoadMaps.
This ensures that the map locations won't be created by the utility
but means that LoadMaps must be called before attempting to use MapLocations.
2017-09-30 17:37:52 +02:00
Paul Chote
d1ed0e09d0 Create user map directory if it doesn't exist. 2017-07-21 00:10:48 +02:00
Paul Chote
8321d1f3e3 Remove legacy FileSystem.OpenPackage(string, IReadOnlyPackage). 2017-05-29 12:27:24 +02:00
Paul Chote
b1ac1d06e3 Catch and ignore exceptions while loading map previews. 2017-05-26 23:41:30 +02:00
Paul Chote
1722f42f83 Move web urls from user config to mod config. 2017-04-17 12:00:41 +01:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Chris Forbes
5b793e0455 server: Fix server getting wedged after map query with bad minimap
If the mapserver returned an unusable minimap blob, we'd end up dropping
the resulting exceptions on the floor, and committing a completely broken
MapPreview, which would then blow up the tail end of the map change
process, and all future ValidateClient calls after players join (which
itself was handled by kicking the player and logging some noise of dubious
value).

Adjusts exception handling in a number of places to log the exception
rather than dropping it on the floor, and makes the mapserver response
parsing tolerant of bogus minimap blobs -- in this case, we'd rather just
have no minimap.

Candidate for stable, as it fixes a bug present in the current release and
the current playtest series.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
2016-09-20 19:28:31 +12:00
RoosterDragon
3b5798b5e8 Fix cancellation of downloads.
The Download class cancels asynchronously, which means callers must handle cancellation inside the completion event, and not after requesting cancellation.
2016-07-30 16:27:45 +01:00
Paul Chote
55cd2ca8f5 Move initial map suitability calculation to MapCache.
This was previously trying to use values that had
not yet been initialised, which meant that *all*
maps were treated as unsuitable.  This would cause
the mod to always fall back to the first installed
map.
2016-06-18 11:04:37 +01:00
Matthias Mailänder
d57e53dc53 Merge pull request #10992 from pchote/server-maps
Allow Dedicated Servers to query map info from the Resource Center.
2016-04-03 12:19:41 +02:00
Paul Chote
4ec1369553 Let servers query map details from the resource centre. 2016-03-31 21:08:36 +01:00
Paul Chote
65f7d46025 Parse map rules and players from remote maps. 2016-03-31 21:08:36 +01:00
Paul Chote
b5c2703eba Pass random to ChooseInitialMap. 2016-03-29 23:46:12 +01:00
Paul Chote
fee899f63d Fix unnecessary uses of Game.ModData. 2016-03-29 23:46:12 +01:00
Paul Chote
2150a5e865 Move ChooseInitialMap to MapCache. 2016-03-29 23:46:11 +01:00
Paul Chote
be5eee0227 Allow rules to be constructed from a MapPreview. 2016-03-12 20:01:39 +00:00
Paul Chote
9c4dd54fa3 Generate map previews on save. 2016-03-08 21:13:38 +00:00
Paul Chote
be52c1cb72 Properly use the virtual filesystem for map loading and saving. 2016-02-28 19:27:33 +00:00
Paul Chote
b0f4646b88 Dispose package on exception. 2016-02-28 10:18:50 +00:00
Paul Chote
bee3eb2c0a Dispose MapPreviews and map packages. 2016-02-28 10:18:49 +00:00
Oliver Brakmann
4f1fa3acec Merge pull request #10786 from pchote/mappreview-packages
Remove internal use of map paths.
2016-02-23 22:52:54 +01:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
Paul Chote
d492c23a6d Store map packages in MapPreview. 2016-02-21 16:11:36 +00:00
Paul Chote
02ab54c9bc Load MapPreview data without initialising a full Map. 2016-02-18 20:19:44 +00:00
Paul Chote
102880c80f Use the virtual filesystem to resolve MapFolder paths. 2016-02-15 00:44:36 +00:00