Skip to content

Commit

Permalink
Showing 5 changed files with 18 additions and 15 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
Binary file modified GameData/RP-0/Plugins/RP0KCTBinder.dll
Binary file not shown.
15 changes: 9 additions & 6 deletions Source/Crew/ActiveCourse.cs
Original file line number Diff line number Diff line change
@@ -87,9 +87,9 @@ public bool MeetsStudentReqs(ProtoCrewMember student)

int needCount = pCount;

for (int entryIdx = student.flightLog.Count; entryIdx-- > 0 && (needCount > 0 || cCount > 0);)
for (int entryIdx = student.careerLog.Count; entryIdx-- > 0 && (needCount > 0 || cCount > 0);)
{
FlightLog.Entry e = student.flightLog.Entries[entryIdx];
FlightLog.Entry e = student.careerLog.Entries[entryIdx];

for (int preIdx = pCount; preIdx-- > 0 && needCount > 0;)
{
@@ -169,12 +169,11 @@ public void CompleteCourse()
if (student == null)
continue;

if (rewardXP != 0)
student.ExtraExperience += rewardXP;

if (RewardLog != null)
{
student.flightLog.AddFlight();
if (student.flightLog.Count > 0)
student.ArchiveFlightLog();

CrewHandler.TrainingExpiration exp = null;
if (expiration > 0d)
{
@@ -192,13 +191,17 @@ public void CompleteCourse()
{
string[] s = v.value.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
student.flightLog.AddEntry(s[0], s.Length == 1 ? null : s[1]);
student.ArchiveFlightLog();
if (expiration > 0d)
exp.entries.Add(v.value);
}

if (expiration > 0d)
CrewHandler.Instance.AddExpiration(exp);
}

if (rewardXP != 0)
student.ExtraExperience += rewardXP;
}
}

12 changes: 6 additions & 6 deletions Source/Crew/CrewHandler.cs
Original file line number Diff line number Diff line change
@@ -330,12 +330,12 @@ public void Update()
ProtoCrewMember pcm = HighLogic.CurrentGame.CrewRoster[e.pcmName];
if (pcm != null)
{
for (int j = pcm.flightLog.Entries.Count; j-- > 0;)
for (int j = pcm.careerLog.Entries.Count; j-- > 0;)
{
int eC = e.entries.Count;
if (eC == 0)
break;
FlightLog.Entry ent = pcm.flightLog[j];
FlightLog.Entry ent = pcm.careerLog[j];
for (int k = eC; k-- > 0;)
{
if (e.Compare(k, ent))
@@ -496,8 +496,8 @@ protected void VesselRecoveryRequested(Vessel v)
bool hasOther = false;
bool hasOrbitOther = false;
bool hasLandOther = false;
int curFlight = pcm.flightLog.Last().flight;
foreach (FlightLog.Entry e in pcm.flightLog.Entries)
int curFlight = pcm.careerLog.Last().flight;
foreach (FlightLog.Entry e in pcm.careerLog.Entries)
{
if (e.flight != curFlight)
continue;
@@ -665,8 +665,8 @@ protected string GetTrainingString(ProtoCrewMember pcm)
HashSet<string> expiredProfs = new HashSet<string>();
bool found = false;
string trainingStr = "\n\nTraining:";
int lastFlight = pcm.flightLog.Last() == null ? 0 : pcm.flightLog.Last().flight;
foreach (FlightLog.Entry ent in pcm.flightLog.Entries)
int lastFlight = pcm.careerLog.Last() == null ? 0 : pcm.careerLog.Last().flight;
foreach (FlightLog.Entry ent in pcm.careerLog.Entries)
{
string pretty = GetPrettyCourseName(ent.type);
if (!string.IsNullOrEmpty(pretty))
6 changes: 3 additions & 3 deletions Source/KCTBinderModule.cs
Original file line number Diff line number Diff line change
@@ -39,15 +39,15 @@ public static bool CheckCrewForPart(ProtoCrewMember pcm, string partName)

partName = Crew.TrainingDatabase.SynonymReplace(partName);

FlightLog.Entry ent = pcm.flightLog.Last();
FlightLog.Entry ent = pcm.careerLog.Last();
if (ent == null)
return false;

int lastFlight = ent.flight;
bool lacksMission = true;
for (int i = pcm.flightLog.Entries.Count; i-- > 0;)
for (int i = pcm.careerLog.Entries.Count; i-- > 0;)
{
FlightLog.Entry e = pcm.flightLog.Entries[i];
FlightLog.Entry e = pcm.careerLog.Entries[i];
if (lacksMission)
{
if (e.flight < lastFlight)

0 comments on commit d1101eb

Please sign in to comment.