- modified game time to be game duration instead as that is more useful for players who want to see in game clock info
This commit is contained in:
parent
a56eb83c91
commit
d8160c1065
|
@ -2271,12 +2271,14 @@ void Renderer::renderClock() {
|
|||
const Vec4f fontColor = game->getGui()->getDisplay()->getColor();
|
||||
|
||||
if(config.getBool("InGameClock","true") == true) {
|
||||
int hours = world->getTimeFlow()->getTime();
|
||||
int minutes = (world->getTimeFlow()->getTime() - hours) * 100 * 0.6; // scale 100 to 60
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[200]="";
|
||||
snprintf(szBuf,200,"%s %.2d:%.2d",lang.getString("GameTime","",true).c_str(),hours,minutes);
|
||||
char szBuf[501]="";
|
||||
|
||||
//int hours = world->getTimeFlow()->getTime();
|
||||
//int minutes = (world->getTimeFlow()->getTime() - hours) * 100 * 0.6; // scale 100 to 60
|
||||
//snprintf(szBuf,200,"%s %.2d:%.2d",lang.getString("GameTime","",true).c_str(),hours,minutes);
|
||||
// string header2 = lang.getString("GameDurationTime","",true) + ": " + getTimeString(stats.getFramesToCalculatePlaytime());
|
||||
snprintf(szBuf,500,"%s %s",lang.getString("GameDurationTime","",true).c_str(),getTimeDuationString(world->getFrameCount(),GameConstants::updateFps).c_str());
|
||||
if(str != "") {
|
||||
str += " ";
|
||||
}
|
||||
|
|
|
@ -347,27 +347,6 @@ void BattleEnd::initBackgroundVideo() {
|
|||
}
|
||||
}
|
||||
|
||||
const string BattleEnd::getTimeString(int frames) {
|
||||
int framesleft=frames;
|
||||
int hours=(int) frames / (float)GameConstants::updateFps / 3600.0;
|
||||
framesleft=framesleft-hours*3600*GameConstants::updateFps;
|
||||
int minutes=(int) framesleft / (float)GameConstants::updateFps / 60.0;
|
||||
framesleft=framesleft-minutes*60*GameConstants::updateFps;
|
||||
int seconds=(int) framesleft / (float)GameConstants::updateFps;
|
||||
//framesleft=framesleft-seconds*GameConstants::updateFps;
|
||||
|
||||
string hourstr=intToStr(hours);
|
||||
if(hours<10) hourstr="0"+hourstr;
|
||||
|
||||
string minutestr=intToStr(minutes);
|
||||
if(minutes<10) minutestr="0"+minutestr;
|
||||
|
||||
string secondstr=intToStr(seconds);
|
||||
if(seconds<10) secondstr="0"+secondstr;
|
||||
|
||||
return hourstr+":"+minutestr+":"+secondstr;
|
||||
}
|
||||
|
||||
void BattleEnd::update() {
|
||||
if(Config::getInstance().getBool("AutoTest")){
|
||||
AutoTest::getInstance().updateBattleEnd(program);
|
||||
|
@ -610,7 +589,7 @@ void BattleEnd::render() {
|
|||
if(stats.getPlayerName(i) != "") {
|
||||
string textToRender=stats.getPlayerName(i);
|
||||
if(stats.getPlayerLeftBeforeEnd(i)==true){
|
||||
textToRender+="\n("+getTimeString(stats.getTimePlayerLeft(i))+")";
|
||||
textToRender+="\n("+getTimeDuationString(stats.getTimePlayerLeft(i),GameConstants::updateFps) + ")";
|
||||
}
|
||||
|
||||
textRenderer->render(textToRender.c_str(), textX, bm+400, false, &color);
|
||||
|
@ -719,7 +698,7 @@ void BattleEnd::render() {
|
|||
//GameConstants::updateFps
|
||||
//string header2 = lang.getString("GameDurationTime","",true) + " " + floatToStr(stats.getWorldTimeElapsed() / 24.0,2);
|
||||
|
||||
string header2 = lang.getString("GameDurationTime","",true) + ": " + getTimeString(stats.getFramesToCalculatePlaytime());
|
||||
string header2 = lang.getString("GameDurationTime","",true) + ": " + getTimeDuationString(stats.getFramesToCalculatePlaytime(),GameConstants::updateFps);
|
||||
textRenderer->render(header2, lm+250, bm+530);
|
||||
|
||||
header2 = lang.getString("GameMaxConcurrentUnitCount") + ": " + intToStr(stats.getMaxConcurrentUnitCount());
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
virtual void reloadUI();
|
||||
|
||||
private:
|
||||
const string getTimeString(int frames);
|
||||
|
||||
void initBackgroundVideo();
|
||||
std::pair<string,string> getBattleEndVideo(bool won);
|
||||
|
|
|
@ -43,6 +43,8 @@ bool IsNumeric(const char *p, bool allowNegative=true);
|
|||
|
||||
string formatNumber(uint64 f);
|
||||
|
||||
string getTimeDuationString(int frames, int updateFps);
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -215,4 +215,31 @@ string formatNumber(uint64 f) {
|
|||
return out.str();
|
||||
}
|
||||
|
||||
string getTimeDuationString(int frames, int updateFps) {
|
||||
int framesleft = frames;
|
||||
int hours = (int) frames / (float)updateFps / 3600.0;
|
||||
framesleft = framesleft - hours * 3600 * updateFps;
|
||||
int minutes = (int) framesleft / (float)updateFps / 60.0;
|
||||
framesleft = framesleft - minutes * 60 * updateFps;
|
||||
int seconds = (int) framesleft / (float)updateFps;
|
||||
//framesleft=framesleft-seconds*GameConstants::updateFps;
|
||||
|
||||
string hourstr = intToStr(hours);
|
||||
if(hours < 10) {
|
||||
hourstr = "0" + hourstr;
|
||||
}
|
||||
|
||||
string minutestr = intToStr(minutes);
|
||||
if(minutes < 10) {
|
||||
minutestr = "0" + minutestr;
|
||||
}
|
||||
|
||||
string secondstr = intToStr(seconds);
|
||||
if(seconds < 10) {
|
||||
secondstr = "0" + secondstr;
|
||||
}
|
||||
|
||||
return hourstr + ":" + minutestr + ":" + secondstr;
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
|
Loading…
Reference in New Issue