PlaytimeStats: hey look a commit by me

switch from Minutes to Day/Hours in topplaytime display
This commit is contained in:
Dogan 2019-12-29 14:48:47 +01:00
parent a2e4176b4a
commit 3a3d649b63

View File

@ -163,7 +163,7 @@ public void SQL_OnQueryCompletedTime(Database db, DBResultSet results, const cha
}
char sTime[64];
int iDays = (iTime/ 86400);
int iDays = (iTime / 86400);
int iHours = (iTime / 3600) % 24;
int iMinutes = (iTime / 60) % 60;
int iSeconds = (iTime % 60);
@ -214,7 +214,10 @@ public void SQL_OnQueryCompletedTopTime(Database db, DBResultSet results, const
char sName[12][32];
int iTime[12];
char sBuffer[12][128];
int iDays[12];
int iHours[12];
char sTime[12][32];
char sBuffer[12][256];
Panel mSayPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
@ -235,12 +238,17 @@ public void SQL_OnQueryCompletedTopTime(Database db, DBResultSet results, const
results.FieldNameToNum("name", iFieldNum);
results.FetchString(iFieldNum, sName[i - 1], 32);
results.FieldNameToNum("time", iFieldNum);
iTime[i - 1] = results.FetchInt(iFieldNum);
iTime[i - 1] = iTime[i - 1] / 60;
iDays[i - 1] = (iTime[i - 1] / 86400);
iHours[i - 1] = (iTime[i - 1] / 3600) % 24;
Format(sBuffer[i - 1], 128, "%d. %s - %d Minutes", i, sName[i - 1], iTime[i - 1]);
if (iDays[i - 1])
Format(sTime[i - 1], 32, "%d Days %d Hours", iDays[i - 1], iHours[i - 1]);
else if (iHours[i - 1])
Format(sTime[i - 1], 32, "%d Hours", iHours[i - 1]);
Format(sBuffer[i - 1], 128, "%d. %s - %s", i, sName[i - 1], sTime[i - 1]);
mSayPanel.DrawText(sBuffer[i - 1]);
}