Skip to content

Commit

Permalink
Destination Evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
founderio committed Feb 1, 2015
1 parent 0c5396a commit 2077859
Show file tree
Hide file tree
Showing 14 changed files with 868 additions and 9 deletions.
2 changes: 1 addition & 1 deletion EDRoutePlanner/CmdrsLogStationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void reloadStations(Data data)
{
CmdrsLogDataReader.Section stationSection = systemSection.subsections[station];

StationData stationData = new StationData(station);
StationData stationData = new StationData(system, station);
sysData.stations[station] = stationData;
stationSection.dictionary.TryGetValue("economy", out stationData.economy);
stationSection.dictionary.TryGetValue("government", out stationData.government);
Expand Down
39 changes: 37 additions & 2 deletions EDRoutePlanner/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ public StationData GetStation(string system, string station)
return systemData.GetStation(station);
}
}

public List<StationData> Stations
{
get
{
List<StationData> stations = new List<StationData>();
foreach(SystemData system in systems.Values) {
stations.AddRange(system.stations.Values);
}
return stations;
}
}
}

public class SystemData
Expand All @@ -101,16 +113,18 @@ public StationData GetStation(string station)

public class StationData
{
public string system;
public string name;
public Dictionary<string, CommodityPrice> commodityData;
public string economy;
public string government;
public string faction;

public StationData() : this("") { }
public StationData() : this("", "") { }

public StationData(string name)
public StationData(string system, string name)
{
this.system = system;
this.name = name;
this.commodityData = new Dictionary<string, CommodityPrice>();
}
Expand All @@ -121,6 +135,27 @@ public CommodityPrice GetPrice(string commodity)
commodityData.TryGetValue(commodity, out price);
return price;
}

public override bool Equals(object obj)
{
// Just to be sure, we will have the Equals method here.

StationData other = obj as StationData;
if (obj == null)
{
return false;
}
if (this.system != other.system)
{
return false;
}
if (this.name != other.name)
{
return false;
}
// Disregards prices & other data as the *should* not change.
return true;
}
}

public class CommodityPrice
Expand Down
20 changes: 20 additions & 0 deletions EDRoutePlanner/Destination.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,25 @@ public Destination()
{
transactions = new List<Transaction>();
}

public Destination(string system, string station): this()
{
this.system = system;
this.station = station;
}

public Destination(StationData station)
: this()
{
this.system = station.system;
this.station = station.name;
}

public Destination(Destination destination)
: this()
{
this.system = destination.system;
this.station = destination.station;
}
}
}
20 changes: 20 additions & 0 deletions EDRoutePlanner/EDRoutePlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
</Compile>
<Compile Include="Destination.cs" />
<Compile Include="CmdrsLogStationData.cs" />
<Compile Include="EvaluateDestinationControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="EvaluateDestinationControl.Designer.cs">
<DependentUpon>EvaluateDestinationControl.cs</DependentUpon>
</Compile>
<Compile Include="EvaluateDestinationForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EvaluateDestinationForm.Designer.cs">
<DependentUpon>EvaluateDestinationForm.cs</DependentUpon>
</Compile>
<Compile Include="MainScreen.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -101,6 +113,14 @@
<DependentUpon>DefaultsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="EvaluateDestinationControl.resx">
<DependentUpon>EvaluateDestinationControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="EvaluateDestinationForm.resx">
<DependentUpon>EvaluateDestinationForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MainScreen.resx">
<DependentUpon>MainScreen.cs</DependentUpon>
<SubType>Designer</SubType>
Expand Down
191 changes: 191 additions & 0 deletions EDRoutePlanner/EvaluateDestinationControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2077859

Please sign in to comment.