Commit ff419a92fc9b1deff279573cbfc34b56f797a978

Authored by Imanol-Mikel Barba Sabariego
1 parent cf8d9372

Minor styling

Showing 1 changed file with 10 additions and 12 deletions
mcplayerstat.c
@@ -22,18 +22,19 @@ void printInventory(TagList *inv) { @@ -22,18 +22,19 @@ void printInventory(TagList *inv) {
22 } 22 }
23 } 23 }
24 24
  25 +/*
  26 + * int playerGameType
  27 + * int XpLevel
  28 + * list(compound) Inventory
  29 + * list(compound) EnderItems
  30 + * list(float) Pos
  31 + */
25 int parseMCPlayerFile(const char* filename) { 32 int parseMCPlayerFile(const char* filename) {
26 unsigned int pos = 0; 33 unsigned int pos = 0;
27 void* data; 34 void* data;
28 35
29 ssize_t dblen = loadDB(filename, &data); 36 ssize_t dblen = loadDB(filename, &data);
30 if(dblen > 0) { 37 if(dblen > 0) {
31 - // int playerGameType  
32 - // int XpLevel  
33 - // list(compound) Inventory  
34 - // list(compound) EnderItems  
35 - // list(float) Pos  
36 -  
37 Tag t; 38 Tag t;
38 pos = parseTag((data + pos),&t); 39 pos = parseTag((data + pos),&t);
39 if(pos != dblen) { 40 if(pos != dblen) {
@@ -50,7 +51,7 @@ int parseMCPlayerFile(const char* filename) { @@ -50,7 +51,7 @@ int parseMCPlayerFile(const char* filename) {
50 printf("playerGameType: %s\n",(playerGameType == 0 ? "Survival" : (playerGameType == 1 ? "Creative" : (playerGameType == 2 ? "Adventure" : (playerGameType == 3 ? "Spectator" : "UNKNOWN"))))); 51 printf("playerGameType: %s\n",(playerGameType == 0 ? "Survival" : (playerGameType == 1 ? "Creative" : (playerGameType == 2 ? "Adventure" : (playerGameType == 3 ? "Spectator" : "UNKNOWN")))));
51 } else if (!strncmp(node.name,"XpLevel",node.nameLength)) { 52 } else if (!strncmp(node.name,"XpLevel",node.nameLength)) {
52 int xpLevel = *((uint32_t*)node.payload); 53 int xpLevel = *((uint32_t*)node.payload);
53 - printf("XpLevel: %u\n",xpLevel); 54 + printf("XpLevel: %u\n",xpLevel);
54 } 55 }
55 } else if(node.type == TAG_LIST) { 56 } else if(node.type == TAG_LIST) {
56 TagList* l = (TagList*)node.payload; 57 TagList* l = (TagList*)node.payload;
@@ -73,10 +74,7 @@ int parseMCPlayerFile(const char* filename) { @@ -73,10 +74,7 @@ int parseMCPlayerFile(const char* filename) {
73 free(data); 74 free(data);
74 return 0; 75 return 0;
75 } 76 }
76 -  
77 -  
78 -  
79 - 77 + return -1;
80 } 78 }
81 79
82 int main(int argc, char** argv) { 80 int main(int argc, char** argv) {
@@ -86,4 +84,4 @@ int main(int argc, char** argv) { @@ -86,4 +84,4 @@ int main(int argc, char** argv) {
86 } 84 }
87 85
88 return parseMCPlayerFile(argv[1]); 86 return parseMCPlayerFile(argv[1]);
89 -}  
90 \ No newline at end of file 87 \ No newline at end of file
  88 +}