New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map loading fixes #29

Merged
merged 1 commit into from Jan 2, 2018

Conversation

Projects
None yet
2 participants
@paavohuhtala
Collaborator

paavohuhtala commented Jan 2, 2018

Fixes #22, fixes #27.

Fixes a number of campaign maps. Every map in the China campaign loads except for CHI03.

  • Check if the coordinate is within bounds in HeightMap.GetHeight, return 0 if not.
  • Parse wayPointPathLabel properties and store them in Settings.Waypoints.
  • Implement WaypointPathCollection which allows looking up WaypointPaths by their first node and their label.
  • Fix MoveCameraAlongWaypointPathAction.
  • As a bonus, add two self-explanatory LINQ extensions: WhereNot and ToSet. Not absolutely necessary, but I though they'd be useful.
@@ -111,7 +112,7 @@ private static string GetRegistryValue(string keyName, string valueName)
private IEnumerable<string> GetValidPaths(IEnumerable<string> paths)
{
return paths
.Where(p => !string.IsNullOrWhiteSpace(p))
.WhereNot(string.IsNullOrWhiteSpace)

This comment has been minimized.

@tgjones

tgjones Jan 2, 2018

Collaborator

It's subjective, but to me this isn't as clear as the original code - probably just because I'm very used to seeing Where and I'm not used to seeing WhereNot.

This comment has been minimized.

@paavohuhtala

paavohuhtala Jan 2, 2018

Collaborator

Yeah, it's definitely subjective. I prefer avoiding lambdas (which is pretty difficult in C#) when not necessary, and in my opinion ! is easier to miss than not.

There are options, of course. I did consider using the name Reject instead, as it's used in many JS FP libraries such as Lodash and Ramda. LISPs including Clojure and Emacs LISP call itremove.

@tgjones tgjones merged commit 81f3ccf into OpenSAGE:master Jan 2, 2018

@tgjones

This comment has been minimized.

Collaborator

tgjones commented Jan 2, 2018

This is fantastic, thank you!

@tgjones tgjones added this to the v0.1.0 milestone Apr 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment