OpenTTD Source 20241224-master-gee860a5c8e
TestScriptController Class Reference

A controller to start enough so we can use Squirrel for testing. More...

Data Fields

GameInstance game {}
 
ScriptObject::ActiveInstance active {&game}
 
Squirrel engine {"test"}
 
ScriptAllocatorScope scope {&engine}
 

Detailed Description

A controller to start enough so we can use Squirrel for testing.

To run Squirrel, we need an Allocator, so malloc/free works. For functions that log, we need an ActiveInstance, so the logger knows where to send the logs to.

By instantiating this class, both are set correctly. After that you can use Squirrel without issues.

Definition at line 35 of file test_script_admin.cpp.

Field Documentation

◆ active

ScriptObject::ActiveInstance TestScriptController::active {&game}

Definition at line 38 of file test_script_admin.cpp.

◆ engine

Squirrel TestScriptController::engine {"test"}

Definition at line 40 of file test_script_admin.cpp.

◆ game

GameInstance TestScriptController::game {}

Definition at line 37 of file test_script_admin.cpp.

◆ scope

ScriptAllocatorScope TestScriptController::scope {&engine}

Definition at line 41 of file test_script_admin.cpp.


The documentation for this class was generated from the following file: