More work on fixing the compile for 4.0.

This commit is contained in:
Relintai 2022-02-08 11:51:46 +01:00
parent 2192f2c54c
commit c401b7a027
2 changed files with 19 additions and 0 deletions

View File

@ -137,7 +137,11 @@ void ThreadPoolJob::execute() {
_start_time = OS::get_singleton()->get_ticks_msec();
#endif
#if VERSION_MAJOR < 4
call("_execute");
#else
GDVIRTUAL_CALL(_execute);
#endif
}
ThreadPoolJob::ThreadPoolJob() {
@ -171,7 +175,11 @@ void ThreadPoolJob::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_max_allocated_time"), &ThreadPoolJob::get_max_allocated_time);
ClassDB::bind_method(D_METHOD("set_max_allocated_time", "value"), &ThreadPoolJob::set_max_allocated_time);
#if VERSION_MAJOR < 4
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_allocated_time"), "set_max_allocated_time", "get_max_allocated_time");
#else
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_allocated_time"), "set_max_allocated_time", "get_max_allocated_time");
#endif
ClassDB::bind_method(D_METHOD("get_start_time"), &ThreadPoolJob::get_start_time);
ClassDB::bind_method(D_METHOD("set_start_time", "value"), &ThreadPoolJob::set_start_time);
@ -192,7 +200,12 @@ void ThreadPoolJob::_bind_methods() {
ClassDB::bind_method(D_METHOD("should_do", "just_check"), &ThreadPoolJob::should_do, DEFVAL(false));
ClassDB::bind_method(D_METHOD("should_return"), &ThreadPoolJob::should_return);
#if VERSION_MAJOR < 4
BIND_VMETHOD(MethodInfo("_execute"));
#else
GDVIRTUAL_BIND(_execute);
#endif
ClassDB::bind_method(D_METHOD("execute"), &ThreadPoolJob::execute);
ADD_SIGNAL(MethodInfo("completed"));

View File

@ -30,6 +30,8 @@ SOFTWARE.
#ifndef Reference
#define Reference RefCounted
#endif
#include "core/object/gdvirtual.gen.inc"
#include "core/object/script_language.h"
#else
#include "core/reference.h"
#endif
@ -74,6 +76,10 @@ public:
void execute();
#if VERSION_MAJOR >= 4
GDVIRTUAL0(_execute);
#endif
ThreadPoolJob();
~ThreadPoolJob();