godotengine / godotengine/godot-cpp

Failed to compile code overriding `TileMap` methods

Open
#1,102 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

Commenting out `AnimatedTileMap::_tile_data_runtime_update` works fine.
```cpp
// animated_tilemap.h

#ifndef ANIMATED_TILEMAP_H
#define ANIMATED_TILEMAP_H

#include

namespace godot
{
class AnimatedTileMap : public TileMap
{
GDCLASS(AnimatedTileMap, TileMap)

private:
double counter;

protected:
static void _bind_methods();

public:
AnimatedTileMap();
~AnimatedTileMap();

void _process(double delta);

bool _use_tile_data_runtime_update(int32_t layer, const Vector2i &coords);
void _tile_data_runtime_update(int32_t layer, const Vector2i &coords, TileData *tile_data);
};
}

#endif
```

```cpp
// animated_tilemap.cpp

#include
#include

namespace godot
{
void AnimatedTileMap::_bind_methods() {}

AnimatedTileMap::AnimatedTileMap() { counter = 0.0; }

AnimatedTileMap::~AnimatedTileMap() {}

void AnimatedTileMap::_process(double delta)
{
// Increment counter
counter += delta;
}

bool AnimatedTileMap::_use_tile_data_runtime_update(int32_t layer, const Vector2i &coords)
{
return true;
}

void AnimatedTileMap::_tile_data_runtime_update(int32_t layer, const Vector2i &coords, TileData *tile_data)
{
if (layer == 0)
{
// Code logic here...
}
}
}
```
Error:
```
In file included from godot-cpp/include/godot_cpp/core/binder_common.hpp:36,
from godot-cpp/include/godot_cpp/core/method_bind.hpp:34,
from godot-cpp/include/godot_cpp/core/class_db.hpp:38,
from baselib/animated_tilemap.cpp:1:
godot-cpp/include/godot_cpp/core/method_ptrcall.hpp: In instantiation of 'static T* godot::PtrToArg::convert(const void*) [with T = godot::TileData]':
godot-cpp/include/godot_cpp/core/binder_common.hpp:194:46: required from 'void godot::call_with_ptr_args_helper(T*, void (T::*)(P ...), const void* const*, IndexSequence) [with T = AnimatedTileMap; P = {int, const Vector2i&, TileData*}; long unsigned int ...Is = {0, 1, 2}; GDExtensionConstTypePtr = const void*]'
godot-cpp/include/godot_cpp/core/binder_common.hpp:214:36: required from 'void godot::call_with_ptr_args(T*, void (T::*)(P ...), const void* const*, void*) [with T = AnimatedTileMap; P = {int, const Vector2i&, TileData*}; GDExtensionConstTypePtr = const void*]'
godot-cpp/gen/include/godot_cpp/classes/tile_map.hpp:128:4: required from 'static void godot::TileMap::register_virtuals() [with T = godot::AnimatedTileMap; B = godot::TileMap]'
baselib/animated_tilemap.h:10:9: required from here
godot-cpp/include/godot_cpp/core/method_ptrcall.hpp:171:200: error: incomplete type 'godot::TileData' used in nested name specifier
171 | terpret_cast(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast(const_cast(p_ptr)), godot::internal::token, &T::___binding_callbacks));
| ^~~~~~~~~~~~~~~~~~~~~~~~

In file included from godot-cpp/include/godot_cpp/core/binder_common.hpp:36,
from godot-cpp/include/godot_cpp/core/method_bind.hpp:34,
from godot-cpp/include/godot_cpp/core/class_db.hpp:38,
from godot-cpp/gen/include/godot_cpp/classes/ref_counted.hpp:39,
from godot-cpp/include/godot_cpp/classes/ref.hpp:37,
from godot-cpp/gen/include/godot_cpp/classes/node.hpp:41,
from godot-cpp/gen/include/godot_cpp/classes/canvas_item.hpp:38,
from godot-cpp/gen/include/godot_cpp/classes/node2d.hpp:36,
from godot-cpp/gen/include/godot_cpp/classes/tile_map.hpp:37,
from baselib/animated_tilemap.h:4,
from baselib/register_types.cpp:3:
godot-cpp/include/godot_cpp/core/method_ptrcall.hpp: In instantiation of 'static T* godot::PtrToArg::convert(const void*) [with T = godot::TileData]':
godot-cpp/include/godot_cpp/core/binder_common.hpp:194:46: required from 'void godot::call_with_ptr_args_helper(T*, void (T::*)(P ...), const void* const*, IndexSequence) [with T = AnimatedTileMap; P = {int, const Vector2i&, TileData*}; long unsigned int ...Is = {0, 1, 2}; GDExtensionConstTypePtr = const void*]'
godot-cpp/include/godot_cpp/core/binder_common.hpp:214:36: required from 'void godot::call_with_ptr_args(T*, void (T::*)(P ...), const void* const*, void*) [with T = AnimatedTileMap; P = {int, const Vector2i&, TileData*}; GDExtensionConstTypePtr = const void*]'
godot-cpp/gen/include/godot_cpp/classes/tile_map.hpp:128:4: required from 'static void godot::TileMap::register_virtuals() [with T = godot::AnimatedTileMap; B = godot::TileMap]'
baselib/animated_tilemap.h:10:9: required from here
godot-cpp/include/godot_cpp/core/method_ptrcall.hpp:171:200: error: incomplete type 'godot::TileData' used in nested name specifier
171 | terpret_cast(godot::internal::gde_interface->object_get_instance_binding(*reinterpret_cast(const_cast(p_ptr)), godot::internal::token, &T::___binding_callbacks));
| ^~~~~~~~~~~~~~~~~~~~~~~~

scons: *** [baselib/animated_tilemap.os] Error 1
scons: *** [baselib/register_types.os] Error 1
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.