2019-03-21 20:18:31 +01:00
|
|
|
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "script.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-06-27 20:12:45 +02:00
|
|
|
using script_list = std::vector<std::unique_ptr<script>>;
|
|
|
|
|
2019-03-21 20:18:31 +01:00
|
|
|
class script_mgr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit script_mgr() = default;
|
2023-03-01 21:27:15 +00:00
|
|
|
~script_mgr() = default;
|
2019-03-21 20:18:31 +01:00
|
|
|
|
|
|
|
void add_script(std::unique_ptr<script> script);
|
|
|
|
void remove_all_scripts();
|
|
|
|
|
2022-06-27 20:12:45 +02:00
|
|
|
script_list& scripts();
|
|
|
|
|
2019-03-21 20:18:31 +01:00
|
|
|
void tick();
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2019-03-21 20:18:31 +01:00
|
|
|
private:
|
|
|
|
void tick_internal();
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2019-03-21 20:18:31 +01:00
|
|
|
private:
|
|
|
|
std::recursive_mutex m_mutex;
|
2022-06-27 20:12:45 +02:00
|
|
|
script_list m_scripts;
|
2019-03-21 20:18:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
inline script_mgr g_script_mgr;
|
2022-06-27 20:12:45 +02:00
|
|
|
}
|