summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-02-04 01:26:55 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-02-23 14:29:07 +0100
commit7e1e2756d4fdbd9c2fb3508b4213de8dc855f21c (patch)
tree15e4f7b212bafdd3e83653aca1a465a5f6f4461b /src/ai
parent4adb91202d7c0118b52daeab2c4e6b040b30e4a9 (diff)
downloadopenttd-7e1e2756d4fdbd9c2fb3508b4213de8dc855f21c.tar.xz
Add: Show performance of AI and GS in framerate window
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_core.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp
index d4ff23311..51522edaf 100644
--- a/src/ai/ai_core.cpp
+++ b/src/ai/ai_core.cpp
@@ -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);