mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Eliminate last LINQ usage
This commit is contained in:
parent
0b7fb5899c
commit
7c57f76280
@ -16,8 +16,6 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using MCGalaxy.Network;
|
using MCGalaxy.Network;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace MCGalaxy.Commands.Chatting {
|
namespace MCGalaxy.Commands.Chatting {
|
||||||
public sealed class CmdClear : Command {
|
public sealed class CmdClear : Command {
|
||||||
|
@ -21,12 +21,13 @@ using System.IO;
|
|||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
|
|
||||||
public delegate void LineProcessor<T>(string key, string value, ref T state);
|
public delegate void LineProcessor<T>(string key, string value, ref T state);
|
||||||
|
public delegate void SimpleLineProcessor(string key, string value);
|
||||||
|
|
||||||
/// <summary> Handles text files that have multiple key-value lines in the format 'key=value'.
|
/// <summary> Handles text files that have multiple key-value lines in the format 'key=value'.
|
||||||
/// Also supports # for commented lines. </summary>
|
/// Also supports # for commented lines. </summary>
|
||||||
public static class PropertiesFile {
|
public static class PropertiesFile {
|
||||||
|
|
||||||
public static bool Read(string path, Action<string, string> processor,
|
public static bool Read(string path, SimpleLineProcessor processor,
|
||||||
char separator = '=', bool trimValue = true) {
|
char separator = '=', bool trimValue = true) {
|
||||||
object obj = null;
|
object obj = null;
|
||||||
LineProcessor<object> del = (string key, string value, ref object state) => { processor(key, value); };
|
LineProcessor<object> del = (string key, string value, ref object state) => { processor(key, value); };
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Part of fCraft | Copyright 2009-2015 Matvei Stefarov <me@matvei.org> | BSD-3 | See LICENSE.txt
|
// Part of fCraft | Copyright 2009-2015 Matvei Stefarov <me@matvei.org> | BSD-3 | See LICENSE.txt
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using MCGalaxy.Commands;
|
using MCGalaxy.Commands;
|
||||||
|
|
||||||
namespace MCGalaxy.Generator {
|
namespace MCGalaxy.Generator {
|
||||||
@ -98,7 +97,9 @@ namespace MCGalaxy.Generator {
|
|||||||
float midpoint = (args.MidPoint * args.Bias);
|
float midpoint = (args.MidPoint * args.Bias);
|
||||||
|
|
||||||
// shuffle corners
|
// shuffle corners
|
||||||
corners = corners.OrderBy( r => rand.Next() ).ToArray();
|
int[] keys = new int[corners.Length];
|
||||||
|
for (int i = 0; i < corners.Length; i++) { keys[i] = rand.Next(); }
|
||||||
|
Array.Sort(keys, corners);
|
||||||
|
|
||||||
// overlay the bias
|
// overlay the bias
|
||||||
Noise.ApplyBias( heightmap, corners[0], corners[1], corners[2], corners[3], midpoint );
|
Noise.ApplyBias( heightmap, corners[0], corners[1], corners[2], corners[3], midpoint );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user