Commit Graph

39 Commits

Author SHA1 Message Date
RoosterDragon
b0619a3e25 Added comments in performance sensitive code. 2015-12-13 16:24:54 +00:00
RoosterDragon
84dffce7c1 Added an extension method to clone bitmaps with a 32bbpArgb pixel format. 2015-04-11 21:05:46 +01:00
RoosterDragon
b66db23adf Only evaluate input sequence once in RandomOrDefault.
This ensures non-deterministic sequences cannot crash by returning an empty sequence on the second evaluation.
2015-04-03 01:08:30 +01:00
Paul Chote
1e54b19bd3 Implement heightmap-aware view -> cell conversion. 2015-03-31 20:59:53 +01:00
RoosterDragon
1515ac54f6 Enforce a line length limit. 2015-03-19 17:20:34 +00: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
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
RoosterDragon
a6cda967c2 Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
2015-01-06 21:28:50 +00:00
Matthias Mailänder
44cd174a8d StyleCop clean OpenRA.Game 2015-01-03 19:00:48 +01:00
Oliver Brakmann
30e42cdc62 Merge pull request #7247 from Hellhake/stylecop-game
Fix StyleCop warnings in OpenRA.Game
2015-01-02 12:58:04 +01:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
Hellhake
fa72e04042 Remove BOM 2015-01-01 22:51:12 +01:00
atlimit8
bbd54cb32f Added IDisabledTrait & rewrote upgrade code using a level-based approach.
Upgradeable traits are notified whenever an upgrade of their declared types are granted or revoked.  The traits maintain their own internal level counter, which is then used to enable or disable the trait functionality.  A trait can register for multiple upgrade types which then all affect the internal level counter.

	IDisabledTrait for identifying (and filtering) disabled traits
	UpgradableTrait provides an abstract base for traits to support upgrade levels
	Added IDisabledTrait support to GlobalButtonOrderGenerator

	Includes rework by pchote with alterations.
2014-11-26 05:45:26 -06:00
Gordon Martin
04cbea3792 Desugaring a couple of ternary expressions which prevented OpenRA building on Mono 3.10 and certain versions of the 3.8 series due to a bug in Mono: https://bugzilla.xamarin.com/show_bug.cgi?id=23319 2014-11-11 21:43:33 +00:00
RoosterDragon
c672ac5bad Improve Exts.Random by testing if the input sequence is a collection, thus avoiding the need to create a copy to get the count.
Using the ElementAt method also means that if the sequence is a list too, then the selection can be done via the indexer rather the enumerating the elements.
2014-07-18 20:58:50 +01:00
Paul Chote
4216f66ca4 Add Exts.ISqrt to avoid fp sqrt calculations. 2014-06-28 15:48:53 +12:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
Matthias Mailänder
69d86cfcf2 add automated language string extraction to utility 2014-06-10 09:24:28 +02:00
RoosterDragon
0ea3509ee4 Added MinBy, MaxBy, MinByOrDefault and MaxByOrDefault methods and replaced calls of the style OrderBy[Descending]().First[OrDefault]() which is not as performant. 2014-05-23 08:23:42 +01:00
Matthias Mailänder
187362e80e rename OpenRA.Support.Random aka XRandom to MersenneTwister 2014-05-18 21:53:21 +02:00
Matthias Mailänder
59ace5d01b new shorthand Exts.(Try)ParseIntegerInvariant 2014-05-13 14:16:41 +02:00
Pavlos Touboulidis
ef066560ad Fix text-wrapping special case
If a line of text contained a whole word that was longer than the
allotted space, it would fail to wrap that line completely, even
if it was possible to wrap at other locations.

Fixing this uncovered a second issue, where it would drop the last
line if the input had more than one lines and one of the first ones
was wider than the specified width.
2014-04-25 13:54:14 +03:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Chris Forbes
1e3f365cf2 move all the Game.Exts junk either down into FileFormats or into WorldUtils 2011-03-12 22:33:24 +13:00
Paul Chote
094907c1a9 Update copyright header. Normalize line endings to LF. 2011-02-13 10:38:57 +13:00
Chris Forbes
80e3b8be0d more cleanups 2010-11-01 20:28:28 +13:00
Caleb Anderson
c85503811c Clamp, scroll, scrollspeed, sliders
Reduced clamp duplication
Fixed scrolling speed issue
Modified scrollspeed slider to use a range
Fixed scrollspeed, volume, and sound sliders not showing current setting.
2010-10-06 20:53:56 +13:00
Caleb Anderson
7bdf6a953f New slider Range parameter. Palette modifications. Potential crash fix. Clamp function.
Range parameter added to slider. Supports returning a range of values
rather than just 0-1. Allows you to not have to post process the offset.
Modified palette selector to not have full range, which was causing
blown out units.
Introduced exension method Clamp<T>(min, max)
Fixed crash deserializing out of bound color value using above
extension.
2010-10-05 17:25:25 +13:00
Paul Chote
a3246866fb Better perf logging 2010-09-17 10:02:24 +12:00
Paul Chote
6fba888d45 Shift Actor.Health onto a trait.
Known regressions:
 - cnc only
 - health bar colors
 - can't repair buildings
2010-07-30 00:33:44 +12:00
Chris Forbes
d5f12dd8ee trim down license spam in all files 2010-07-18 16:48:21 +12:00
Bob
281d013c3b move Combat, AttackBase, and associates into mod 2010-07-08 16:38:58 +12:00
Chris Forbes
ee0f90708f put perf in its own channel 2010-06-11 18:15:59 +12:00
Matthew Bowra-Dean
aa239d172d Log channels, PHP script diffs when told. 2010-06-10 12:50:22 +12:00
Bob
7deefc5246 debug (timing) spam, and perf fixed on SupportPower
Build timing (un)hacked by chrisf
2010-05-16 22:23:36 +12:00
Chris Forbes
c5fdda9141 more cleanup 2010-04-02 16:45:01 +13:00
Chris Forbes
1f1e748f1b removed old WeaponInfo 2010-04-02 16:45:01 +13:00
Chris Forbes
8a05af72b3 Unknown race -> Random; make it actually work, too. 2010-03-18 13:18:41 +13:00
alzeih
7881deca30 Everything is now OpenRA, not OpenRa 2010-02-27 21:10:22 +13:00