Skip to content

Commit

Permalink
More work on fixing the compile for 4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Feb 8, 2022
1 parent 2192f2c commit c401b7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions thread_pool_job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand All @@ -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"));
Expand Down
6 changes: 6 additions & 0 deletions thread_pool_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -74,6 +76,10 @@ class ThreadPoolJob : public Reference {

void execute();

#if VERSION_MAJOR >= 4
GDVIRTUAL0(_execute);
#endif

ThreadPoolJob();
~ThreadPoolJob();

Expand Down

0 comments on commit c401b7a

Please sign in to comment.