mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -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.
|
||||
*/
|
||||
using MCGalaxy.Network;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
namespace MCGalaxy.Commands.Chatting {
|
||||
public sealed class CmdClear : Command {
|
||||
|
@ -21,12 +21,13 @@ using System.IO;
|
||||
namespace MCGalaxy {
|
||||
|
||||
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'.
|
||||
/// Also supports # for commented lines. </summary>
|
||||
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) {
|
||||
object obj = null;
|
||||
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
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MCGalaxy.Commands;
|
||||
|
||||
namespace MCGalaxy.Generator {
|
||||
@ -98,7 +97,9 @@ namespace MCGalaxy.Generator {
|
||||
float midpoint = (args.MidPoint * args.Bias);
|
||||
|
||||
// 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
|
||||
Noise.ApplyBias( heightmap, corners[0], corners[1], corners[2], corners[3], midpoint );
|
||||
|
Loading…
x
Reference in New Issue
Block a user