diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-02-04 01:26:55 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-02-23 14:29:07 +0100 |
commit | 7e1e2756d4fdbd9c2fb3508b4213de8dc855f21c (patch) | |
tree | 15e4f7b212bafdd3e83653aca1a465a5f6f4461b /src/ai | |
parent | 4adb91202d7c0118b52daeab2c4e6b040b30e4a9 (diff) | |
download | openttd-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.cpp | 5 |
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); |