| 2891 | } |
| 2892 | |
| 2893 | void MapInstance::on_lua_update() |
| 2894 | { |
| 2895 | // move all to-remove timers to the end of the m_lua_timers |
| 2896 | auto first_to_remove=std::partition(m_lua_timers.begin(),m_lua_timers.end(),[](const auto &t) { |
| 2897 | return !t.m_remove; |
| 2898 | }); |
| 2899 | // remove all dead timers first |
| 2900 | if(first_to_remove!=m_lua_timers.end()) |
| 2901 | m_lua_timers.erase(first_to_remove,m_lua_timers.end()); |
| 2902 | for(const auto &t: m_lua_timers) |
| 2903 | { |
| 2904 | if(t.m_is_enabled && t.m_on_tick_callback != nullptr) |
| 2905 | { |
| 2906 | m_scripting_interface->updateMapInstance(this); |
| 2907 | int64_t time = getSecsSince2000Epoch(); |
| 2908 | int64_t diff = time - t.m_start_time; |
| 2909 | t.m_on_tick_callback(t.m_start_time, diff, time); |
| 2910 | } |
| 2911 | } |
| 2912 | |
| 2913 | } |
| 2914 | |
| 2915 | void MapInstance::on_update_entities() |
| 2916 | { |
nothing calls this directly
no test coverage detected