-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.c
30 lines (25 loc) · 904 Bytes
/
save.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "save.h"
saveData loadSaveData(int playerID){
saveData read;
read.name[0] = (char) LoadStorageValue(playerID + CHAR0);
read.name[1] = (char) LoadStorageValue(playerID + CHAR1);
read.name[2] = (char) LoadStorageValue(playerID + CHAR1);
read.score = LoadStorageValue(playerID + SCOREPOS);
return read;
}
void loadScoreboard(saveData scoreboard[]){
for (int i = 0; i < scoreboardSize; i++){
scoreboard[i] = loadSaveData(i);
}
}
void writeSaveData(int playerID, saveData data){
SaveStorageValue(playerID + CHAR0, (int) data.name[0]);
SaveStorageValue(playerID + CHAR1, (int) data.name[1]);
SaveStorageValue(playerID + CHAR2, (int) data.name[2]);
SaveStorageValue(playerID + SCOREPOS, data.score);
}
void writeScoreboard(saveData scoreboard[]){
for (int i = 0; i < scoreboardSize; i++){
writeSaveData(i, scoreboard[i]);
}
}