Skip to content

Commit

Permalink
Showing 4 changed files with 75 additions and 0 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
51 changes: 51 additions & 0 deletions Source/Crew/CrewHandler.cs
Original file line number Diff line number Diff line change
@@ -639,8 +639,55 @@ protected void FixTooltip(KSP.UI.CrewListItem cli)
cli.SetTooltip(pcm);
KSP.UI.TooltipTypes.TooltipController_CrewAC ttc = cliTooltip.GetValue(cli) as KSP.UI.TooltipTypes.TooltipController_CrewAC;
ttc.descriptionString += "\n\nRetires no earlier than " + KSPUtil.PrintDate(retTime, false);

// Training
HashSet<string> expiredProfs = new HashSet<string>();
bool found = false;
string trainingStr = "\n\nTraining:";
foreach (FlightLog.Entry ent in pcm.flightLog.Entries)
{
string pretty = GetPrettyCourseName(ent.type);
if (!string.IsNullOrEmpty(pretty))
{
found = true;

if (ent.type == "expired_TRAINING_proficiency")
expiredProfs.Add(ent.target);
else
{
trainingStr += "\n " + pretty + ent.target;
double exp = GetExpiration(pcm.name, ent);
if (exp > 0d)
trainingStr += ". Expires " + KSPUtil.PrintDate(exp, false);
}
}
}
if (expiredProfs.Count > 0)
trainingStr += "\n Expired proficiencies:";
foreach (string s in expiredProfs)
trainingStr += "\n " + s;

if (found)
ttc.descriptionString += trainingStr;
}
}
protected double GetExpiration(string pcmName, FlightLog.Entry ent)
{
for (int i = expireTimes.Count; i-- > 0;)
{
TrainingExpiration e = expireTimes[i];
if (e.pcmName == pcmName)
{
for (int j = e.entries.Count; j-- > 0;)
{
if (e.Compare(j, ent))
return e.expiration;
}
}
}

return 0d;
}

/* UI: display list of retirement NET dates. Called from MaintenanceWindow */
public void nautList()
@@ -784,8 +831,12 @@ protected string GetPrettyCourseName(string str)
{
case "TRAINING_proficiency":
return "Proficiency with ";
case "expired_TRAINING_proficiency":
return "(Expired) Proficiency with ";
case "TRAINING_mission":
return "Mission training for ";
/*case "expired_TRAINING_mission":
return "(Expired) Mission training for ";*/
default:
return string.Empty;
}
23 changes: 23 additions & 0 deletions Source/Crew/CrewHandlerData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KSP;
using UnityEngine;
using System.Reflection;

namespace RP0.Crew
{
public class CrewHandlerData : IConfigNode
{
public void Load(ConfigNode node)
{
throw new NotImplementedException();
}

public void Save(ConfigNode node)
{
throw new NotImplementedException();
}
}
}
1 change: 1 addition & 0 deletions Source/RP0.csproj
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@
<ItemGroup>
<Compile Include="Crew\ActiveCourse.cs" />
<Compile Include="Crew\CourseTemplate.cs" />
<Compile Include="Crew\CrewHandlerData.cs" />
<Compile Include="Crew\TrainingDatabase.cs" />
<Compile Include="Crew\FSGUI.cs" />
<Compile Include="EntryCostStorage.cs" />

0 comments on commit 249b4dd

Please sign in to comment.