Browse Source

refactoring: Die Variable an die Konvention angepasst

main
fdai7103 2 years ago
parent
commit
0e70d5da9f
  1. BIN
      build/artifacts/release/Paper-Bin.out
  2. BIN
      build/release/Paper-Bin.out
  3. BIN
      build/release/out/c/Paper-Bin.o
  4. 18
      src/Paper-Bin.c

BIN
build/artifacts/release/Paper-Bin.out

BIN
build/release/Paper-Bin.out

BIN
build/release/out/c/Paper-Bin.o

18
src/Paper-Bin.c

@ -47,7 +47,7 @@ struct Player
{
char Name[50];
int Points;
} playerlist[11];
} playerList[11];
//Methode die den Eimer erstellt
void buildBin(int width, int heigth)
@ -332,12 +332,12 @@ void sortScoreboard()
for (int j = 0; fgets(line, sizeof line, file) != NULL && j <= 10; j++)
{
char* playerTmp = strtok(line, " ");
strcpy(playerlist[j].Name, playerTmp);
strcpy(playerList[j].Name, playerTmp);
playerTmp = strtok(NULL, " ");
int playerPoints = atoi(playerTmp);
playerlist[j].Points = playerPoints;
playerList[j].Points = playerPoints;
numberOfLines = j;
sleep(0.1);
@ -349,11 +349,11 @@ void sortScoreboard()
{
for (int j = 0; j < (numberOfLines - i); j++)
{
if (playerlist[i].Points < playerlist[i + 1].Points)
if (playerList[i].Points < playerList[i + 1].Points)
{
tmp = playerlist[i];
playerlist[i] = playerlist[i + 1];
playerlist[i + 1] = tmp;
tmp = playerList[i];
playerList[i] = playerList[i + 1];
playerList[i + 1] = tmp;
}
}
}
@ -363,7 +363,7 @@ void sortScoreboard()
printf(" Scoreboard:\n\n");
for (int j = 0; j < numberOfLines; j++)
{
printf("%d. %s %s %d\n", j + 1, (j < 9) ? " " : " ", playerlist[j].Name, playerlist[j].Points);
printf("%d. %s %s %d\n", j + 1, (j < 9) ? " " : " ", playerList[j].Name, playerList[j].Points);
sleep(0.5);
}
@ -371,7 +371,7 @@ void sortScoreboard()
FILE* fp = fopen("ScoreBoard.txt", "w");
for (int i = 0; i < numberOfLines; i++)
{
fprintf(fp, "%s %d\n", playerlist[i].Name, playerlist[i].Points);
fprintf(fp, "%s %d\n", playerList[i].Name, playerList[i].Points);
}
fclose(fp);

Loading…
Cancel
Save