Commit Graph

341 Commits

Author SHA1 Message Date
RoosterDragon
f0f02dff5c Dispose of graphics resources deterministically.
Textures, FrameBuffers and VertexBuffers allocated by the Sdl2 Renderer were only being released via finalizers. This could lead to OpenGL out of memory errors since resources may not be cleaned up in a timely manner. To avoid this, IDisposable has been implemented and transitively applied to classes that use these resources.

As a side-effect some static state is no longer static, particularly in Renderer, in order to facilitate this change and just for nicer design in general.

Also dispose some bitmaps.
2014-12-22 17:34:01 +00:00
huwpascoe
db126ce1b6 Reimplemented TraitsInConstructOrder() 2014-10-29 20:37:14 +00:00
Oliver Brakmann
8f8b0b966f Avoid reading CenterPosition of invalid targets in DamageWarhead
Fixes #6642
2014-10-03 14:24:27 +02:00
Paul Chote
7bc8c171e8 Minor style fixes. 2014-09-29 21:01:44 +13:00
Paul Chote
f463407d8d Fix a loop closure bug in the weapons code.
Fixes #6597. Fixes #6599.
2014-09-29 20:57:20 +13:00
Paul Chote
caecf2d82a Move inaccuracy modifier queries outside the projectile ctors. Fixes #6449. 2014-09-20 21:43:00 +12:00
reaperrr
3725ce4f7b InfDeath -> DeathType renaming. 2014-08-30 18:06:05 +02:00
UberWaffe
1fbcdfc3c3 AffectsParent defaulted to false. 2014-08-25 20:44:21 +02:00
UberWaffe
e3e5e9eb00 Adds Diplomacy keywords for ValidTarget checks.
Changes:

Allows diplomacy stance checks to be done on warheads and weapons, using keywords in ValidTargets and InvalidTargets.
2014-08-24 07:00:21 +02:00
UberWaffe
76ccb0cf00 Changes Weapon.Impact() to use Target (from WPos). 2014-08-23 11:23:34 +02:00
Paul Chote
fa3e7b5e1b Convert versus to integers. 2014-08-23 17:14:12 +12:00
Paul Chote
d002a23d67 Change EffectivenessAgainst to CanTargetActor. 2014-08-23 17:14:10 +12:00
Paul Chote
227a523878 Further warhead streamlining. 2014-08-23 17:14:10 +12:00
Paul Chote
57ba1b54b4 Convert weapon plumbing to use integer damage modifiers. 2014-08-23 17:14:10 +12:00
Paul Chote
8e8e02dae8 Move warheads into mod code. 2014-08-23 17:14:10 +12:00
Paul Chote
1261d5891d Move common DoImpact(Target) method into DamageWarhead. 2014-08-23 17:14:09 +12:00
Alexander Fast
070d00c678 Fixes year numbers in license text in file headers. 2014-08-21 11:27:52 +02:00
obrakmann
87e4d6b422 Merge pull request #6079 from reaperrr/rof-modifier
Adds ReloadDelay modifier & renames ROF to ReloadDelay
2014-08-21 00:27:39 +02:00
reaperrr
3e3f1394d9 Adds length display support for PCM & IMA music. 2014-08-20 08:22:40 +02:00
reaperrr
4469b5f5ca Introduces ReloadModifier
and renames ROF -> ReloadDelay
2014-08-19 02:59:50 +02:00
UberWaffe
0ebe1c2c6a Made Effect, Resource and Smudge warheads return 0% effective against actors. 2014-08-16 10:58:04 +02:00
UberWaffe
fb2b63c7f8 #6030 regression fix. Added EffectivenessAgainst <= 0 check to IsvalidAgainst for Warhead. 2014-08-16 10:58:03 +02:00
UberWaffe
390ca380bd Fixed Warhead ValidTargets and InvalidTargets. 2014-08-16 10:58:02 +02:00
UberWaffe
c972b39687 Custom Warheads refactor
Changes included:

Warhead code split out of weapon code and refactored.
Warhead functionality now split into several classes, each handling one effect/impact.

Additional custom warheads can now be defined and called via yaml.
Custom warheads inherit the abstract class Warhead,
which provides target check functions.

Custom warheads have to define their own impact functions,
and can also define their own replacement for check
functions.
2014-08-03 17:10:44 +02:00
reaperrr
eb96b72878 Add MaxSpread to Warhead to allow setting a specific area of effect. 2014-07-12 12:14:56 +02:00
reaperrr
fabca5dca6 Move ProneDamage modifier from TakeCover to Warhead.
Rename it to ProneModifier and convert it to integer.
2014-07-08 21:05:42 +02:00
Paul Chote
9487f49cd5 Replace WPos.ToCPos -> Map.CellContaining. 2014-06-27 23:30:40 +12:00
Paul Chote
5560f276ca Map: Rename IsInMap -> Contains. 2014-06-27 22:07:03 +12:00
Matthias Mailänder
e607c04cce let harvester splatter resources when exploding
closes #2346
2014-06-20 11:11:31 +02:00
Matthias Mailänder
3e627d2eba rename ore to the more generic name resources everywhere 2014-06-20 11:11:31 +02:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
Pavlos Touboulidis
c282fa1077 Move GetTerrainIndex/Info from WorldUtils to Map 2014-06-13 13:57:32 +03:00
Paul Chote
f6f366c4b3 Merge pull request #5401 from RoosterDragon/nodesdict
Changed MiniYaml.NodesDict property into a method.
2014-06-12 17:34:59 +12:00
Paul Chote
e347cdfb32 Merge pull request #5410 from RoosterDragon/IDisposable
Disposable fixup
2014-06-11 10:55:44 +12:00
RoosterDragon
a598a01108 Fixed IDisposable implementation and usage.
- Implement IDisposable interface correctly, with sealed classes where possible for simplicity.
- Add using statement around undisposed local variables.
2014-06-10 11:23:55 +01:00
RoosterDragon
e63f330717 Improved efficiency of startup methods.
- ShpReader will copy the input stream into memory just once rather than for every header.
- ShpReader.CopyImageData switched to use Array.Copy since that uses some unsafe magic for speed.
- In ActorInfo, cache a GetType call and prevent needless materialization in PrerequisitesOf.
- In ObjectCreator, cache type and ctor lookups since these are expensive and often repeated.
- Implement IReadOnlyDictionary<T, U> on Cache<T, U> to provide some supplementary functions.
- In TechTree.GatherOwnedPrerequisites, rearrange a Boolean 'and' expression to evaluate expensive functions later in the chain, and use ContainsKey to speed up name check.
2014-06-09 17:13:01 +01:00
RoosterDragon
2e992a7310 Changed MiniYaml.NodesDict property into a method.
Method is now called ToDictionary.
- Cached a few invocations into locals which should prevent some redundant evaluation.
- Added ToDictionary overloads that take projection functions for the keys and elements, since several callsites were doing a subsequent Linq.ToDictionary call to get this.
2014-06-09 17:06:42 +01:00
RoosterDragon
0c8bdff5be Formatting fixes.
Spaces to tabs, indents, etc.
2014-05-26 18:10:59 +01:00
Pavlos Touboulidis
f651cb3677 Final style & rebase fixes 2014-05-17 14:34:52 +03:00
Pavlos Touboulidis
ca44be7b2e Only update the loading screen from the main thread
Fixes the crash experienced by pchote. It's a hack but it's easy
to get rid of and it will have to do for now, until the messy
LoadScreen gets fixed.
2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
a845947e0f Minor style & nit fixes 2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
894db95d58 Move Ruleset.cs from Map/ to GameRules/ 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
44c01bbaa2 Remove TileSetData and separate TileSet from Sequences 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
750fc4e02c Merge ModRuleset and MapRuleset into Ruleset 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Pavlos Touboulidis
c68427eaa6 Less aggressive rules caching
ActorInfo instances depend on the whole set of ActorInfos
2014-05-17 14:26:54 +03:00
Pavlos Touboulidis
2b3d5f1544 Better caching for Rules and Sequences
Refactored the Rules and SequenceProvider classes to be parts of ModData and
maintain a cache of the instances used in the mod.

The caching reduced the load times a lot, especially after the first load.
Some lazy loading in sequences also helped lower the startup time..

Note: The static classes were left behind to redirect the existing code's
calls.
2014-05-17 14:26:53 +03:00
reaperrr
98e48ae991 Converts InfDeath from integer to string.
Wire up updated DeathSounds for all mods.
2014-05-14 15:24:06 +02:00
Matthias Mailänder
f19fbb1794 StyleCop 2014-04-20 15:26:33 +02:00