godotengine / godotengine/godot

GridMap const InvalidCellItem Datatyp wrong in C#

Open
#108,917 1 comment 0 reactions 0 assignees View on GitHub
discussion topic:3d topic:dotnet
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- tested Godot v4.4.stable.mono

### System information

Godot v4.4.stable.mono

### Issue description

const GridMap.InvalidCellItem is type long (-1L) but its only used for GetCellItem and SetCellItem (see [docs](https://docs.godotengine.org/en/stable/classes/class_gridmap.html#class-gridmap-constant-invalid-cell-item))
The return value for GetCellItem is Int and the expected parameter SetCellItem is also Int but InvalidCellItem is Long so you always have to cast.

### Steps to reproduce

Error:
```c#
gridMap.SetCellItem(cellPos, GridMap.InvalidCellItem)
```
Works:
```c#
gridMap.SetCellItem(cellPos, (int)GridMap.InvalidCellItem);
```

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.