Add: Show performance of AI and GS in framerate window

This commit is contained in:
Niels Martin Hansen
2019-02-04 01:26:55 +01:00
parent 4adb91202d
commit 7e1e2756d4
7 changed files with 187 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
#include "../company_func.h"
#include "../network/network.h"
#include "../window_func.h"
#include "../framerate_type.h"
#include "ai_scanner.hpp"
#include "ai_instance.hpp"
#include "ai_config.hpp"
@@ -79,8 +80,11 @@
const Company *c;
FOR_ALL_COMPANIES(c) {
if (c->is_ai) {
PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index));
cur_company.Change(c->index);
c->ai_instance->GameLoop();
} else {
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + c->index));
}
}
cur_company.Restore();
@@ -101,6 +105,7 @@
/* static */ void AI::Stop(CompanyID company)
{
if (_networking && !_network_server) return;
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + company));
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);