Files
@ r27117:45f96a40c92d
Branch filter:
Location: cpp/openttd-patchpack/source/src/ai/ai_core.cpp - annotation
r27117:45f96a40c92d
10.7 KiB
text/x-c
Update: Translations from eints
english (au): 1 change by krysclarke
german: 1 change by SecretIdetity
russian: 1 change by Ln-Wolf
finnish: 5 changes by hpiirai
slovak: 15 changes by legitalk
portuguese: 1 change by azulcosta
english (au): 1 change by krysclarke
german: 1 change by SecretIdetity
russian: 1 change by Ln-Wolf
finnish: 5 changes by hpiirai
slovak: 15 changes by legitalk
portuguese: 1 change by azulcosta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r15269:8b901e9e0694 r10990:c51128ad9005 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23351:74c208bc690a r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18510:9d33e9643f80 r18508:f893337ab5c7 r10696:8dfe83e30d01 r21383:942c32fb8b0e r21383:942c32fb8b0e r10696:8dfe83e30d01 r23607:36c15679007d r23607:36c15679007d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r14202:008944a6e34c r10696:8dfe83e30d01 r11919:363b629324b9 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r19209:9bc5f0b2cb37 r14202:008944a6e34c r23607:36c15679007d r18508:f893337ab5c7 r23607:36c15679007d r10696:8dfe83e30d01 r18510:9d33e9643f80 r10696:8dfe83e30d01 r20561:5c762b60c932 r10696:8dfe83e30d01 r23674:a5bafa1a02c5 r11917:612c11f7ab47 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r18363:f8c9df886df8 r18363:f8c9df886df8 r26699:573b113abb66 r26699:573b113abb66 r10696:8dfe83e30d01 r15283:1d7bf4fa5d0b r15283:1d7bf4fa5d0b r26856:c988753485d9 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23674:a5bafa1a02c5 r23953:ba75d2f3b530 r12138:e93d2e409e78 r23351:74c208bc690a r15269:8b901e9e0694 r10696:8dfe83e30d01 r26821:f087e11a25d0 r26821:f087e11a25d0 r26821:f087e11a25d0 r26821:f087e11a25d0 r26821:f087e11a25d0 r23351:74c208bc690a r23351:74c208bc690a r10696:8dfe83e30d01 r10696:8dfe83e30d01 r15269:8b901e9e0694 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23351:74c208bc690a r10696:8dfe83e30d01 r23674:a5bafa1a02c5 r11917:612c11f7ab47 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r23607:36c15679007d r10696:8dfe83e30d01 r15269:8b901e9e0694 r11061:463bb4ea5cb5 r26856:c988753485d9 r26856:c988753485d9 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r19606:13c83d3a505e r14931:fdc0797fe626 r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r14931:fdc0797fe626 r23674:a5bafa1a02c5 r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r23674:a5bafa1a02c5 r19606:13c83d3a505e r14931:fdc0797fe626 r15269:8b901e9e0694 r14931:fdc0797fe626 r14931:fdc0797fe626 r19606:13c83d3a505e r19606:13c83d3a505e r23674:a5bafa1a02c5 r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r19606:13c83d3a505e r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r11918:5a296c52d1a8 r10696:8dfe83e30d01 r23953:ba75d2f3b530 r12138:e93d2e409e78 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r18376:e66b27d1ff1d r18508:f893337ab5c7 r18666:f05d7caba088 r18508:f893337ab5c7 r18666:f05d7caba088 r18376:e66b27d1ff1d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18508:f893337ab5c7 r18508:f893337ab5c7 r23607:36c15679007d r23607:36c15679007d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r10696:8dfe83e30d01 r23607:36c15679007d r10696:8dfe83e30d01 r23607:36c15679007d r10696:8dfe83e30d01 r23607:36c15679007d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r19944:25a78576fb5e r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r17740:2bb5b782d39a r25655:1030dcb7eb52 r23607:36c15679007d r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r17740:2bb5b782d39a r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23607:36c15679007d r17740:2bb5b782d39a r25655:1030dcb7eb52 r23607:36c15679007d r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18501:8e3d905ea4bc r10696:8dfe83e30d01 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10696:8dfe83e30d01 r12138:e93d2e409e78 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10696:8dfe83e30d01 r23674:a5bafa1a02c5 r18363:f8c9df886df8 r15269:8b901e9e0694 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18501:8e3d905ea4bc r10696:8dfe83e30d01 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10926:a9348ddc3e9c r10926:a9348ddc3e9c r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r11944:3b8f9f948e8d r23607:36c15679007d r10696:8dfe83e30d01 r23674:a5bafa1a02c5 r11944:3b8f9f948e8d r15269:8b901e9e0694 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r26417:ef0c65a44f32 r10696:8dfe83e30d01 r26417:ef0c65a44f32 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r26417:ef0c65a44f32 r16957:b73e503c5e41 r26417:ef0c65a44f32 r16957:b73e503c5e41 r16957:b73e503c5e41 r18508:f893337ab5c7 r10696:8dfe83e30d01 r18508:f893337ab5c7 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18508:f893337ab5c7 r10840:7a608f4ad153 r18508:f893337ab5c7 r10840:7a608f4ad153 r10840:7a608f4ad153 r14377:f63ba65f9d57 r10696:8dfe83e30d01 r18508:f893337ab5c7 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18441:63bc631b2d9b r10696:8dfe83e30d01 r18508:f893337ab5c7 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r18376:e66b27d1ff1d r18376:e66b27d1ff1d r18508:f893337ab5c7 r18508:f893337ab5c7 r10696:8dfe83e30d01 r18010:b6dd345f9ae1 r26856:c988753485d9 r26856:c988753485d9 r26856:c988753485d9 r10696:8dfe83e30d01 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18508:f893337ab5c7 r18523:a4c9b378cb05 r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a r19556:51f34458ed8a | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_core.cpp Implementation of AI. */
#include "../stdafx.h"
#include "../core/backup_type.hpp"
#include "../core/bitmath_func.hpp"
#include "../company_base.h"
#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"
#include "ai_info.hpp"
#include "ai.hpp"
#include "../safeguards.h"
/* static */ uint AI::frame_counter = 0;
/* static */ AIScannerInfo *AI::scanner_info = nullptr;
/* static */ AIScannerLibrary *AI::scanner_library = nullptr;
/* static */ bool AI::CanStartNew()
{
/* Only allow new AIs on the server and only when that is allowed in multiplayer */
return !_networking || (_network_server && _settings_game.ai.ai_in_multiplayer);
}
/* static */ void AI::StartNew(CompanyID company, bool rerandomise_ai)
{
assert(Company::IsValidID(company));
/* Clients shouldn't start AIs */
if (_networking && !_network_server) return;
AIConfig *config = AIConfig::GetConfig(company, AIConfig::SSS_FORCE_GAME);
AIInfo *info = config->GetInfo();
if (info == nullptr || (rerandomise_ai && config->IsRandom())) {
info = AI::scanner_info->SelectRandomAI();
assert(info != nullptr);
/* Load default data and store the name in the settings */
config->Change(info->GetName(), -1, false, true);
}
config->AnchorUnchangeableSettings();
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
c->ai_info = info;
assert(c->ai_instance == nullptr);
c->ai_instance = new AIInstance();
c->ai_instance->Initialize(info);
c->ai_instance->LoadOnStack(config->GetToLoadData());
config->SetToLoadData(nullptr);
cur_company.Restore();
InvalidateWindowData(WC_SCRIPT_DEBUG, 0, -1);
return;
}
/* static */ void AI::GameLoop()
{
/* If we are in networking, only servers run this function, and that only if it is allowed */
if (_networking && (!_network_server || !_settings_game.ai.ai_in_multiplayer)) return;
/* The speed with which AIs go, is limited by the 'competitor_speed' */
AI::frame_counter++;
assert(_settings_game.difficulty.competitor_speed <= 4);
if ((AI::frame_counter & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return;
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
for (const Company *c : Company::Iterate()) {
if (c->is_ai) {
PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index));
cur_company.Change(c->index);
c->ai_instance->GameLoop();
/* Occasionally collect garbage; every 255 ticks do one company.
* Effectively collecting garbage once every two months per AI. */
if ((AI::frame_counter & 255) == 0 && (CompanyID)GB(AI::frame_counter, 8, 4) == c->index) {
c->ai_instance->CollectGarbage();
}
} else {
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + c->index));
}
}
cur_company.Restore();
}
/* static */ uint AI::GetTick()
{
return AI::frame_counter;
}
/* static */ void AI::Stop(CompanyID company)
{
if (_networking && !_network_server) return;
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + company));
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
delete c->ai_instance;
c->ai_instance = nullptr;
c->ai_info = nullptr;
cur_company.Restore();
InvalidateWindowData(WC_SCRIPT_DEBUG, 0, -1);
CloseWindowById(WC_SCRIPT_SETTINGS, company);
}
/* static */ void AI::Pause(CompanyID company)
{
/* The reason why dedicated servers are forbidden to execute this
* command is not because it is unsafe, but because there is no way
* for the server owner to unpause the script again. */
if (_network_dedicated) return;
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(company)->ai_instance->Pause();
cur_company.Restore();
}
/* static */ void AI::Unpause(CompanyID company)
{
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(company)->ai_instance->Unpause();
cur_company.Restore();
}
/* static */ bool AI::IsPaused(CompanyID company)
{
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
bool paused = Company::Get(company)->ai_instance->IsPaused();
cur_company.Restore();
return paused;
}
/* static */ void AI::KillAll()
{
/* It might happen there are no companies .. than we have nothing to loop */
if (Company::GetPoolSize() == 0) return;
for (const Company *c : Company::Iterate()) {
if (c->is_ai) AI::Stop(c->index);
}
}
/* static */ void AI::Initialize()
{
if (AI::scanner_info != nullptr) AI::Uninitialize(true);
AI::frame_counter = 0;
if (AI::scanner_info == nullptr) {
TarScanner::DoScan(TarScanner::AI);
AI::scanner_info = new AIScannerInfo();
AI::scanner_info->Initialize();
AI::scanner_library = new AIScannerLibrary();
AI::scanner_library->Initialize();
}
}
/* static */ void AI::Uninitialize(bool keepConfig)
{
AI::KillAll();
if (keepConfig) {
/* Run a rescan, which indexes all AIInfos again, and check if we can
* still load all the AIS, while keeping the configs in place */
Rescan();
} else {
delete AI::scanner_info;
delete AI::scanner_library;
AI::scanner_info = nullptr;
AI::scanner_library = nullptr;
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != nullptr) {
delete _settings_game.ai_config[c];
_settings_game.ai_config[c] = nullptr;
}
if (_settings_newgame.ai_config[c] != nullptr) {
delete _settings_newgame.ai_config[c];
_settings_newgame.ai_config[c] = nullptr;
}
}
}
}
/* static */ void AI::ResetConfig()
{
/* Check for both newgame as current game if we can reload the AIInfo inside
* the AIConfig. If not, remove the AI from the list (which will assign
* a random new AI on reload). */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != nullptr && _settings_game.ai_config[c]->HasScript()) {
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
_settings_game.ai_config[c]->Change(nullptr);
if (Company::IsValidAiID(c)) {
/* The code belonging to an already running AI was deleted. We can only do
* one thing here to keep everything sane and that is kill the AI. After
* killing the offending AI we start a random other one in it's place, just
* like what would happen if the AI was missing during loading. */
AI::Stop(c);
AI::StartNew(c, false);
}
} else if (Company::IsValidAiID(c)) {
/* Update the reference in the Company struct. */
Company::Get(c)->ai_info = _settings_game.ai_config[c]->GetInfo();
}
}
if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
_settings_newgame.ai_config[c]->Change(nullptr);
}
}
}
}
/* static */ void AI::NewEvent(CompanyID company, ScriptEvent *event)
{
/* AddRef() and Release() need to be called at least once, so do it here */
event->AddRef();
/* Clients should ignore events */
if (_networking && !_network_server) {
event->Release();
return;
}
/* Only AIs can have an event-queue */
if (!Company::IsValidAiID(company)) {
event->Release();
return;
}
/* Queue the event */
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(_current_company)->ai_instance->InsertEvent(event);
cur_company.Restore();
event->Release();
}
/* static */ void AI::BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company)
{
/* AddRef() and Release() need to be called at least once, so do it here */
event->AddRef();
/* Clients should ignore events */
if (_networking && !_network_server) {
event->Release();
return;
}
/* Try to send the event to all AIs */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (c != skip_company) AI::NewEvent(c, event);
}
event->Release();
}
/* static */ void AI::Save(CompanyID company)
{
if (!_networking || _network_server) {
Company *c = Company::GetIfValid(company);
assert(c != nullptr && c->ai_instance != nullptr);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
c->ai_instance->Save();
cur_company.Restore();
} else {
AIInstance::SaveEmpty();
}
}
/* static */ std::string AI::GetConsoleList(bool newest_only)
{
return AI::scanner_info->GetConsoleList(newest_only);
}
/* static */ std::string AI::GetConsoleLibraryList()
{
return AI::scanner_library->GetConsoleList(true);
}
/* static */ const ScriptInfoList *AI::GetInfoList()
{
return AI::scanner_info->GetInfoList();
}
/* static */ const ScriptInfoList *AI::GetUniqueInfoList()
{
return AI::scanner_info->GetUniqueInfoList();
}
/* static */ AIInfo *AI::FindInfo(const char *name, int version, bool force_exact_match)
{
return AI::scanner_info->FindInfo(name, version, force_exact_match);
}
/* static */ AILibrary *AI::FindLibrary(const char *library, int version)
{
return AI::scanner_library->FindLibrary(library, version);
}
/* static */ void AI::Rescan()
{
TarScanner::DoScan(TarScanner::AI);
AI::scanner_info->RescanDir();
AI::scanner_library->RescanDir();
ResetConfig();
InvalidateWindowData(WC_SCRIPT_LIST, 0, 1);
SetWindowClassesDirty(WC_SCRIPT_DEBUG);
InvalidateWindowClassesData(WC_SCRIPT_SETTINGS);
}
/**
* Check whether we have an AI (library) with the exact characteristics as ci.
* @param ci the characteristics to search on (shortname and md5sum)
* @param md5sum whether to check the MD5 checksum
* @return true iff we have an AI (library) matching.
*/
/* static */ bool AI::HasAI(const ContentInfo *ci, bool md5sum)
{
return AI::scanner_info->HasScript(ci, md5sum);
}
/* static */ bool AI::HasAILibrary(const ContentInfo *ci, bool md5sum)
{
return AI::scanner_library->HasScript(ci, md5sum);
}
/* static */ AIScannerInfo *AI::GetScannerInfo()
{
return AI::scanner_info;
}
/* static */ AIScannerLibrary *AI::GetScannerLibrary()
{
return AI::scanner_library;
}
|