Waypoint.cs (1977B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // The Command & Conquer Map Editor and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // The Command & Conquer Map Editor and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 using MobiusEditor.Interface; 16 using System; 17 18 namespace MobiusEditor.Model 19 { 20 public enum WaypointFlag 21 { 22 None, 23 PlayerStart 24 } 25 26 public class Waypoint : INamedType 27 { 28 public string Name { get; private set; } 29 30 public WaypointFlag Flag { get; private set; } 31 32 public int? Cell { get; set; } 33 34 public Waypoint(string name, WaypointFlag flag) 35 { 36 Name = name; 37 Flag = flag; 38 } 39 40 public Waypoint(string name) 41 : this(name, WaypointFlag.None) 42 { 43 } 44 45 public override bool Equals(object obj) 46 { 47 if (obj is Waypoint) 48 { 49 return this == obj; 50 } 51 else if (obj is string) 52 { 53 return string.Equals(Name, obj as string, StringComparison.OrdinalIgnoreCase); 54 } 55 56 return base.Equals(obj); 57 } 58 59 public override int GetHashCode() 60 { 61 return Name.GetHashCode(); 62 } 63 64 public override string ToString() 65 { 66 return Name; 67 } 68 } 69 }