Skip to content

Commit

Permalink
Fix checkpoint counting for TM2020. (#1118) (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
skybaks committed Sep 15, 2022
1 parent 8295481 commit a127bb9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,27 +112,26 @@ Void ShowDiff() {
Sector_CPTime_Frame.Show();
}
Integer GetCPCount() {
declare Integer count;
declare Ident[][Integer] orders;

foreach(Landmark in MapLandmarks) {
if ( (Landmark.Waypoint != Null && (Landmark.Waypoint.IsFinish || Landmark.Waypoint.IsMultiLap)) || Landmark.Tag == "Spawn") {
continue;
}
if(orders.existskey(Landmark.Order)) {
orders[Landmark.Order].add(Landmark.MarkerId);
}
else {
orders[Landmark.Order] = [Landmark.MarkerId];
}
}
if(orders.count == 1 && orders.existskey(0)) { // No linked cp in the map
count = orders[0].count;
}
else {
count = orders.count;
}
return count + 1; // +1 for ending
declare Integer count = 0;
declare Ident[][Integer] orders;
foreach(Landmark in MapLandmarks) {
if ((Landmark.Waypoint != Null && (Landmark.Waypoint.IsFinish || Landmark.Waypoint.IsMultiLap)) || Landmark.Tag == "Spawn") {
continue;
}
if (Landmark.Tag == "LinkedCheckpoint") {
if(orders.existskey(Landmark.Order)) {
orders[Landmark.Order].add(Landmark.MarkerId);
}
else {
orders[Landmark.Order] = [Landmark.MarkerId];
}
}
else {
count += 1;
}
}
count += orders.count;
return count + 1; // +1 for ending
}
main() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,26 @@ Integer[] ParseCheckpoints(Text RawInput) {
}

Integer GetCPCount() {
declare Integer count;
declare Ident[][Integer] orders;

foreach(Landmark in MapLandmarks) {
if ( (Landmark.Waypoint != Null && (Landmark.Waypoint.IsFinish || Landmark.Waypoint.IsMultiLap)) || Landmark.Tag == "Spawn") {
continue;
}
if(orders.existskey(Landmark.Order)) {
orders[Landmark.Order].add(Landmark.MarkerId);
}
else {
orders[Landmark.Order] = [Landmark.MarkerId];
}
}
if(orders.count == 1 && orders.existskey(0)) { // No linked cp in the map
count = orders[0].count;
}
else {
count = orders.count;
}
return count + 1; // +1 for ending
declare Integer count = 0;
declare Ident[][Integer] orders;
foreach(Landmark in MapLandmarks) {
if ((Landmark.Waypoint != Null && (Landmark.Waypoint.IsFinish || Landmark.Waypoint.IsMultiLap)) || Landmark.Tag == "Spawn") {
continue;
}
if (Landmark.Tag == "LinkedCheckpoint") {
if(orders.existskey(Landmark.Order)) {
orders[Landmark.Order].add(Landmark.MarkerId);
}
else {
orders[Landmark.Order] = [Landmark.MarkerId];
}
}
else {
count += 1;
}
}
count += orders.count;
return count + 1; // +1 for ending
}
main() {
// Access the local + dedimania variables. TODO: Implement this in the local + dedi widgets.
Expand Down Expand Up @@ -176,9 +175,9 @@ main() {
if (GUIPlayer != Null){
declare wayPointTimesCount = GUIPlayer.RaceWaypointTimes.count;
declare Boolean IsSpectating = GUIPlayer != InputPlayer;
//New cp or reset
//New cp or reset
if (LastCpCount != wayPointTimesCount) {
//reset
//reset
if (wayPointTimesCount == 0) {
CurrentCheckpointScores = Integer[];
CurrentCheckpoint = 0;
Expand Down

0 comments on commit a127bb9

Please sign in to comment.