b7e0ed9b870b9241473b3099a7585a52d9894c2e
When handling the Nodes collection in MiniYaml, individual nodes are located via one of two methods:
// Lookup a single key with linear search.
var node = yaml.Nodes.FirstOrDefault(n => n.Key == "SomeKey");
// Convert to dictionary, expecting many key lookups.
var dict = nodes.ToDictionary();
// Lookup a single key in the dictionary.
var node = dict["SomeKey"];
To simplify lookup of individual keys via linear search, provide helper methods NodeWithKeyOrDefault and NodeWithKey. These helpers do the equivalent of Single{OrDefault} searches. Whilst this requires checking the whole list, it provides a useful correctness check. Two duplicated keys in TS yaml are fixed as a result. We can also optimize the helpers to not use LINQ, avoiding allocation of the delegate to search for a key.
Adjust existing code to use either lnear searches or dictionary lookups based on whether it will be resolving many keys. Resolving few keys can be done with linear searches to avoid building a dictionary. Resolving many keys should be done with a dictionary to avoid quaradtic runtime from repeated linear searches.
…
OpenRA
A Libre/Free Real Time Strategy game engine supporting early Westwood classics.
- Website: https://www.openra.net
- Chat: #openra on Libera (web) or Discord

- Repository: https://github.com/OpenRA/OpenRA
Please read the FAQ in our Wiki and report problems at https://github.com/OpenRA/OpenRA/issues.
Join the Forum for discussion.
Play
Distributed mods include a reimagining of
- Command & Conquer: Red Alert
- Command & Conquer: Tiberian Dawn
- Dune 2000
EA has not endorsed and does not support this product.
Check our Playing the Game Guide to win multiplayer matches.
Contribute
- Please read INSTALL.md and Compiling on how to set up an OpenRA development environment.
- See Hacking for a (now very outdated) overview of the engine.
- Read and follow our Code of Conduct.
- To get your patches merged, please adhere to the Contributing guidelines.
Mapping
- We offer a Mapping Tutorial as you can change gameplay drastically with custom rules.
- For scripted mission have a look at the Lua API.
- If you want to share your maps with the community, upload them at the OpenRA Resource Center.
Modding
- Download a copy of the OpenRA Mod SDK to start your own mod.
- Check the Modding Guide to create your own classic RTS.
- There exists an auto-generated Trait documentation to get started with yaml files.
- Some hints on how to create new OpenRA compatible Pixelart.
- Upload total conversions at our Mod DB profile.
Support
- Sponsor a mirror server if you have some bandwidth to spare.
- You can immediately set up a Dedicated Game Server.
License
Copyright (c) OpenRA Developers and Contributors This file is part of OpenRA, which is free software. It is made available to you under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For more information, see COPYING.
Description
Languages
C#
79.3%
Lua
16%
Fluent
3.1%
Shell
0.6%
Objective-C
0.2%
Other
0.5%