Replace NULL with nullptr
This commit is contained in:
parent
5f11e15571
commit
95a1400a2a
755 changed files with 5742 additions and 5742 deletions
|
|
@ -62,7 +62,7 @@ aiBone *get_bone_by_name(const aiScene *scene, aiString bone_name) {
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EditorSceneImporterAssimp::get_extensions(List<String> *r_extensions) const {
|
||||
|
|
@ -149,7 +149,7 @@ Node *EditorSceneImporterAssimp::import_scene(const String &p_path, uint32_t p_f
|
|||
0;
|
||||
aiScene *scene = (aiScene *)importer.ReadFile(s_path.c_str(), post_process_Steps);
|
||||
|
||||
ERR_FAIL_COND_V_MSG(scene == NULL, NULL, String("Open Asset Import failed to open: ") + String(importer.GetErrorString()));
|
||||
ERR_FAIL_COND_V_MSG(scene == nullptr, nullptr, String("Open Asset Import failed to open: ") + String(importer.GetErrorString()));
|
||||
|
||||
return _generate_scene(p_path, scene, p_flags, p_bake_fps, max_bone_weights);
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ T EditorSceneImporterAssimp::_interpolate_track(const Vector<float> &p_times, co
|
|||
|
||||
aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiString name) {
|
||||
List<aiBone *>::Element *iter;
|
||||
aiBone *bone = NULL;
|
||||
aiBone *bone = nullptr;
|
||||
for (iter = state.bone_stack.front(); iter; iter = iter->next()) {
|
||||
bone = (aiBone *)iter->get();
|
||||
|
||||
|
|
@ -294,32 +294,32 @@ aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiStr
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node3D *
|
||||
EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps,
|
||||
const int32_t p_max_bone_weights) {
|
||||
ERR_FAIL_COND_V(scene == NULL, NULL);
|
||||
ERR_FAIL_COND_V(scene == nullptr, nullptr);
|
||||
|
||||
ImportState state;
|
||||
state.path = p_path;
|
||||
state.assimp_scene = scene;
|
||||
state.max_bone_weights = p_max_bone_weights;
|
||||
state.animation_player = NULL;
|
||||
state.animation_player = nullptr;
|
||||
|
||||
// populate light map
|
||||
for (unsigned int l = 0; l < scene->mNumLights; l++) {
|
||||
|
||||
aiLight *ai_light = scene->mLights[l];
|
||||
ERR_CONTINUE(ai_light == NULL);
|
||||
ERR_CONTINUE(ai_light == nullptr);
|
||||
state.light_cache[AssimpUtils::get_assimp_string(ai_light->mName)] = l;
|
||||
}
|
||||
|
||||
// fill camera cache
|
||||
for (unsigned int c = 0; c < scene->mNumCameras; c++) {
|
||||
aiCamera *ai_camera = scene->mCameras[c];
|
||||
ERR_CONTINUE(ai_camera == NULL);
|
||||
ERR_CONTINUE(ai_camera == nullptr);
|
||||
state.camera_cache[AssimpUtils::get_assimp_string(ai_camera->mName)] = c;
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
|
||||
RegenerateBoneStack(state);
|
||||
|
||||
Node *last_valid_parent = NULL;
|
||||
Node *last_valid_parent = nullptr;
|
||||
|
||||
List<const aiNode *>::Element *iter;
|
||||
for (iter = state.nodes.front(); iter; iter = iter->next()) {
|
||||
|
|
@ -343,7 +343,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
String node_name = AssimpUtils::get_assimp_string(element_assimp_node->mName);
|
||||
//print_verbose("node: " + node_name);
|
||||
|
||||
Node3D *spatial = NULL;
|
||||
Node3D *spatial = nullptr;
|
||||
Transform transform = AssimpUtils::assimp_matrix_transform(element_assimp_node->mTransformation);
|
||||
|
||||
// retrieve this node bone
|
||||
|
|
@ -361,13 +361,13 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
if (!state.armature_skeletons.has(element_assimp_node)) {
|
||||
state.armature_skeletons.insert(element_assimp_node, skeleton);
|
||||
}
|
||||
} else if (bone != NULL) {
|
||||
} else if (bone != nullptr) {
|
||||
continue;
|
||||
} else {
|
||||
spatial = memnew(Node3D);
|
||||
}
|
||||
|
||||
ERR_CONTINUE_MSG(spatial == NULL, "FBX Import - are we out of ram?");
|
||||
ERR_CONTINUE_MSG(spatial == nullptr, "FBX Import - are we out of ram?");
|
||||
// we on purpose set the transform and name after creating the node.
|
||||
|
||||
spatial->set_name(node_name);
|
||||
|
|
@ -387,7 +387,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
if (parent_lookup) {
|
||||
Node3D *parent_node = parent_lookup->value();
|
||||
|
||||
ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root,
|
||||
ERR_FAIL_COND_V_MSG(parent_node == nullptr, state.root,
|
||||
"Parent node invalid even though lookup successful, out of ram?");
|
||||
|
||||
if (spatial != state.root) {
|
||||
|
|
@ -434,7 +434,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
aiNode *parent_node = bone_node->mParent;
|
||||
|
||||
String bone_name = AssimpUtils::get_anim_string_from_assimp(bone->mName);
|
||||
ERR_CONTINUE_MSG(armature_for_bone == NULL, "Armature for bone invalid: " + bone_name);
|
||||
ERR_CONTINUE_MSG(armature_for_bone == nullptr, "Armature for bone invalid: " + bone_name);
|
||||
Skeleton3D *skeleton = state.armature_skeletons[armature_for_bone];
|
||||
|
||||
state.skeleton_bone_map[bone] = skeleton;
|
||||
|
|
@ -454,7 +454,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
skeleton->set_bone_rest(boneIdx, pform);
|
||||
skeleton->set_bone_pose(boneIdx, pform);
|
||||
|
||||
if (parent_node != NULL) {
|
||||
if (parent_node != nullptr) {
|
||||
int parent_bone_id = skeleton->find_bone(AssimpUtils::get_anim_string_from_assimp(parent_node->mName));
|
||||
int current_bone_id = boneIdx;
|
||||
skeleton->set_bone_parent(current_bone_id, parent_bone_id);
|
||||
|
|
@ -470,8 +470,8 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
const aiNode *assimp_node = key_value_pair->key();
|
||||
Node3D *mesh_template = key_value_pair->value();
|
||||
|
||||
ERR_CONTINUE(assimp_node == NULL);
|
||||
ERR_CONTINUE(mesh_template == NULL);
|
||||
ERR_CONTINUE(assimp_node == nullptr);
|
||||
ERR_CONTINUE(mesh_template == nullptr);
|
||||
|
||||
Node *parent_node = mesh_template->get_parent();
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (parent_node == NULL) {
|
||||
if (parent_node == nullptr) {
|
||||
print_error("Found invalid parent node!");
|
||||
continue; // root node
|
||||
}
|
||||
|
|
@ -661,7 +661,7 @@ Node *EditorSceneImporterAssimp::get_node_by_name(ImportState &state, String nam
|
|||
return node;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Bone stack is a fifo handler for multiple armatures since armatures aren't a thing in assimp (yet) */
|
||||
|
|
@ -691,7 +691,7 @@ void EditorSceneImporterAssimp::RegenerateBoneStack(ImportState &state, aiMesh *
|
|||
// iterate over all the bones on the mesh for this node only!
|
||||
for (unsigned int boneIndex = 0; boneIndex < mesh->mNumBones; boneIndex++) {
|
||||
aiBone *bone = mesh->mBones[boneIndex];
|
||||
if (state.bone_stack.find(bone) == NULL) {
|
||||
if (state.bone_stack.find(bone) == nullptr) {
|
||||
state.bone_stack.push_back(bone);
|
||||
}
|
||||
}
|
||||
|
|
@ -711,7 +711,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
|
|||
print_verbose("import animation: " + name);
|
||||
float ticks_per_second = anim->mTicksPerSecond;
|
||||
|
||||
if (state.assimp_scene->mMetaData != NULL && Math::is_equal_approx(ticks_per_second, 0.0f)) {
|
||||
if (state.assimp_scene->mMetaData != nullptr && Math::is_equal_approx(ticks_per_second, 0.0f)) {
|
||||
int32_t time_mode = 0;
|
||||
state.assimp_scene->mMetaData->Get("TimeMode", time_mode);
|
||||
ticks_per_second = AssimpUtils::get_fbx_fps(time_mode, state.assimp_scene);
|
||||
|
|
@ -747,9 +747,9 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
|
|||
continue; //do not bother
|
||||
}
|
||||
|
||||
Skeleton3D *skeleton = NULL;
|
||||
Skeleton3D *skeleton = nullptr;
|
||||
NodePath node_path;
|
||||
aiBone *bone = NULL;
|
||||
aiBone *bone = nullptr;
|
||||
|
||||
// Import skeleton bone animation for this track
|
||||
// Any bone will do, no point in processing more than just what is in the skeleton
|
||||
|
|
@ -806,7 +806,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
|
|||
Node *item = get_node_by_name(state, mesh_name);
|
||||
ERR_CONTINUE_MSG(!item, "failed to look up node by name");
|
||||
const MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(item);
|
||||
ERR_CONTINUE(mesh_instance == NULL);
|
||||
ERR_CONTINUE(mesh_instance == nullptr);
|
||||
|
||||
String base_path = state.root->get_path_to(mesh_instance);
|
||||
|
||||
|
|
@ -940,7 +940,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
}
|
||||
|
||||
// Work out normal calculations? - this needs work it doesn't work properly on huestos
|
||||
if (ai_mesh->mNormals != NULL) {
|
||||
if (ai_mesh->mNormals != nullptr) {
|
||||
const aiVector3D normals = ai_mesh->mNormals[j];
|
||||
const Vector3 godot_normal = Vector3(normals.x, normals.y, normals.z);
|
||||
st->add_normal(godot_normal);
|
||||
|
|
@ -1325,8 +1325,8 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_
|
|||
mesh_key += itos(surface_indices[i]);
|
||||
}
|
||||
|
||||
Skeleton3D *skeleton = NULL;
|
||||
aiNode *armature = NULL;
|
||||
Skeleton3D *skeleton = nullptr;
|
||||
aiNode *armature = nullptr;
|
||||
|
||||
if (!state.mesh_cache.has(mesh_key)) {
|
||||
mesh = _generate_mesh_from_surface_indices(state, surface_indices, assimp_node, skin, skeleton);
|
||||
|
|
@ -1411,9 +1411,9 @@ Node3D *EditorSceneImporterAssimp::create_light(
|
|||
ImportState &state,
|
||||
const String &node_name,
|
||||
Transform &look_at_transform) {
|
||||
Light3D *light = NULL;
|
||||
Light3D *light = nullptr;
|
||||
aiLight *assimp_light = state.assimp_scene->mLights[state.light_cache[node_name]];
|
||||
ERR_FAIL_COND_V(!assimp_light, NULL);
|
||||
ERR_FAIL_COND_V(!assimp_light, nullptr);
|
||||
|
||||
if (assimp_light->mType == aiLightSource_DIRECTIONAL) {
|
||||
light = memnew(DirectionalLight3D);
|
||||
|
|
@ -1422,7 +1422,7 @@ Node3D *EditorSceneImporterAssimp::create_light(
|
|||
} else if (assimp_light->mType == aiLightSource_SPOT) {
|
||||
light = memnew(SpotLight3D);
|
||||
}
|
||||
ERR_FAIL_COND_V(light == NULL, NULL);
|
||||
ERR_FAIL_COND_V(light == nullptr, nullptr);
|
||||
|
||||
if (assimp_light->mType != aiLightSource_POINT) {
|
||||
Vector3 pos = Vector3(
|
||||
|
|
@ -1458,10 +1458,10 @@ Node3D *EditorSceneImporterAssimp::create_camera(
|
|||
const String &node_name,
|
||||
Transform &look_at_transform) {
|
||||
aiCamera *camera = state.assimp_scene->mCameras[state.camera_cache[node_name]];
|
||||
ERR_FAIL_COND_V(!camera, NULL);
|
||||
ERR_FAIL_COND_V(!camera, nullptr);
|
||||
|
||||
Camera3D *camera_node = memnew(Camera3D);
|
||||
ERR_FAIL_COND_V(!camera_node, NULL);
|
||||
ERR_FAIL_COND_V(!camera_node, nullptr);
|
||||
float near = camera->mClipPlaneNear;
|
||||
if (Math::is_equal_approx(near, 0.0f)) {
|
||||
near = 0.1f;
|
||||
|
|
@ -1483,7 +1483,7 @@ void EditorSceneImporterAssimp::_generate_node(
|
|||
ImportState &state,
|
||||
const aiNode *assimp_node) {
|
||||
|
||||
ERR_FAIL_COND(assimp_node == NULL);
|
||||
ERR_FAIL_COND(assimp_node == nullptr);
|
||||
state.nodes.push_back(assimp_node);
|
||||
String parent_name = AssimpUtils::get_assimp_string(assimp_node->mParent->mName);
|
||||
|
||||
|
|
@ -1498,7 +1498,7 @@ void EditorSceneImporterAssimp::_generate_node(
|
|||
// is this an armature
|
||||
// parent null
|
||||
// and this is the first bone :)
|
||||
if (parent_bone == NULL && current_bone) {
|
||||
if (parent_bone == nullptr && current_bone) {
|
||||
state.armature_nodes.push_back(assimp_node->mParent);
|
||||
print_verbose("found valid armature: " + parent_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public:
|
|||
|
||||
virtual void get_extensions(List<String> *r_extensions) const;
|
||||
virtual uint32_t get_import_flags() const;
|
||||
virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
|
||||
virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
|
||||
Ref<Image> load_image(ImportState &state, const aiScene *p_scene, String p_path);
|
||||
|
||||
static void RegenerateBoneStack(ImportState &state);
|
||||
|
|
|
|||
|
|
@ -118,12 +118,12 @@ struct RecursiveState {
|
|||
bone(_bone) {}
|
||||
|
||||
Transform node_transform;
|
||||
Skeleton3D *skeleton = NULL;
|
||||
Node3D *new_node = NULL;
|
||||
Skeleton3D *skeleton = nullptr;
|
||||
Node3D *new_node = nullptr;
|
||||
String node_name;
|
||||
aiNode *assimp_node = NULL;
|
||||
Node *parent_node = NULL;
|
||||
aiBone *bone = NULL;
|
||||
aiNode *assimp_node = nullptr;
|
||||
Node *parent_node = nullptr;
|
||||
aiBone *bone = nullptr;
|
||||
};
|
||||
} // namespace AssimpImporter
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ public:
|
|||
static Transform _get_global_assimp_node_transform(const aiNode *p_current_node) {
|
||||
aiNode const *current_node = p_current_node;
|
||||
Transform xform;
|
||||
while (current_node != NULL) {
|
||||
while (current_node != nullptr) {
|
||||
xform = assimp_matrix_transform(current_node->mTransformation) * xform;
|
||||
current_node = current_node->mParent;
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ public:
|
|||
*/
|
||||
static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) {
|
||||
ERR_FAIL_COND(texture.is_null());
|
||||
ERR_FAIL_COND(map_mode == NULL);
|
||||
ERR_FAIL_COND(map_mode == nullptr);
|
||||
// FIXME: Commented out during Vulkan port.
|
||||
/*
|
||||
aiTextureMapMode tex_mode = map_mode[0];
|
||||
|
|
@ -358,13 +358,13 @@ public:
|
|||
print_verbose("Open Asset Import: Loading embedded texture " + filename);
|
||||
if (tex->mHeight == 0) {
|
||||
if (tex->CheckFormat("png")) {
|
||||
ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, Ref<Image>());
|
||||
ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, Ref<Image>());
|
||||
Ref<Image> img = Image::_png_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
|
||||
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
|
||||
state.path_to_image_cache.insert(p_path, img);
|
||||
return img;
|
||||
} else if (tex->CheckFormat("jpg")) {
|
||||
ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, Ref<Image>());
|
||||
ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, Ref<Image>());
|
||||
Ref<Image> img = Image::_jpg_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
|
||||
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
|
||||
state.path_to_image_cache.insert(p_path, img);
|
||||
|
|
@ -440,7 +440,7 @@ public:
|
|||
String &path,
|
||||
AssimpImageData &image_state) {
|
||||
aiString ai_filename = aiString();
|
||||
if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, NULL, NULL, NULL, NULL, image_state.map_mode)) {
|
||||
if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, nullptr, nullptr, nullptr, nullptr, image_state.map_mode)) {
|
||||
return CreateAssimpTexture(state, ai_filename, filename, path, image_state);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
ptr += 4;
|
||||
size -= 4;
|
||||
|
||||
basist::basisu_transcoder tr(NULL);
|
||||
basist::basisu_transcoder tr(nullptr);
|
||||
|
||||
ERR_FAIL_COND_V(!tr.validate_header(ptr, size), image);
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ void unregister_basis_universal_types() {
|
|||
|
||||
#ifdef TOOLS_ENABLED
|
||||
delete sel_codebook;
|
||||
Image::basis_universal_packer = NULL;
|
||||
Image::basis_universal_packer = nullptr;
|
||||
#endif
|
||||
Image::basis_universal_unpacker = NULL;
|
||||
Image::basis_universal_unpacker = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) {
|
|||
imgfmt = Image::FORMAT_ETC2_RGBA8;
|
||||
};
|
||||
|
||||
basist::basisu_transcoder tr(NULL);
|
||||
basist::basisu_transcoder tr(nullptr);
|
||||
|
||||
ERR_FAIL_COND(!tr.validate_header(ptr, size));
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
|
|||
|
||||
Error err = OK;
|
||||
|
||||
if (p_buffer == NULL)
|
||||
if (p_buffer == nullptr)
|
||||
err = FAILED;
|
||||
|
||||
if (err == OK) {
|
||||
|
|
@ -151,7 +151,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
|
|||
line -= line_width;
|
||||
}
|
||||
|
||||
if (p_color_buffer == NULL || color_table_size == 0) { // regular pixels
|
||||
if (p_color_buffer == nullptr || color_table_size == 0) { // regular pixels
|
||||
|
||||
p_image->create(width, height, 0, Image::FORMAT_RGBA8, data);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "image_loader_bmp.h"
|
||||
|
||||
static ImageLoaderBMP *image_loader_bmp = NULL;
|
||||
static ImageLoaderBMP *image_loader_bmp = nullptr;
|
||||
|
||||
void register_bmp_types() {
|
||||
image_loader_bmp = memnew(ImageLoaderBMP);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
OverlapState state;
|
||||
|
||||
OverlappingObjectData() :
|
||||
object(NULL),
|
||||
object(nullptr),
|
||||
state(OVERLAP_STATE_ENTER) {}
|
||||
OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) :
|
||||
object(p_object),
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ BulletPhysicsServer3D::BulletPhysicsServer3D() :
|
|||
BulletPhysicsServer3D::~BulletPhysicsServer3D() {}
|
||||
|
||||
RID BulletPhysicsServer3D::shape_create(ShapeType p_shape) {
|
||||
ShapeBullet *shape = NULL;
|
||||
ShapeBullet *shape = nullptr;
|
||||
|
||||
switch (p_shape) {
|
||||
case SHAPE_PLANE: {
|
||||
|
|
@ -216,7 +216,7 @@ real_t BulletPhysicsServer3D::space_get_param(RID p_space, SpaceParameter p_para
|
|||
|
||||
PhysicsDirectSpaceState3D *BulletPhysicsServer3D::space_get_direct_state(RID p_space) {
|
||||
SpaceBullet *space = space_owner.getornull(p_space);
|
||||
ERR_FAIL_COND_V(!space, NULL);
|
||||
ERR_FAIL_COND_V(!space, nullptr);
|
||||
|
||||
return space->get_direct_state();
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ RID BulletPhysicsServer3D::area_create() {
|
|||
void BulletPhysicsServer3D::area_set_space(RID p_area, RID p_space) {
|
||||
AreaBullet *area = area_owner.getornull(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
SpaceBullet *space = NULL;
|
||||
SpaceBullet *space = nullptr;
|
||||
if (p_space.is_valid()) {
|
||||
space = space_owner.getornull(p_space);
|
||||
ERR_FAIL_COND(!space);
|
||||
|
|
@ -463,7 +463,7 @@ RID BulletPhysicsServer3D::body_create(BodyMode p_mode, bool p_init_sleeping) {
|
|||
void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) {
|
||||
RigidBodyBullet *body = rigid_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
SpaceBullet *space = NULL;
|
||||
SpaceBullet *space = nullptr;
|
||||
|
||||
if (p_space.is_valid()) {
|
||||
space = space_owner.getornull(p_space);
|
||||
|
|
@ -861,7 +861,7 @@ bool BulletPhysicsServer3D::body_is_ray_pickable(RID p_body) const {
|
|||
|
||||
PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) {
|
||||
RigidBodyBullet *body = rigid_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, NULL);
|
||||
ERR_FAIL_COND_V(!body, nullptr);
|
||||
return BulletPhysicsDirectBodyState3D::get_singleton(body);
|
||||
}
|
||||
|
||||
|
|
@ -900,7 +900,7 @@ void BulletPhysicsServer3D::soft_body_update_rendering_server(RID p_body, class
|
|||
void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) {
|
||||
SoftBodyBullet *body = soft_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
SpaceBullet *space = NULL;
|
||||
SpaceBullet *space = nullptr;
|
||||
|
||||
if (p_space.is_valid()) {
|
||||
space = space_owner.getornull(p_space);
|
||||
|
|
@ -1214,7 +1214,7 @@ RID BulletPhysicsServer3D::joint_create_pin(RID p_body_A, const Vector3 &p_local
|
|||
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1282,7 +1282,7 @@ RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform &p_h
|
|||
ERR_FAIL_COND_V(!body_A, RID());
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1302,7 +1302,7 @@ RID BulletPhysicsServer3D::joint_create_hinge_simple(RID p_body_A, const Vector3
|
|||
ERR_FAIL_COND_V(!body_A, RID());
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1354,7 +1354,7 @@ RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform &p_
|
|||
ERR_FAIL_COND_V(!body_A, RID());
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1390,7 +1390,7 @@ RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform
|
|||
ERR_FAIL_COND_V(!body_A, RID());
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1424,7 +1424,7 @@ RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transfo
|
|||
ERR_FAIL_COND_V(!body_A, RID());
|
||||
JointAssertSpace(body_A, "A", RID());
|
||||
|
||||
RigidBodyBullet *body_B = NULL;
|
||||
RigidBodyBullet *body_B = nullptr;
|
||||
if (p_body_B.is_valid()) {
|
||||
body_B = rigid_body_owner.getornull(p_body_B);
|
||||
JointAssertSpace(body_B, "B", RID());
|
||||
|
|
@ -1503,7 +1503,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
|
|||
|
||||
RigidBodyBullet *body = rigid_body_owner.getornull(p_rid);
|
||||
|
||||
body->set_space(NULL);
|
||||
body->set_space(nullptr);
|
||||
|
||||
body->remove_all_shapes(true, true);
|
||||
|
||||
|
|
@ -1514,7 +1514,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
|
|||
|
||||
SoftBodyBullet *body = soft_body_owner.getornull(p_rid);
|
||||
|
||||
body->set_space(NULL);
|
||||
body->set_space(nullptr);
|
||||
|
||||
soft_body_owner.free(p_rid);
|
||||
bulletdelete(body);
|
||||
|
|
@ -1523,7 +1523,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
|
|||
|
||||
AreaBullet *area = area_owner.getornull(p_rid);
|
||||
|
||||
area->set_space(NULL);
|
||||
area->set_space(nullptr);
|
||||
|
||||
area->remove_all_shapes(true, true);
|
||||
|
||||
|
|
@ -1592,7 +1592,7 @@ CollisionObjectBullet *BulletPhysicsServer3D::get_collisin_object(RID p_object)
|
|||
if (soft_body_owner.owns(p_object)) {
|
||||
return soft_body_owner.getornull(p_object);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID p_object) const {
|
||||
|
|
@ -1602,5 +1602,5 @@ RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID
|
|||
if (area_owner.owns(p_object)) {
|
||||
return area_owner.getornull(p_object);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ public:
|
|||
// this function only works on physics process, errors and returns null otherwise
|
||||
virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body);
|
||||
|
||||
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
|
||||
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true);
|
||||
virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
|
||||
|
||||
/* SOFT BODY API */
|
||||
|
|
|
|||
|
|
@ -41,6 +41,6 @@
|
|||
#define bulletdelete(cl) \
|
||||
{ \
|
||||
delete cl; \
|
||||
cl = NULL; \
|
||||
cl = nullptr; \
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
|
|||
collisionsEnabled(true),
|
||||
m_isStatic(false),
|
||||
ray_pickable(false),
|
||||
bt_collision_object(NULL),
|
||||
bt_collision_object(nullptr),
|
||||
body_scale(1., 1., 1.),
|
||||
force_shape_reset(false),
|
||||
space(NULL),
|
||||
space(nullptr),
|
||||
isTransformChanged(false) {}
|
||||
|
||||
CollisionObjectBullet::~CollisionObjectBullet() {
|
||||
|
|
@ -227,7 +227,7 @@ void CollisionObjectBullet::notify_transform_changed() {
|
|||
|
||||
RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) :
|
||||
CollisionObjectBullet(p_type),
|
||||
mainShape(NULL) {
|
||||
mainShape(nullptr) {
|
||||
}
|
||||
|
||||
RigidCollisionObjectBullet::~RigidCollisionObjectBullet() {
|
||||
|
|
@ -332,7 +332,7 @@ bool RigidCollisionObjectBullet::is_shape_disabled(int p_index) {
|
|||
void RigidCollisionObjectBullet::shape_changed(int p_shape_index) {
|
||||
ShapeWrapper &shp = shapes.write[p_shape_index];
|
||||
if (shp.bt_shape == mainShape) {
|
||||
mainShape = NULL;
|
||||
mainShape = nullptr;
|
||||
}
|
||||
bulletdelete(shp.bt_shape);
|
||||
reload_shapes();
|
||||
|
|
@ -345,7 +345,7 @@ void RigidCollisionObjectBullet::reload_shapes() {
|
|||
bulletdelete(mainShape);
|
||||
}
|
||||
|
||||
mainShape = NULL;
|
||||
mainShape = nullptr;
|
||||
|
||||
ShapeWrapper *shpWrapper;
|
||||
const int shape_count = shapes.size();
|
||||
|
|
@ -398,7 +398,7 @@ void RigidCollisionObjectBullet::internal_shape_destroy(int p_index, bool p_perm
|
|||
ShapeWrapper &shp = shapes.write[p_index];
|
||||
shp.shape->remove_owner(this, p_permanentlyFromThisBody);
|
||||
if (shp.bt_shape == mainShape) {
|
||||
mainShape = NULL;
|
||||
mainShape = nullptr;
|
||||
}
|
||||
bulletdelete(shp.bt_shape);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,20 +76,20 @@ public:
|
|||
bool active;
|
||||
|
||||
ShapeWrapper() :
|
||||
shape(NULL),
|
||||
bt_shape(NULL),
|
||||
shape(nullptr),
|
||||
bt_shape(nullptr),
|
||||
active(true) {}
|
||||
|
||||
ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) :
|
||||
shape(p_shape),
|
||||
bt_shape(NULL),
|
||||
bt_shape(nullptr),
|
||||
active(p_active) {
|
||||
set_transform(p_transform);
|
||||
}
|
||||
|
||||
ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) :
|
||||
shape(p_shape),
|
||||
bt_shape(NULL),
|
||||
bt_shape(nullptr),
|
||||
active(p_active) {
|
||||
set_transform(p_transform);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
*/
|
||||
|
||||
ConstraintBullet::ConstraintBullet() :
|
||||
space(NULL),
|
||||
constraint(NULL),
|
||||
space(nullptr),
|
||||
constraint(nullptr),
|
||||
disabled_collisions_between_bodies(true) {}
|
||||
|
||||
void ConstraintBullet::setup(btTypedConstraint *p_constraint) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public:
|
|||
public:
|
||||
virtual ~ConstraintBullet() {
|
||||
bulletdelete(constraint);
|
||||
constraint = NULL;
|
||||
constraint = nullptr;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ btTypedConstraint *get_bt_constraint() { return constraint; }
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
|
||||
btDefaultCollisionConfiguration(constructionInfo) {
|
||||
|
||||
void *mem = NULL;
|
||||
void *mem = nullptr;
|
||||
|
||||
mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16);
|
||||
m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world);
|
||||
|
|
@ -98,7 +98,7 @@ btCollisionAlgorithmCreateFunc *GodotCollisionConfiguration::getClosestPointsAlg
|
|||
GodotSoftCollisionConfiguration::GodotSoftCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
|
||||
btSoftBodyRigidBodyCollisionConfiguration(constructionInfo) {
|
||||
|
||||
void *mem = NULL;
|
||||
void *mem = nullptr;
|
||||
|
||||
mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16);
|
||||
m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
|
|||
result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
|
||||
result.rid = gObj->get_self();
|
||||
result.collider_id = gObj->get_instance_id();
|
||||
result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id);
|
||||
|
||||
++count;
|
||||
return 1; // not used by bullet
|
||||
|
|
@ -220,7 +220,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
|
|||
}
|
||||
|
||||
result.collider_id = colObj->get_instance_id();
|
||||
result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
|
||||
result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id);
|
||||
result.rid = colObj->get_self();
|
||||
++m_count;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
@author AndreaCatania
|
||||
*/
|
||||
|
||||
BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = NULL;
|
||||
BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = nullptr;
|
||||
|
||||
Vector3 BulletPhysicsDirectBodyState3D::get_total_gravity() const {
|
||||
Vector3 gVec;
|
||||
|
|
@ -241,7 +241,7 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
|
|||
} break;
|
||||
default:
|
||||
WARN_PRINT("This shape is not supported for kinematic collision.");
|
||||
shapes.write[i].shape = NULL;
|
||||
shapes.write[i].shape = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) {
|
|||
|
||||
RigidBodyBullet::RigidBodyBullet() :
|
||||
RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
|
||||
kinematic_utilities(NULL),
|
||||
kinematic_utilities(nullptr),
|
||||
locked_axis(0),
|
||||
mass(1),
|
||||
gravity_scale(1),
|
||||
|
|
@ -274,13 +274,13 @@ RigidBodyBullet::RigidBodyBullet() :
|
|||
countGravityPointSpaces(0),
|
||||
isScratchedSpaceOverrideModificator(false),
|
||||
previousActiveState(true),
|
||||
force_integration_callback(NULL) {
|
||||
force_integration_callback(nullptr) {
|
||||
|
||||
godotMotionState = bulletnew(GodotMotionState(this));
|
||||
|
||||
// Initial properties
|
||||
const btVector3 localInertia(0, 0, 0);
|
||||
btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, NULL, localInertia);
|
||||
btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, nullptr, localInertia);
|
||||
|
||||
btBody = bulletnew(btRigidBody(cInfo));
|
||||
reload_shapes();
|
||||
|
|
@ -291,7 +291,7 @@ RigidBodyBullet::RigidBodyBullet() :
|
|||
|
||||
areasWhereIam.resize(maxAreasWhereIam);
|
||||
for (int i = areasWhereIam.size() - 1; 0 <= i; --i) {
|
||||
areasWhereIam.write[i] = NULL;
|
||||
areasWhereIam.write[i] = nullptr;
|
||||
}
|
||||
btBody->setSleepingThresholds(0.2, 0.2);
|
||||
|
||||
|
|
@ -315,7 +315,7 @@ void RigidBodyBullet::init_kinematic_utilities() {
|
|||
void RigidBodyBullet::destroy_kinematic_utilities() {
|
||||
if (kinematic_utilities) {
|
||||
memdelete(kinematic_utilities);
|
||||
kinematic_utilities = NULL;
|
||||
kinematic_utilities = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ void RigidBodyBullet::set_force_integration_callback(ObjectID p_id, const String
|
|||
|
||||
if (force_integration_callback) {
|
||||
memdelete(force_integration_callback);
|
||||
force_integration_callback = NULL;
|
||||
force_integration_callback = nullptr;
|
||||
}
|
||||
|
||||
if (p_id.is_valid()) {
|
||||
|
|
@ -847,7 +847,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) {
|
|||
}
|
||||
for (int i = 0; i < areaWhereIamCount; ++i) {
|
||||
|
||||
if (NULL == areasWhereIam[i]) {
|
||||
if (nullptr == areasWhereIam[i]) {
|
||||
// This area has the highest priority
|
||||
areasWhereIam.write[i] = p_area;
|
||||
break;
|
||||
|
|
@ -894,7 +894,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
|
|||
}
|
||||
|
||||
--areaWhereIamCount;
|
||||
areasWhereIam.write[areaWhereIamCount] = NULL; // Even if this is not required, I clear the last element to be safe
|
||||
areasWhereIam.write[areaWhereIamCount] = nullptr; // Even if this is not required, I clear the last element to be safe
|
||||
if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
|
||||
scratch_space_override_modificator();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
static void destroySingleton() {
|
||||
memdelete(singleton);
|
||||
singleton = NULL;
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
static void singleton_setDeltaTime(real_t p_deltaTime) {
|
||||
|
|
@ -166,7 +166,7 @@ public:
|
|||
btTransform transform;
|
||||
|
||||
KinematicShape() :
|
||||
shape(NULL) {}
|
||||
shape(nullptr) {}
|
||||
bool is_active() const { return shape; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ btScaledBvhTriangleMeshShape *ShapeBullet::create_shape_concave(btBvhTriangleMes
|
|||
if (p_mesh_shape) {
|
||||
return bulletnew(btScaledBvhTriangleMeshShape(p_mesh_shape, p_local_scaling));
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape(const btVector3 &p_i
|
|||
|
||||
ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
|
||||
ShapeBullet(),
|
||||
meshShape(NULL) {}
|
||||
meshShape(nullptr) {}
|
||||
|
||||
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
|
||||
if (meshShape) {
|
||||
|
|
@ -425,7 +425,7 @@ void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) {
|
|||
btGenerateInternalEdgeInfo(meshShape, triangleInfoMap);
|
||||
}
|
||||
} else {
|
||||
meshShape = NULL;
|
||||
meshShape = nullptr;
|
||||
ERR_PRINT("The faces count are 0, the mesh shape cannot be created");
|
||||
}
|
||||
notifyShapeChanged();
|
||||
|
|
@ -434,7 +434,7 @@ void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) {
|
|||
btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
|
||||
btCollisionShape *cs = ShapeBullet::create_shape_concave(meshShape);
|
||||
if (!cs)
|
||||
// This is necessary since if 0 faces the creation of concave return NULL
|
||||
// This is necessary since if 0 faces the creation of concave return null
|
||||
cs = ShapeBullet::create_shape_empty();
|
||||
cs->setLocalScaling(p_implicit_scale);
|
||||
prepare(cs);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
SoftBodyBullet::SoftBodyBullet() :
|
||||
CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY),
|
||||
bt_soft_body(NULL),
|
||||
bt_soft_body(nullptr),
|
||||
isScratched(false),
|
||||
simulation_precision(5),
|
||||
total_mass(1.),
|
||||
|
|
@ -144,7 +144,7 @@ void SoftBodyBullet::destroy_soft_body() {
|
|||
}
|
||||
|
||||
destroyBulletCollisionObject();
|
||||
bt_soft_body = NULL;
|
||||
bt_soft_body = nullptr;
|
||||
}
|
||||
|
||||
void SoftBodyBullet::set_soft_transform(const Transform &p_transform) {
|
||||
|
|
@ -404,7 +404,7 @@ void SoftBodyBullet::setup_soft_body() {
|
|||
|
||||
// Soft body setup
|
||||
setupBulletCollisionObject(bt_soft_body);
|
||||
bt_soft_body->m_worldInfo = NULL; // Remove fake world info
|
||||
bt_soft_body->m_worldInfo = nullptr; // Remove fake world info
|
||||
bt_soft_body->getCollisionShape()->setMargin(0.01);
|
||||
bt_soft_body->setCollisionFlags(bt_soft_body->getCollisionFlags() & (~(btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT)));
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
|
|||
r_result.shape = btResult.m_shapeId;
|
||||
r_result.rid = gObj->get_self();
|
||||
r_result.collider_id = gObj->get_instance_id();
|
||||
r_result.collider = r_result.collider_id.is_null() ? NULL : ObjectDB::get_instance(r_result.collider_id);
|
||||
r_result.collider = r_result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(r_result.collider_id);
|
||||
} else {
|
||||
WARN_PRINT("The raycast performed has hit a collision object that is not part of Godot scene, please check it.");
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
|
|||
|
||||
btPointCollector result;
|
||||
btGjkPairDetector gjk_pair_detector(&point_shape, convex_shape, space->gjk_simplex_solver, space->gjk_epa_pen_solver);
|
||||
gjk_pair_detector.getClosestPoints(input, result, 0);
|
||||
gjk_pair_detector.getClosestPoints(input, result, nullptr);
|
||||
|
||||
if (out_distance > result.m_distance) {
|
||||
out_distance = result.m_distance;
|
||||
|
|
@ -332,14 +332,14 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
|
|||
}
|
||||
|
||||
SpaceBullet::SpaceBullet() :
|
||||
broadphase(NULL),
|
||||
collisionConfiguration(NULL),
|
||||
dispatcher(NULL),
|
||||
solver(NULL),
|
||||
dynamicsWorld(NULL),
|
||||
soft_body_world_info(NULL),
|
||||
ghostPairCallback(NULL),
|
||||
godotFilterCallback(NULL),
|
||||
broadphase(nullptr),
|
||||
collisionConfiguration(nullptr),
|
||||
dispatcher(nullptr),
|
||||
solver(nullptr),
|
||||
dynamicsWorld(nullptr),
|
||||
soft_body_world_info(nullptr),
|
||||
ghostPairCallback(nullptr),
|
||||
godotFilterCallback(nullptr),
|
||||
gravityDirection(0, -1, 0),
|
||||
gravityMagnitude(10),
|
||||
contactDebugCount(0),
|
||||
|
|
@ -511,7 +511,7 @@ void SpaceBullet::remove_soft_body(SoftBodyBullet *p_body) {
|
|||
if (is_using_soft_world()) {
|
||||
if (p_body->get_bt_soft_body()) {
|
||||
static_cast<btSoftRigidDynamicsWorld *>(dynamicsWorld)->removeSoftBody(p_body->get_bt_soft_body());
|
||||
p_body->get_bt_soft_body()->m_worldInfo = NULL;
|
||||
p_body->get_bt_soft_body()->m_worldInfo = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ void SpaceBullet::remove_all_collision_objects() {
|
|||
for (int i = dynamicsWorld->getNumCollisionObjects() - 1; 0 <= i; --i) {
|
||||
btCollisionObject *btObj = dynamicsWorld->getCollisionObjectArray()[i];
|
||||
CollisionObjectBullet *colObj = static_cast<CollisionObjectBullet *>(btObj->getUserPointer());
|
||||
colObj->set_space(NULL);
|
||||
colObj->set_space(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -636,8 +636,8 @@ void SpaceBullet::destroy_world() {
|
|||
|
||||
/// The world elements (like: Collision Objects, Constraints, Shapes) are managed by godot
|
||||
|
||||
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(NULL);
|
||||
dynamicsWorld->getPairCache()->setOverlapFilterCallback(NULL);
|
||||
dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(nullptr);
|
||||
dynamicsWorld->getPairCache()->setOverlapFilterCallback(nullptr);
|
||||
|
||||
bulletdelete(ghostPairCallback);
|
||||
bulletdelete(godotFilterCallback);
|
||||
|
|
@ -645,7 +645,7 @@ void SpaceBullet::destroy_world() {
|
|||
// Deallocate world
|
||||
dynamicsWorld->~btDiscreteDynamicsWorld();
|
||||
free(dynamicsWorld);
|
||||
dynamicsWorld = NULL;
|
||||
dynamicsWorld = nullptr;
|
||||
|
||||
bulletdelete(solver);
|
||||
bulletdelete(broadphase);
|
||||
|
|
@ -741,7 +741,7 @@ void SpaceBullet::check_ghost_overlaps() {
|
|||
static_cast<btConvexShape *>(other_body_shape),
|
||||
gjk_simplex_solver,
|
||||
gjk_epa_pen_solver);
|
||||
gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
|
||||
gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr);
|
||||
|
||||
if (0 >= result.m_distance) {
|
||||
hasOverlap = true;
|
||||
|
|
@ -750,10 +750,10 @@ void SpaceBullet::check_ghost_overlaps() {
|
|||
|
||||
} else {
|
||||
|
||||
btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
|
||||
btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
|
||||
btCollisionObjectWrapper obA(nullptr, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
|
||||
btCollisionObjectWrapper obB(nullptr, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
|
||||
|
||||
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
|
||||
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS);
|
||||
|
||||
if (!algorithm)
|
||||
continue;
|
||||
|
|
@ -885,8 +885,8 @@ void SpaceBullet::update_gravity() {
|
|||
|
||||
#include "scene/3d/immediate_geometry.h"
|
||||
|
||||
static ImmediateGeometry3D *motionVec(NULL);
|
||||
static ImmediateGeometry3D *normalLine(NULL);
|
||||
static ImmediateGeometry3D *motionVec(nullptr);
|
||||
static ImmediateGeometry3D *normalLine(nullptr);
|
||||
static Ref<StandardMaterial3D> red_mat;
|
||||
static Ref<StandardMaterial3D> blue_mat;
|
||||
#endif
|
||||
|
|
@ -951,7 +951,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
|
|||
Vector3 sup_line;
|
||||
B_TO_G(body_safe_position.getOrigin(), sup_line);
|
||||
motionVec->clear();
|
||||
motionVec->begin(Mesh::PRIMITIVE_LINES, NULL);
|
||||
motionVec->begin(Mesh::PRIMITIVE_LINES, nullptr);
|
||||
motionVec->add_vertex(sup_line);
|
||||
motionVec->add_vertex(sup_line + p_motion * 10);
|
||||
motionVec->end();
|
||||
|
|
@ -1028,7 +1028,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
|
|||
Vector3 sup_line2;
|
||||
B_TO_G(motion, sup_line2);
|
||||
normalLine->clear();
|
||||
normalLine->begin(Mesh::PRIMITIVE_LINES, NULL);
|
||||
normalLine->begin(Mesh::PRIMITIVE_LINES, nullptr);
|
||||
normalLine->add_vertex(r_result->collision_point);
|
||||
normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10);
|
||||
normalLine->end();
|
||||
|
|
@ -1124,7 +1124,7 @@ public:
|
|||
|
||||
if (cs->getNumChildShapes() > 1) {
|
||||
const btDbvt *tree = cs->getDynamicAabbTree();
|
||||
ERR_FAIL_COND_V(tree == NULL, true);
|
||||
ERR_FAIL_COND_V(tree == nullptr, true);
|
||||
|
||||
// Transform bounds into compound shape local space
|
||||
const btTransform other_in_compound_space = co->getWorldTransform().inverse();
|
||||
|
|
@ -1275,7 +1275,7 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt
|
|||
// Perform GJK test
|
||||
btPointCollector result;
|
||||
btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver);
|
||||
gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
|
||||
gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr);
|
||||
if (0 > result.m_distance) {
|
||||
// Has penetration
|
||||
r_delta_recover_movement += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale);
|
||||
|
|
@ -1302,10 +1302,10 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
|
|||
|
||||
btTransform tA(p_transformA);
|
||||
|
||||
btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A);
|
||||
btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
|
||||
btCollisionObjectWrapper obA(nullptr, p_shapeA, p_objectA, tA, -1, p_shapeId_A);
|
||||
btCollisionObjectWrapper obB(nullptr, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
|
||||
|
||||
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
|
||||
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS);
|
||||
if (algorithm) {
|
||||
GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
|
||||
//discrete collision detection query
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public:
|
|||
virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false);
|
||||
virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = NULL);
|
||||
virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr);
|
||||
/// Returns the list of contacts pairs in this order: Local contact, other body contact
|
||||
virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
|
||||
|
|
@ -201,17 +201,17 @@ private:
|
|||
pointWorld(0, 0, 0),
|
||||
penetration_distance(1e20),
|
||||
other_compound_shape_index(0),
|
||||
other_collision_object(NULL),
|
||||
other_collision_object(nullptr),
|
||||
local_shape_most_recovered(0) {}
|
||||
};
|
||||
|
||||
bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
|
||||
bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
|
||||
/// This is an API that recover a kinematic object from penetration
|
||||
/// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions
|
||||
bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
|
||||
bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
|
||||
/// This is an API that recover a kinematic object from penetration
|
||||
/// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
|
||||
bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
|
||||
bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
|
||||
|
||||
int add_separation_result(PhysicsServer3D::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
|
||||
int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results);
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ CSGBrush *CSGShape3D::_get_brush() {
|
|||
if (brush) {
|
||||
memdelete(brush);
|
||||
}
|
||||
brush = NULL;
|
||||
brush = nullptr;
|
||||
|
||||
CSGBrush *n = _build_brush();
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ void CSGShape3D::_update_shape() {
|
|||
mkif.m_getPosition = mikktGetPosition;
|
||||
mkif.m_getTexCoord = mikktGetTexCoord;
|
||||
mkif.m_setTSpace = mikktSetTSpaceDefault;
|
||||
mkif.m_setTSpaceBasic = NULL;
|
||||
mkif.m_setTSpaceBasic = nullptr;
|
||||
|
||||
SMikkTSpaceContext msc;
|
||||
msc.m_pInterface = &mkif;
|
||||
|
|
@ -536,7 +536,7 @@ void CSGShape3D::_notification(int p_what) {
|
|||
|
||||
if (parent)
|
||||
parent->_make_dirty();
|
||||
parent = NULL;
|
||||
parent = nullptr;
|
||||
|
||||
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
|
||||
PhysicsServer3D::get_singleton()->free(root_collision_instance);
|
||||
|
|
@ -636,8 +636,8 @@ void CSGShape3D::_bind_methods() {
|
|||
|
||||
CSGShape3D::CSGShape3D() {
|
||||
operation = OPERATION_UNION;
|
||||
parent = NULL;
|
||||
brush = NULL;
|
||||
parent = nullptr;
|
||||
brush = nullptr;
|
||||
dirty = false;
|
||||
snap = 0.001;
|
||||
use_collision = false;
|
||||
|
|
@ -650,14 +650,14 @@ CSGShape3D::CSGShape3D() {
|
|||
CSGShape3D::~CSGShape3D() {
|
||||
if (brush) {
|
||||
memdelete(brush);
|
||||
brush = NULL;
|
||||
brush = nullptr;
|
||||
}
|
||||
}
|
||||
//////////////////////////////////
|
||||
|
||||
CSGBrush *CSGCombiner3D::_build_brush() {
|
||||
|
||||
return NULL; //does not build anything
|
||||
return nullptr; //does not build anything
|
||||
}
|
||||
|
||||
CSGCombiner3D::CSGCombiner3D() {
|
||||
|
|
@ -713,7 +713,7 @@ CSGPrimitive3D::CSGPrimitive3D() {
|
|||
CSGBrush *CSGMesh3D::_build_brush() {
|
||||
|
||||
if (!mesh.is_valid())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Vector<Vector3> vertices;
|
||||
Vector<bool> smooth;
|
||||
|
|
@ -731,7 +731,7 @@ CSGBrush *CSGMesh3D::_build_brush() {
|
|||
|
||||
if (arrays.size() == 0) {
|
||||
_make_dirty();
|
||||
ERR_FAIL_COND_V(arrays.size() == 0, NULL);
|
||||
ERR_FAIL_COND_V(arrays.size() == 0, nullptr);
|
||||
}
|
||||
|
||||
Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX];
|
||||
|
|
@ -741,13 +741,13 @@ CSGBrush *CSGMesh3D::_build_brush() {
|
|||
const Vector3 *vr = avertices.ptr();
|
||||
|
||||
Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL];
|
||||
const Vector3 *nr = NULL;
|
||||
const Vector3 *nr = nullptr;
|
||||
if (anormals.size()) {
|
||||
nr = anormals.ptr();
|
||||
}
|
||||
|
||||
Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV];
|
||||
const Vector2 *uvr = NULL;
|
||||
const Vector2 *uvr = nullptr;
|
||||
if (auvs.size()) {
|
||||
uvr = auvs.ptr();
|
||||
}
|
||||
|
|
@ -853,7 +853,7 @@ CSGBrush *CSGMesh3D::_build_brush() {
|
|||
}
|
||||
|
||||
if (vertices.size() == 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return _create_brush_from_arrays(vertices, uvs, smooth, materials);
|
||||
}
|
||||
|
|
@ -1535,7 +1535,7 @@ CSGBrush *CSGTorus3D::_build_brush() {
|
|||
float max_radius = outer_radius;
|
||||
|
||||
if (min_radius == max_radius)
|
||||
return NULL; //sorry, can't
|
||||
return nullptr; //sorry, can't
|
||||
|
||||
if (min_radius > max_radius) {
|
||||
SWAP(min_radius, max_radius);
|
||||
|
|
@ -1760,7 +1760,7 @@ CSGBrush *CSGPolygon3D::_build_brush() {
|
|||
// set our bounding box
|
||||
|
||||
if (polygon.size() < 3)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Vector<Point2> final_polygon = polygon;
|
||||
|
||||
|
|
@ -1771,9 +1771,9 @@ CSGBrush *CSGPolygon3D::_build_brush() {
|
|||
Vector<int> triangles = Geometry::triangulate_polygon(final_polygon);
|
||||
|
||||
if (triangles.size() < 3)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Path3D *path = NULL;
|
||||
Path3D *path = nullptr;
|
||||
Ref<Curve3D> curve;
|
||||
|
||||
// get bounds for our polygon
|
||||
|
|
@ -1796,32 +1796,32 @@ CSGBrush *CSGPolygon3D::_build_brush() {
|
|||
|
||||
if (mode == MODE_PATH) {
|
||||
if (!has_node(path_node))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
Node *n = get_node(path_node);
|
||||
if (!n)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
path = Object::cast_to<Path3D>(n);
|
||||
if (!path)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (path != path_cache) {
|
||||
if (path_cache) {
|
||||
path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
|
||||
path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
|
||||
path_cache = NULL;
|
||||
path_cache = nullptr;
|
||||
}
|
||||
|
||||
path_cache = path;
|
||||
|
||||
path_cache->connect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
|
||||
path_cache->connect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
|
||||
path_cache = NULL;
|
||||
path_cache = nullptr;
|
||||
}
|
||||
curve = path->get_curve();
|
||||
if (curve.is_null())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (curve->get_baked_length() <= 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
CSGBrush *brush = memnew(CSGBrush);
|
||||
|
||||
|
|
@ -2232,7 +2232,7 @@ void CSGPolygon3D::_notification(int p_what) {
|
|||
if (path_cache) {
|
||||
path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
|
||||
path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
|
||||
path_cache = NULL;
|
||||
path_cache = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2257,7 +2257,7 @@ void CSGPolygon3D::_path_changed() {
|
|||
}
|
||||
|
||||
void CSGPolygon3D::_path_exited() {
|
||||
path_cache = NULL;
|
||||
path_cache = nullptr;
|
||||
}
|
||||
|
||||
void CSGPolygon3D::_bind_methods() {
|
||||
|
|
@ -2483,5 +2483,5 @@ CSGPolygon3D::CSGPolygon3D() {
|
|||
path_local = false;
|
||||
path_continuous_u = false;
|
||||
path_joined = false;
|
||||
path_cache = NULL;
|
||||
path_cache = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
class ResourceFormatDDS : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
|
|||
p_in_bandwidth /* limit incoming bandwidth if > 0 */,
|
||||
p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
|
||||
} else {
|
||||
host = enet_host_create(NULL /* create a client host */,
|
||||
host = enet_host_create(nullptr /* create a client host */,
|
||||
1 /* only allow 1 outgoing connection */,
|
||||
channel_count /* allow up to channel_count to be used */,
|
||||
p_in_bandwidth /* limit incoming bandwidth if > 0 */,
|
||||
|
|
@ -197,7 +197,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
|
|||
// Initiate connection, allocating enough channels
|
||||
ENetPeer *peer = enet_host_connect(host, &address, channel_count, unique_id);
|
||||
|
||||
if (peer == NULL) {
|
||||
if (peer == nullptr) {
|
||||
enet_host_destroy(host);
|
||||
ERR_FAIL_COND_V_MSG(!peer, ERR_CANT_CREATE, "Couldn't connect to the ENet multiplayer server.");
|
||||
}
|
||||
|
|
@ -276,12 +276,12 @@ void NetworkedMultiplayerENet::poll() {
|
|||
if (E->key() == *new_id)
|
||||
continue;
|
||||
// Send existing peers to new peer
|
||||
ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]);
|
||||
encode_uint32(E->key(), &packet->data[4]);
|
||||
enet_peer_send(event.peer, SYSCH_CONFIG, packet);
|
||||
// Send the new peer to existing peers
|
||||
packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]);
|
||||
encode_uint32(*new_id, &packet->data[4]);
|
||||
enet_peer_send(E->get(), SYSCH_CONFIG, packet);
|
||||
|
|
@ -320,7 +320,7 @@ void NetworkedMultiplayerENet::poll() {
|
|||
if (E->key() == *id)
|
||||
continue;
|
||||
|
||||
ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]);
|
||||
encode_uint32(*id, &packet->data[4]);
|
||||
enet_peer_send(E->get(), SYSCH_CONFIG, packet);
|
||||
|
|
@ -346,7 +346,7 @@ void NetworkedMultiplayerENet::poll() {
|
|||
switch (msg) {
|
||||
case SYSMSG_ADD_PEER: {
|
||||
|
||||
peer_map[id] = NULL;
|
||||
peer_map[id] = nullptr;
|
||||
emit_signal("peer_connected", id);
|
||||
|
||||
} break;
|
||||
|
|
@ -502,7 +502,7 @@ void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) {
|
|||
continue;
|
||||
}
|
||||
|
||||
ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
|
||||
encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]);
|
||||
encode_uint32(p_peer, &packet->data[4]);
|
||||
enet_peer_send(E->get(), SYSCH_CONFIG, packet);
|
||||
|
|
@ -568,7 +568,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
|
|||
if (transfer_channel > SYSCH_CONFIG)
|
||||
channel = transfer_channel;
|
||||
|
||||
Map<int, ENetPeer *>::Element *E = NULL;
|
||||
Map<int, ENetPeer *>::Element *E = nullptr;
|
||||
|
||||
if (target_peer != 0) {
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
|
|||
ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, vformat("Invalid target peer: %d", target_peer));
|
||||
}
|
||||
|
||||
ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags);
|
||||
ENetPacket *packet = enet_packet_create(nullptr, p_buffer_size + 8, packet_flags);
|
||||
encode_uint32(unique_id, &packet->data[0]); // Source ID
|
||||
encode_uint32(target_peer, &packet->data[4]); // Dest ID
|
||||
copymem(&packet->data[8], p_buffer, p_buffer_size);
|
||||
|
|
@ -625,7 +625,7 @@ void NetworkedMultiplayerENet::_pop_current_packet() {
|
|||
|
||||
if (current_packet.packet) {
|
||||
enet_packet_destroy(current_packet.packet);
|
||||
current_packet.packet = NULL;
|
||||
current_packet.packet = nullptr;
|
||||
current_packet.from = 0;
|
||||
current_packet.channel = -1;
|
||||
}
|
||||
|
|
@ -771,7 +771,7 @@ void NetworkedMultiplayerENet::_setup_compressor() {
|
|||
|
||||
case COMPRESS_NONE: {
|
||||
|
||||
enet_host_compress(host, NULL);
|
||||
enet_host_compress(host, nullptr);
|
||||
} break;
|
||||
case COMPRESS_RANGE_CODER: {
|
||||
enet_host_compress_with_range_coder(host);
|
||||
|
|
@ -794,7 +794,7 @@ IP_Address NetworkedMultiplayerENet::get_peer_address(int p_peer_id) const {
|
|||
|
||||
ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), IP_Address(), vformat("Peer ID %d not found in the list of peers.", p_peer_id));
|
||||
ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, IP_Address(), "Can't get the address of peers other than the server (ID -1) when acting as a client.");
|
||||
ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
|
||||
ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
|
||||
|
||||
IP_Address out;
|
||||
#ifdef GODOT_ENET
|
||||
|
|
@ -810,7 +810,7 @@ int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const {
|
|||
|
||||
ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), 0, vformat("Peer ID %d not found in the list of peers.", p_peer_id));
|
||||
ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, 0, "Can't get the address of peers other than the server (ID -1) when acting as a client.");
|
||||
ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
|
||||
ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
|
||||
#ifdef GODOT_ENET
|
||||
return peer_map[p_peer_id]->address.port;
|
||||
#else
|
||||
|
|
@ -910,7 +910,7 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
|
|||
server_relay = true;
|
||||
unique_id = 0;
|
||||
target_peer = 0;
|
||||
current_packet.packet = NULL;
|
||||
current_packet.packet = nullptr;
|
||||
transfer_mode = TRANSFER_MODE_RELIABLE;
|
||||
channel_count = SYSCH_MAX;
|
||||
transfer_channel = -1;
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
|
|||
src_rgba_f[j] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]);
|
||||
}
|
||||
|
||||
unsigned char *etc_data = NULL;
|
||||
unsigned char *etc_data = nullptr;
|
||||
unsigned int etc_data_len = 0;
|
||||
unsigned int extended_width = 0, extended_height = 0;
|
||||
Etc::Encode((float *)src_rgba_f, mipmap_w, mipmap_h, etc2comp_etc_format, error_metric, effort, num_cpus, num_cpus, &etc_data, &etc_data_len, &extended_width, &extended_height, &encoding_time);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
class ResourceFormatPKM : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ JNIEnv *GDAPI godot_android_get_env() {
|
|||
#ifdef __ANDROID__
|
||||
return ThreadAndroid::get_env();
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ jobject GDAPI godot_android_get_activity() {
|
|||
OS_Android *os_android = (OS_Android *)OS::get_singleton();
|
||||
return os_android->get_godot_java()->get_activity();
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ jobject GDAPI godot_android_get_surface() {
|
|||
OS_Android *os_android = (OS_Android *)OS::get_singleton();
|
||||
return os_android->get_godot_java()->get_surface();
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,15 +42,15 @@ ARVRInterfaceGDNative::ARVRInterfaceGDNative() {
|
|||
print_verbose("Construct gdnative interface\n");
|
||||
|
||||
// we won't have our data pointer until our library gets set
|
||||
data = NULL;
|
||||
data = nullptr;
|
||||
|
||||
interface = NULL;
|
||||
interface = nullptr;
|
||||
}
|
||||
|
||||
ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
|
||||
print_verbose("Destruct gdnative interface\n");
|
||||
|
||||
if (interface != NULL && is_initialized()) {
|
||||
if (interface != nullptr && is_initialized()) {
|
||||
uninitialize();
|
||||
};
|
||||
|
||||
|
|
@ -59,10 +59,10 @@ ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
|
|||
}
|
||||
|
||||
void ARVRInterfaceGDNative::cleanup() {
|
||||
if (interface != NULL) {
|
||||
if (interface != nullptr) {
|
||||
interface->destructor(data);
|
||||
data = NULL;
|
||||
interface = NULL;
|
||||
data = nullptr;
|
||||
interface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p
|
|||
|
||||
StringName ARVRInterfaceGDNative::get_name() const {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, StringName());
|
||||
ERR_FAIL_COND_V(interface == nullptr, StringName());
|
||||
|
||||
godot_string result = interface->get_name(data);
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ StringName ARVRInterfaceGDNative::get_name() const {
|
|||
int ARVRInterfaceGDNative::get_capabilities() const {
|
||||
int capabilities;
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, 0); // 0 = None
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None
|
||||
|
||||
capabilities = interface->get_capabilities(data);
|
||||
|
||||
|
|
@ -104,21 +104,21 @@ int ARVRInterfaceGDNative::get_capabilities() const {
|
|||
|
||||
bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
|
||||
return interface->get_anchor_detection_is_enabled(data);
|
||||
}
|
||||
|
||||
void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) {
|
||||
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
|
||||
interface->set_anchor_detection_is_enabled(data, p_enable);
|
||||
}
|
||||
|
||||
int ARVRInterfaceGDNative::get_camera_feed_id() {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) {
|
||||
return (unsigned int)interface->get_camera_feed_id(data);
|
||||
|
|
@ -130,7 +130,7 @@ int ARVRInterfaceGDNative::get_camera_feed_id() {
|
|||
bool ARVRInterfaceGDNative::is_stereo() {
|
||||
bool stereo;
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
|
||||
stereo = interface->is_stereo(data);
|
||||
|
||||
|
|
@ -139,13 +139,13 @@ bool ARVRInterfaceGDNative::is_stereo() {
|
|||
|
||||
bool ARVRInterfaceGDNative::is_initialized() const {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
|
||||
return interface->is_initialized(data);
|
||||
}
|
||||
|
||||
bool ARVRInterfaceGDNative::initialize() {
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
|
||||
bool initialized = interface->initialize(data);
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ bool ARVRInterfaceGDNative::initialize() {
|
|||
// if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface
|
||||
|
||||
ARVRServer *arvr_server = ARVRServer::get_singleton();
|
||||
if ((arvr_server != NULL) && (arvr_server->get_primary_interface() == NULL)) {
|
||||
if ((arvr_server != nullptr) && (arvr_server->get_primary_interface() == nullptr)) {
|
||||
arvr_server->set_primary_interface(this);
|
||||
};
|
||||
};
|
||||
|
|
@ -162,10 +162,10 @@ bool ARVRInterfaceGDNative::initialize() {
|
|||
}
|
||||
|
||||
void ARVRInterfaceGDNative::uninitialize() {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
|
||||
ARVRServer *arvr_server = ARVRServer::get_singleton();
|
||||
if (arvr_server != NULL) {
|
||||
if (arvr_server != nullptr) {
|
||||
// Whatever happens, make sure this is no longer our primary interface
|
||||
arvr_server->clear_primary_interface_if(this);
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ void ARVRInterfaceGDNative::uninitialize() {
|
|||
|
||||
Size2 ARVRInterfaceGDNative::get_render_targetsize() {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, Size2());
|
||||
ERR_FAIL_COND_V(interface == nullptr, Size2());
|
||||
|
||||
godot_vector2 result = interface->get_render_targetsize(data);
|
||||
Vector2 *vec = (Vector2 *)&result;
|
||||
|
|
@ -186,7 +186,7 @@ Size2 ARVRInterfaceGDNative::get_render_targetsize() {
|
|||
Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) {
|
||||
Transform *ret;
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, Transform());
|
||||
ERR_FAIL_COND_V(interface == nullptr, Transform());
|
||||
|
||||
godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform);
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye
|
|||
CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
|
||||
CameraMatrix cm;
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, CameraMatrix());
|
||||
ERR_FAIL_COND_V(interface == nullptr, CameraMatrix());
|
||||
|
||||
interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far);
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p
|
|||
|
||||
unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::Eyes p_eye) {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) {
|
||||
return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye);
|
||||
|
|
@ -218,19 +218,19 @@ unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::
|
|||
|
||||
void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) {
|
||||
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
|
||||
interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect);
|
||||
}
|
||||
|
||||
void ARVRInterfaceGDNative::process() {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
|
||||
interface->process(data);
|
||||
}
|
||||
|
||||
void ARVRInterfaceGDNative::notification(int p_what) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
|
||||
// this is only available in interfaces that implement 1.1 or later
|
||||
if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) {
|
||||
|
|
@ -265,7 +265,7 @@ godot_transform GDAPI godot_arvr_get_reference_frame() {
|
|||
Transform *reference_frame_ptr = (Transform *)&reference_frame;
|
||||
|
||||
ARVRServer *arvr_server = ARVRServer::get_singleton();
|
||||
if (arvr_server != NULL) {
|
||||
if (arvr_server != nullptr) {
|
||||
*reference_frame_ptr = arvr_server->get_reference_frame();
|
||||
} else {
|
||||
godot_transform_new_identity(&reference_frame);
|
||||
|
|
@ -360,7 +360,7 @@ void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) {
|
|||
ERR_FAIL_NULL(input);
|
||||
|
||||
ARVRPositionalTracker *remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
|
||||
if (remove_tracker != NULL) {
|
||||
if (remove_tracker != nullptr) {
|
||||
// unset our joystick if applicable
|
||||
int joyid = remove_tracker->get_joy_id();
|
||||
if (joyid != -1) {
|
||||
|
|
@ -379,7 +379,7 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_
|
|||
ERR_FAIL_NULL(arvr_server);
|
||||
|
||||
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
|
||||
if (tracker != NULL) {
|
||||
if (tracker != nullptr) {
|
||||
Transform *transform = (Transform *)p_transform;
|
||||
if (p_tracks_orientation) {
|
||||
tracker->set_orientation(transform->basis);
|
||||
|
|
@ -398,7 +398,7 @@ void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int
|
|||
ERR_FAIL_NULL(input);
|
||||
|
||||
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
|
||||
if (tracker != NULL) {
|
||||
if (tracker != nullptr) {
|
||||
int joyid = tracker->get_joy_id();
|
||||
if (joyid != -1) {
|
||||
input->joy_button(joyid, p_button, p_is_pressed);
|
||||
|
|
@ -414,7 +414,7 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p
|
|||
ERR_FAIL_NULL(input);
|
||||
|
||||
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
|
||||
if (tracker != NULL) {
|
||||
if (tracker != nullptr) {
|
||||
int joyid = tracker->get_joy_id();
|
||||
if (joyid != -1) {
|
||||
InputFilter::JoyAxis jx;
|
||||
|
|
@ -430,7 +430,7 @@ godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) {
|
|||
ERR_FAIL_NULL_V(arvr_server, 0.0);
|
||||
|
||||
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
|
||||
if (tracker != NULL) {
|
||||
if (tracker != nullptr) {
|
||||
return tracker->get_rumble();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ void GDNativeLibrary::_bind_methods() {
|
|||
}
|
||||
|
||||
GDNative::GDNative() {
|
||||
native_handle = NULL;
|
||||
native_handle = nullptr;
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ bool GDNative::initialize() {
|
|||
|
||||
if (err || !library_init) {
|
||||
OS::get_singleton()->close_dynamic_library(native_handle);
|
||||
native_handle = NULL;
|
||||
native_handle = nullptr;
|
||||
ERR_PRINT("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ bool GDNative::terminate() {
|
|||
Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate);
|
||||
if (error || !library_terminate) {
|
||||
OS::get_singleton()->close_dynamic_library(native_handle);
|
||||
native_handle = NULL;
|
||||
native_handle = nullptr;
|
||||
initialized = false;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -426,7 +426,7 @@ bool GDNative::terminate() {
|
|||
// GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
|
||||
|
||||
OS::get_singleton()->close_dynamic_library(native_handle);
|
||||
native_handle = NULL;
|
||||
native_handle = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -466,7 +466,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
|
|||
p_procedure_name,
|
||||
procedure_handle);
|
||||
|
||||
if (err != OK || procedure_handle == NULL) {
|
||||
if (err != OK || procedure_handle == nullptr) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
|
|
@ -544,11 +544,11 @@ Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_reso
|
|||
}
|
||||
|
||||
bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const {
|
||||
return Object::cast_to<GDNativeLibrary>(*p_resource) != NULL;
|
||||
return Object::cast_to<GDNativeLibrary>(*p_resource) != nullptr;
|
||||
}
|
||||
|
||||
void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
|
||||
if (Object::cast_to<GDNativeLibrary>(*p_resource) != NULL) {
|
||||
if (Object::cast_to<GDNativeLibrary>(*p_resource) != nullptr) {
|
||||
p_extensions->push_back("gdnlib");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classnam
|
|||
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname));
|
||||
if (class_info)
|
||||
return (godot_class_constructor)class_info->creation_func;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
godot_dictionary GDAPI godot_get_global_constants() {
|
||||
|
|
@ -173,14 +173,14 @@ godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) {
|
|||
void *godot_get_class_tag(const godot_string_name *p_class) {
|
||||
StringName class_name = *(StringName *)p_class;
|
||||
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name);
|
||||
return class_info ? class_info->class_ptr : NULL;
|
||||
return class_info ? class_info->class_ptr : nullptr;
|
||||
}
|
||||
|
||||
godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) {
|
||||
if (!p_object) return NULL;
|
||||
if (!p_object) return nullptr;
|
||||
Object *o = (Object *)p_object;
|
||||
|
||||
return o->is_class_ptr(p_class_tag) ? (godot_object *)o : NULL;
|
||||
return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ void GDNativeLibraryEditor::_update_tree() {
|
|||
new_arch->set_expand_right(0, true);
|
||||
new_arch->set_metadata(1, E->key());
|
||||
|
||||
platform->set_collapsed(collapsed_items.find(E->get().name) != NULL);
|
||||
platform->set_collapsed(collapsed_items.find(E->get().name) != nullptr);
|
||||
}
|
||||
filter->set_text(text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ typedef struct {
|
|||
//this is used by script languages that keep a reference counter of their own
|
||||
//you can make make Ref<> not die when it reaches zero, so deleting the reference
|
||||
//depends entirely from the script.
|
||||
// Note: You can set those function pointer to NULL if not needed.
|
||||
// Note: You can set those function pointer to nullptr if not needed.
|
||||
void (*refcount_incremented)(godot_pluginscript_instance_data *p_data);
|
||||
bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die
|
||||
} godot_pluginscript_instance_desc;
|
||||
|
|
@ -119,18 +119,18 @@ typedef struct {
|
|||
const char *name;
|
||||
const char *type;
|
||||
const char *extension;
|
||||
const char **recognized_extensions; // NULL terminated array
|
||||
const char **recognized_extensions; // nullptr terminated array
|
||||
godot_pluginscript_language_data *(*init)();
|
||||
void (*finish)(godot_pluginscript_language_data *p_data);
|
||||
const char **reserved_words; // NULL terminated array
|
||||
const char **comment_delimiters; // NULL terminated array
|
||||
const char **string_delimiters; // NULL terminated array
|
||||
const char **reserved_words; // nullptr terminated array
|
||||
const char **comment_delimiters; // nullptr terminated array
|
||||
const char **string_delimiters; // nullptr terminated array
|
||||
godot_bool has_named_classes;
|
||||
godot_bool supports_builtin_mode;
|
||||
|
||||
godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name);
|
||||
godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions);
|
||||
int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL
|
||||
int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be nullptr
|
||||
godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args);
|
||||
godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint);
|
||||
void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static Error save_file(const String &p_path, const List<String> &p_content) {
|
|||
|
||||
ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
|
||||
|
||||
for (const List<String>::Element *e = p_content.front(); e != NULL; e = e->next()) {
|
||||
for (const List<String>::Element *e = p_content.front(); e != nullptr; e = e->next()) {
|
||||
file->store_string(e->get());
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ List<ClassAPI> generate_c_api_classes() {
|
|||
api.push_back(global_constants_api);
|
||||
}
|
||||
|
||||
for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) {
|
||||
for (List<StringName>::Element *e = classes.front(); e != nullptr; e = e->next()) {
|
||||
StringName class_name = e->get();
|
||||
|
||||
ClassAPI class_api;
|
||||
|
|
@ -229,7 +229,7 @@ List<ClassAPI> generate_c_api_classes() {
|
|||
List<String> constant;
|
||||
ClassDB::get_integer_constant_list(class_name, &constant, true);
|
||||
constant.sort_custom<NoCaseComparator>();
|
||||
for (List<String>::Element *c = constant.front(); c != NULL; c = c->next()) {
|
||||
for (List<String>::Element *c = constant.front(); c != nullptr; c = c->next()) {
|
||||
ConstantAPI constant_api;
|
||||
constant_api.constant_name = c->get();
|
||||
constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get());
|
||||
|
|
@ -284,7 +284,7 @@ List<ClassAPI> generate_c_api_classes() {
|
|||
ClassDB::get_property_list(class_name, &properties, true);
|
||||
properties.sort_custom<PropertyInfoComparator>();
|
||||
|
||||
for (List<PropertyInfo>::Element *p = properties.front(); p != NULL; p = p->next()) {
|
||||
for (List<PropertyInfo>::Element *p = properties.front(); p != nullptr; p = p->next()) {
|
||||
PropertyAPI property_api;
|
||||
|
||||
property_api.name = p->get().name;
|
||||
|
|
@ -312,7 +312,7 @@ List<ClassAPI> generate_c_api_classes() {
|
|||
ClassDB::get_method_list(class_name, &methods, true);
|
||||
methods.sort_custom<MethodInfoComparator>();
|
||||
|
||||
for (List<MethodInfo>::Element *m = methods.front(); m != NULL; m = m->next()) {
|
||||
for (List<MethodInfo>::Element *m = methods.front(); m != nullptr; m = m->next()) {
|
||||
MethodAPI method_api;
|
||||
MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name);
|
||||
MethodInfo &method_info = m->get();
|
||||
|
|
@ -392,7 +392,7 @@ List<ClassAPI> generate_c_api_classes() {
|
|||
enum_api.name = E->get();
|
||||
ClassDB::get_enum_constants(class_name, E->get(), &value_names, true);
|
||||
for (List<StringName>::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) {
|
||||
int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), NULL);
|
||||
int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr);
|
||||
enum_api.values.push_back(Pair<int, String>(int_val, val_e->get()));
|
||||
}
|
||||
enum_api.values.sort_custom<PairSort<int, String>>();
|
||||
|
|
@ -417,7 +417,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
|
|||
|
||||
source.push_back("[\n");
|
||||
|
||||
for (const List<ClassAPI>::Element *c = p_api.front(); c != NULL; c = c->next()) {
|
||||
for (const List<ClassAPI>::Element *c = p_api.front(); c != nullptr; c = c->next()) {
|
||||
ClassAPI api = c->get();
|
||||
|
||||
source.push_back("\t{\n");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char
|
|||
}
|
||||
|
||||
} else {
|
||||
desc.base_data = NULL;
|
||||
desc.base_data = nullptr;
|
||||
desc.base_native_type = p_base;
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const
|
|||
}
|
||||
|
||||
} else {
|
||||
desc.base_data = NULL;
|
||||
desc.base_data = nullptr;
|
||||
desc.base_native_type = p_base;
|
||||
}
|
||||
|
||||
|
|
@ -210,11 +210,11 @@ void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const cha
|
|||
void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance) {
|
||||
Object *instance = (Object *)p_instance;
|
||||
if (!instance)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (instance->get_script_instance() && instance->get_script_instance()->get_language() == NativeScriptLanguage::get_singleton()) {
|
||||
return ((NativeScriptInstance *)instance->get_script_instance())->userdata;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -319,18 +319,18 @@ const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object)
|
|||
const Object *o = (Object *)p_object;
|
||||
|
||||
if (!o->get_script_instance()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
NativeScript *script = Object::cast_to<NativeScript>(o->get_script_instance()->get_script().ptr());
|
||||
if (!script) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (script->get_script_desc())
|
||||
return script->get_script_desc()->type_tag;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions) {
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
|
|||
NativeScriptDesc *script_data = get_script_desc();
|
||||
|
||||
if (!script_data) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NativeScriptInstance *nsi = memnew(NativeScriptInstance);
|
||||
|
|
@ -214,7 +214,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
|
|||
|
||||
#ifndef TOOLS_ENABLED
|
||||
if (!ScriptServer::is_scripting_enabled()) {
|
||||
nsi->userdata = NULL;
|
||||
nsi->userdata = nullptr;
|
||||
} else {
|
||||
nsi->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ PlaceHolderScriptInstance *NativeScript::placeholder_instance_create(Object *p_t
|
|||
|
||||
return sins;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -738,7 +738,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
|
|||
r_error.error = Callable::CallError::CALL_OK;
|
||||
|
||||
REF ref;
|
||||
Object *owner = NULL;
|
||||
Object *owner = nullptr;
|
||||
|
||||
if (!(script_data->base_native_type == "")) {
|
||||
owner = ClassDB::instance(script_data->base_native_type);
|
||||
|
|
@ -886,7 +886,7 @@ void NativeScriptInstance::get_property_list(List<PropertyInfo> *p_properties) c
|
|||
E->get().method.method_data,
|
||||
userdata,
|
||||
0,
|
||||
NULL);
|
||||
nullptr);
|
||||
Variant res = *(Variant *)&result;
|
||||
godot_variant_destroy(&result);
|
||||
|
||||
|
|
@ -1007,7 +1007,7 @@ void NativeScriptInstance::notification(int p_notification) {
|
|||
String NativeScriptInstance::to_string(bool *r_valid) {
|
||||
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
|
||||
Callable::CallError ce;
|
||||
Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
|
||||
Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce);
|
||||
if (ce.error == Callable::CallError::CALL_OK) {
|
||||
if (ret.get_type() != Variant::STRING) {
|
||||
if (r_valid)
|
||||
|
|
@ -1026,7 +1026,7 @@ String NativeScriptInstance::to_string(bool *r_valid) {
|
|||
|
||||
void NativeScriptInstance::refcount_incremented() {
|
||||
Callable::CallError err;
|
||||
call("_refcount_incremented", NULL, 0, err);
|
||||
call("_refcount_incremented", nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
|
||||
ERR_PRINT("Failed to invoke _refcount_incremented - should not happen");
|
||||
}
|
||||
|
|
@ -1034,7 +1034,7 @@ void NativeScriptInstance::refcount_incremented() {
|
|||
|
||||
bool NativeScriptInstance::refcount_decremented() {
|
||||
Callable::CallError err;
|
||||
Variant ret = call("_refcount_decremented", NULL, 0, err);
|
||||
Variant ret = call("_refcount_decremented", nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
|
||||
ERR_PRINT("Failed to invoke _refcount_decremented - should not happen");
|
||||
return true; // assume we can destroy the object
|
||||
|
|
@ -1525,14 +1525,14 @@ void NativeScriptLanguage::unregister_binding_functions(int p_idx) {
|
|||
}
|
||||
|
||||
void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_object) {
|
||||
ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), NULL);
|
||||
ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), nullptr);
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, NULL, "Tried to get binding data for a nativescript binding that does not exist.");
|
||||
ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, nullptr, "Tried to get binding data for a nativescript binding that does not exist.");
|
||||
|
||||
Vector<void *> *binding_data = (Vector<void *> *)p_object->get_script_instance_binding(lang_idx);
|
||||
|
||||
if (!binding_data)
|
||||
return NULL; // should never happen.
|
||||
return nullptr; // should never happen.
|
||||
|
||||
if (binding_data->size() <= p_idx) {
|
||||
// okay, add new elements here.
|
||||
|
|
@ -1541,7 +1541,7 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec
|
|||
binding_data->resize(p_idx + 1);
|
||||
|
||||
for (int i = old_size; i <= p_idx; i++) {
|
||||
(*binding_data).write[i] = NULL;
|
||||
(*binding_data).write[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1563,7 +1563,7 @@ void *NativeScriptLanguage::alloc_instance_binding_data(Object *p_object) {
|
|||
binding_data->resize(binding_functions.size());
|
||||
|
||||
for (int i = 0; i < binding_functions.size(); i++) {
|
||||
(*binding_data).write[i] = NULL;
|
||||
(*binding_data).write[i] = nullptr;
|
||||
}
|
||||
|
||||
binding_instances.insert(binding_data);
|
||||
|
|
@ -1652,12 +1652,12 @@ void NativeScriptLanguage::set_global_type_tag(int p_idx, StringName p_class_nam
|
|||
|
||||
const void *NativeScriptLanguage::get_global_type_tag(int p_idx, StringName p_class_name) const {
|
||||
if (!global_type_tags.has(p_idx))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const HashMap<StringName, const void *> &tags = global_type_tags[p_idx];
|
||||
|
||||
if (!tags.has(p_class_name))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const void *tag = tags.get(p_class_name);
|
||||
|
||||
|
|
@ -1956,7 +1956,7 @@ Error ResourceFormatSaverNativeScript::save(const String &p_path, const RES &p_r
|
|||
}
|
||||
|
||||
bool ResourceFormatSaverNativeScript::recognize(const RES &p_resource) const {
|
||||
return Object::cast_to<NativeScript>(*p_resource) != NULL;
|
||||
return Object::cast_to<NativeScript>(*p_resource) != nullptr;
|
||||
}
|
||||
|
||||
void ResourceFormatSaverNativeScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ struct NativeScriptDesc {
|
|||
base(),
|
||||
base_native_type(),
|
||||
documentation(),
|
||||
type_tag(NULL) {
|
||||
type_tag(nullptr) {
|
||||
zeromem(&create_func, sizeof(godot_instance_create_func));
|
||||
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ public:
|
|||
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
|
||||
virtual void get_string_delimiters(List<String> *p_delimiters) const;
|
||||
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
|
||||
virtual Script *create_script() const;
|
||||
virtual bool has_named_classes() const;
|
||||
virtual bool supports_builtin_mode() const;
|
||||
|
|
@ -389,7 +389,7 @@ public:
|
|||
|
||||
inline NativeScriptDesc *NativeScript::get_script_desc() const {
|
||||
Map<StringName, NativeScriptDesc>::Element *E = NativeScriptLanguage::singleton->library_classes[lib_path].find(class_name);
|
||||
return E ? &E->get() : NULL;
|
||||
return E ? &E->get() : nullptr;
|
||||
}
|
||||
|
||||
class NativeReloadNode : public Node {
|
||||
|
|
@ -406,7 +406,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "multiplayer_peer_gdnative.h"
|
||||
|
||||
MultiplayerPeerGDNative::MultiplayerPeerGDNative() {
|
||||
interface = NULL;
|
||||
interface = nullptr;
|
||||
}
|
||||
|
||||
MultiplayerPeerGDNative::~MultiplayerPeerGDNative() {
|
||||
|
|
@ -42,73 +42,73 @@ void MultiplayerPeerGDNative::set_native_multiplayer_peer(const godot_net_multip
|
|||
}
|
||||
|
||||
Error MultiplayerPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
|
||||
}
|
||||
|
||||
Error MultiplayerPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
|
||||
}
|
||||
|
||||
int MultiplayerPeerGDNative::get_max_packet_size() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_max_packet_size(interface->data);
|
||||
}
|
||||
|
||||
int MultiplayerPeerGDNative::get_available_packet_count() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_available_packet_count(interface->data);
|
||||
}
|
||||
|
||||
/* NetworkedMultiplayerPeer */
|
||||
void MultiplayerPeerGDNative::set_transfer_mode(TransferMode p_mode) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->set_transfer_mode(interface->data, (godot_int)p_mode);
|
||||
}
|
||||
|
||||
NetworkedMultiplayerPeer::TransferMode MultiplayerPeerGDNative::get_transfer_mode() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, TRANSFER_MODE_UNRELIABLE);
|
||||
ERR_FAIL_COND_V(interface == nullptr, TRANSFER_MODE_UNRELIABLE);
|
||||
return (TransferMode)interface->get_transfer_mode(interface->data);
|
||||
}
|
||||
|
||||
void MultiplayerPeerGDNative::set_target_peer(int p_peer_id) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->set_target_peer(interface->data, p_peer_id);
|
||||
}
|
||||
|
||||
int MultiplayerPeerGDNative::get_packet_peer() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_packet_peer(interface->data);
|
||||
}
|
||||
|
||||
bool MultiplayerPeerGDNative::is_server() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
return interface->is_server(interface->data);
|
||||
}
|
||||
|
||||
void MultiplayerPeerGDNative::poll() {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->poll(interface->data);
|
||||
}
|
||||
|
||||
int MultiplayerPeerGDNative::get_unique_id() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_unique_id(interface->data);
|
||||
}
|
||||
|
||||
void MultiplayerPeerGDNative::set_refuse_new_connections(bool p_enable) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->set_refuse_new_connections(interface->data, p_enable);
|
||||
}
|
||||
|
||||
bool MultiplayerPeerGDNative::is_refusing_new_connections() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, true);
|
||||
ERR_FAIL_COND_V(interface == nullptr, true);
|
||||
return interface->is_refusing_new_connections(interface->data);
|
||||
}
|
||||
|
||||
NetworkedMultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, CONNECTION_DISCONNECTED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, CONNECTION_DISCONNECTED);
|
||||
return (ConnectionStatus)interface->get_connection_status(interface->data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "packet_peer_gdnative.h"
|
||||
|
||||
PacketPeerGDNative::PacketPeerGDNative() {
|
||||
interface = NULL;
|
||||
interface = nullptr;
|
||||
}
|
||||
|
||||
PacketPeerGDNative::~PacketPeerGDNative() {
|
||||
|
|
@ -45,22 +45,22 @@ void PacketPeerGDNative::_bind_methods() {
|
|||
}
|
||||
|
||||
Error PacketPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
|
||||
}
|
||||
|
||||
Error PacketPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
|
||||
}
|
||||
|
||||
int PacketPeerGDNative::get_max_packet_size() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_max_packet_size(interface->data);
|
||||
}
|
||||
|
||||
int PacketPeerGDNative::get_available_packet_count() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_available_packet_count(interface->data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "stream_peer_gdnative.h"
|
||||
|
||||
StreamPeerGDNative::StreamPeerGDNative() {
|
||||
interface = NULL;
|
||||
interface = nullptr;
|
||||
}
|
||||
|
||||
StreamPeerGDNative::~StreamPeerGDNative() {
|
||||
|
|
@ -45,27 +45,27 @@ void StreamPeerGDNative::_bind_methods() {
|
|||
}
|
||||
|
||||
Error StreamPeerGDNative::put_data(const uint8_t *p_data, int p_bytes) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)(interface->put_data(interface->data, p_data, p_bytes));
|
||||
}
|
||||
|
||||
Error StreamPeerGDNative::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)(interface->put_partial_data(interface->data, p_data, p_bytes, &r_sent));
|
||||
}
|
||||
|
||||
Error StreamPeerGDNative::get_data(uint8_t *p_buffer, int p_bytes) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)(interface->get_data(interface->data, p_buffer, p_bytes));
|
||||
}
|
||||
|
||||
Error StreamPeerGDNative::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
|
||||
ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
|
||||
return (Error)(interface->get_partial_data(interface->data, p_buffer, p_bytes, &r_received));
|
||||
}
|
||||
|
||||
int StreamPeerGDNative::get_available_bytes() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_available_bytes(interface->data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ bool PluginScriptInstance::init(PluginScript *p_script, Object *p_owner) {
|
|||
_script = Ref<PluginScript>(p_script);
|
||||
_desc = &p_script->_desc->instance_desc;
|
||||
_data = _desc->init(p_script->_data, (godot_object *)p_owner);
|
||||
ERR_FAIL_COND_V(_data == NULL, false);
|
||||
ERR_FAIL_COND_V(_data == nullptr, false);
|
||||
p_owner->set_script_instance(this);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual bool set(const StringName &p_name, const Variant &p_value);
|
||||
virtual bool get(const StringName &p_name, Variant &r_ret) const;
|
||||
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
|
||||
|
||||
virtual void get_method_list(List<MethodInfo> *p_list) const;
|
||||
virtual bool has_method(const StringName &p_method) const;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public:
|
|||
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
|
||||
virtual void get_string_delimiters(List<String> *p_delimiters) const;
|
||||
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
|
||||
virtual Script *create_script() const;
|
||||
virtual bool has_named_classes() const;
|
||||
virtual bool supports_builtin_mode() const;
|
||||
|
|
|
|||
|
|
@ -109,5 +109,5 @@ void ResourceFormatSaverPluginScript::get_recognized_extensions(const RES &p_res
|
|||
|
||||
bool ResourceFormatSaverPluginScript::recognize(const RES &p_resource) const {
|
||||
|
||||
return Object::cast_to<PluginScript>(*p_resource) != NULL;
|
||||
return Object::cast_to<PluginScript>(*p_resource) != nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader {
|
|||
|
||||
public:
|
||||
ResourceFormatLoaderPluginScript(PluginScriptLanguage *language);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int
|
|||
} else {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
memdelete(instance);
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
// Construct
|
||||
|
|
@ -93,7 +93,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
|
|||
}
|
||||
|
||||
REF ref;
|
||||
Object *owner = NULL;
|
||||
Object *owner = nullptr;
|
||||
|
||||
if (get_instance_base_type() == "") {
|
||||
owner = memnew(Reference);
|
||||
|
|
@ -175,7 +175,7 @@ void PluginScript::update_exports() {
|
|||
|
||||
// TODO: rename p_this "p_owner" ?
|
||||
ScriptInstance *PluginScript::instance_create(Object *p_this) {
|
||||
ASSERT_SCRIPT_VALID_V(NULL);
|
||||
ASSERT_SCRIPT_VALID_V(nullptr);
|
||||
// TODO check script validity ?
|
||||
if (!_tool && !ScriptServer::is_scripting_enabled()) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
|
@ -185,7 +185,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
|
|||
update_exports();
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -197,12 +197,12 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
|
|||
// if (EngineDebugger::is_active()) {
|
||||
// _language->debug_break_parse(get_path(), 0, msg);
|
||||
// }
|
||||
ERR_FAIL_V_MSG(NULL, msg);
|
||||
ERR_FAIL_V_MSG(nullptr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
Callable::CallError unchecked_error;
|
||||
return _create_instance(NULL, 0, p_this, unchecked_error);
|
||||
return _create_instance(nullptr, 0, p_this, unchecked_error);
|
||||
}
|
||||
|
||||
bool PluginScript::instance_has(const Object *p_this) const {
|
||||
|
|
@ -296,7 +296,7 @@ Error PluginScript::reload(bool p_keep_state) {
|
|||
_tool = manifest.is_tool;
|
||||
|
||||
Dictionary *members = (Dictionary *)&manifest.member_lines;
|
||||
for (const Variant *key = members->next(); key != NULL; key = members->next(key)) {
|
||||
for (const Variant *key = members->next(); key != nullptr; key = members->next(key)) {
|
||||
_member_lines[*key] = (*members)[*key];
|
||||
}
|
||||
Array *methods = (Array *)&manifest.methods;
|
||||
|
|
@ -366,14 +366,14 @@ Error PluginScript::reload(bool p_keep_state) {
|
|||
|
||||
void PluginScript::get_script_method_list(List<MethodInfo> *r_methods) const {
|
||||
ASSERT_SCRIPT_VALID();
|
||||
for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != NULL; e = e->next()) {
|
||||
for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != nullptr; e = e->next()) {
|
||||
r_methods->push_back(e->get());
|
||||
}
|
||||
}
|
||||
|
||||
void PluginScript::get_script_property_list(List<PropertyInfo> *r_properties) const {
|
||||
ASSERT_SCRIPT_VALID();
|
||||
for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != NULL; e = e->next()) {
|
||||
for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != nullptr; e = e->next()) {
|
||||
r_properties->push_back(e->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -386,7 +386,7 @@ bool PluginScript::has_method(const StringName &p_method) const {
|
|||
MethodInfo PluginScript::get_method_info(const StringName &p_method) const {
|
||||
ASSERT_SCRIPT_VALID_V(MethodInfo());
|
||||
const Map<StringName, MethodInfo>::Element *e = _methods_info.find(p_method);
|
||||
if (e != NULL) {
|
||||
if (e != nullptr) {
|
||||
return e->get();
|
||||
} else {
|
||||
return MethodInfo();
|
||||
|
|
@ -401,7 +401,7 @@ bool PluginScript::has_property(const StringName &p_method) const {
|
|||
PropertyInfo PluginScript::get_property_info(const StringName &p_property) const {
|
||||
ASSERT_SCRIPT_VALID_V(PropertyInfo());
|
||||
const Map<StringName, PropertyInfo>::Element *e = _properties_info.find(p_property);
|
||||
if (e != NULL) {
|
||||
if (e != nullptr) {
|
||||
return e->get();
|
||||
} else {
|
||||
return PropertyInfo();
|
||||
|
|
@ -412,7 +412,7 @@ bool PluginScript::get_property_default_value(const StringName &p_property, Vari
|
|||
ASSERT_SCRIPT_VALID_V(false);
|
||||
#ifdef TOOLS_ENABLED
|
||||
const Map<StringName, Variant>::Element *e = _properties_default_values.find(p_property);
|
||||
if (e != NULL) {
|
||||
if (e != nullptr) {
|
||||
r_value = e->get();
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -462,7 +462,7 @@ bool PluginScript::has_script_signal(const StringName &p_signal) const {
|
|||
|
||||
void PluginScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
|
||||
ASSERT_SCRIPT_VALID();
|
||||
for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != NULL; e = e->next()) {
|
||||
for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != nullptr; e = e->next()) {
|
||||
r_signals->push_back(e->get());
|
||||
}
|
||||
}
|
||||
|
|
@ -543,9 +543,9 @@ MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
|
|||
}
|
||||
|
||||
PluginScript::PluginScript() :
|
||||
_data(NULL),
|
||||
_desc(NULL),
|
||||
_language(NULL),
|
||||
_data(nullptr),
|
||||
_desc(nullptr),
|
||||
_language(nullptr),
|
||||
_tool(false),
|
||||
_valid(false),
|
||||
_script_list(this) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include "core/project_settings.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
VideoDecoderServer *VideoDecoderServer::instance = NULL;
|
||||
VideoDecoderServer *VideoDecoderServer::instance = nullptr;
|
||||
|
||||
static VideoDecoderServer decoder_server;
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interfac
|
|||
// VideoStreamPlaybackGDNative starts here.
|
||||
|
||||
bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
file = FileAccess::open(p_file, FileAccess::READ);
|
||||
bool file_opened = interface->open_file(data_struct, file);
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
|
|||
return;
|
||||
}
|
||||
time += p_delta;
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->update(data_struct, p_delta);
|
||||
|
||||
// Don't mix if there's no audio (num_channels == 0).
|
||||
|
|
@ -189,7 +189,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
|
|||
void VideoStreamPlaybackGDNative::update_texture() {
|
||||
PackedByteArray *pba = (PackedByteArray *)interface->get_videoframe(data_struct);
|
||||
|
||||
if (pba == NULL) {
|
||||
if (pba == nullptr) {
|
||||
playing = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -205,19 +205,19 @@ VideoStreamPlaybackGDNative::VideoStreamPlaybackGDNative() :
|
|||
texture(Ref<ImageTexture>(memnew(ImageTexture))),
|
||||
playing(false),
|
||||
paused(false),
|
||||
mix_udata(NULL),
|
||||
mix_callback(NULL),
|
||||
mix_udata(nullptr),
|
||||
mix_callback(nullptr),
|
||||
num_channels(-1),
|
||||
time(0),
|
||||
seek_backward(false),
|
||||
mix_rate(0),
|
||||
delay_compensation(0),
|
||||
pcm(NULL),
|
||||
pcm(nullptr),
|
||||
pcm_write_idx(0),
|
||||
samples_decoded(0),
|
||||
file(NULL),
|
||||
interface(NULL),
|
||||
data_struct(NULL) {}
|
||||
file(nullptr),
|
||||
interface(nullptr),
|
||||
data_struct(nullptr) {}
|
||||
|
||||
VideoStreamPlaybackGDNative::~VideoStreamPlaybackGDNative() {
|
||||
cleanup();
|
||||
|
|
@ -228,16 +228,16 @@ void VideoStreamPlaybackGDNative::cleanup() {
|
|||
interface->destructor(data_struct);
|
||||
if (pcm)
|
||||
memfree(pcm);
|
||||
pcm = NULL;
|
||||
pcm = nullptr;
|
||||
time = 0;
|
||||
num_channels = -1;
|
||||
interface = NULL;
|
||||
data_struct = NULL;
|
||||
interface = nullptr;
|
||||
data_struct = nullptr;
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::set_interface(const godot_videodecoder_interface_gdnative *p_interface) {
|
||||
ERR_FAIL_COND(p_interface == NULL);
|
||||
if (interface != NULL) {
|
||||
ERR_FAIL_COND(p_interface == nullptr);
|
||||
if (interface != nullptr) {
|
||||
cleanup();
|
||||
}
|
||||
interface = p_interface;
|
||||
|
|
@ -272,7 +272,7 @@ void VideoStreamPlaybackGDNative::stop() {
|
|||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::seek(float p_time) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->seek(data_struct, p_time);
|
||||
if (p_time < time)
|
||||
seek_backward = true;
|
||||
|
|
@ -292,13 +292,13 @@ Ref<Texture2D> VideoStreamPlaybackGDNative::get_texture() const {
|
|||
}
|
||||
|
||||
float VideoStreamPlaybackGDNative::get_length() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_length(data_struct);
|
||||
}
|
||||
|
||||
float VideoStreamPlaybackGDNative::get_playback_position() const {
|
||||
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_playback_position(data_struct);
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ void VideoStreamPlaybackGDNative::set_loop(bool p_enable) {
|
|||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::set_audio_track(int p_idx) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->set_audio_track(data_struct, p_idx);
|
||||
}
|
||||
|
||||
|
|
@ -323,13 +323,13 @@ void VideoStreamPlaybackGDNative::set_mix_callback(AudioMixCallback p_callback,
|
|||
}
|
||||
|
||||
int VideoStreamPlaybackGDNative::get_channels() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
return (num_channels > 0) ? num_channels : 0;
|
||||
}
|
||||
|
||||
int VideoStreamPlaybackGDNative::get_mix_rate() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
return mix_rate;
|
||||
}
|
||||
|
|
@ -339,13 +339,13 @@ int VideoStreamPlaybackGDNative::get_mix_rate() const {
|
|||
Ref<VideoStreamPlayback> VideoStreamGDNative::instance_playback() {
|
||||
Ref<VideoStreamPlaybackGDNative> pb = memnew(VideoStreamPlaybackGDNative);
|
||||
VideoDecoderGDNative *decoder = decoder_server.get_decoder(file.get_extension().to_lower());
|
||||
if (decoder == NULL)
|
||||
return NULL;
|
||||
if (decoder == nullptr)
|
||||
return nullptr;
|
||||
pb->set_interface(decoder->interface);
|
||||
pb->set_audio_track(audio_track);
|
||||
if (pb->open_file(file))
|
||||
return pb;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoStreamGDNative::set_file(const String &p_file) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct VideoDecoderGDNative {
|
|||
Vector<String> supported_extensions;
|
||||
|
||||
VideoDecoderGDNative() :
|
||||
interface(NULL),
|
||||
interface(nullptr),
|
||||
plugin_name("none") {}
|
||||
|
||||
VideoDecoderGDNative(const godot_videodecoder_interface_gdnative *p_interface) :
|
||||
|
|
@ -89,7 +89,7 @@ public:
|
|||
|
||||
VideoDecoderGDNative *get_decoder(const String &extension) {
|
||||
if (extensions.size() == 0 || !extensions.has(extension))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return decoders[extensions[extension]];
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ public:
|
|||
memdelete(decoders[i]);
|
||||
}
|
||||
decoders.clear();
|
||||
instance = NULL;
|
||||
instance = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ RID GdNavigationServer::map_create() const {
|
|||
|
||||
COMMAND_2(map_set_active, RID, p_map, bool, p_active) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
if (p_active) {
|
||||
if (!map_is_active(p_map)) {
|
||||
|
|
@ -154,84 +154,84 @@ COMMAND_2(map_set_active, RID, p_map, bool, p_active) {
|
|||
|
||||
bool GdNavigationServer::map_is_active(RID p_map) const {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, false);
|
||||
ERR_FAIL_COND_V(map == nullptr, false);
|
||||
|
||||
return active_maps.find(map) >= 0;
|
||||
}
|
||||
|
||||
COMMAND_2(map_set_up, RID, p_map, Vector3, p_up) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
map->set_up(p_up);
|
||||
}
|
||||
|
||||
Vector3 GdNavigationServer::map_get_up(RID p_map) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Vector3());
|
||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||
|
||||
return map->get_up();
|
||||
}
|
||||
|
||||
COMMAND_2(map_set_cell_size, RID, p_map, real_t, p_cell_size) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
map->set_cell_size(p_cell_size);
|
||||
}
|
||||
|
||||
real_t GdNavigationServer::map_get_cell_size(RID p_map) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, 0);
|
||||
ERR_FAIL_COND_V(map == nullptr, 0);
|
||||
|
||||
return map->get_cell_size();
|
||||
}
|
||||
|
||||
COMMAND_2(map_set_edge_connection_margin, RID, p_map, real_t, p_connection_margin) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
map->set_edge_connection_margin(p_connection_margin);
|
||||
}
|
||||
|
||||
real_t GdNavigationServer::map_get_edge_connection_margin(RID p_map) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, 0);
|
||||
ERR_FAIL_COND_V(map == nullptr, 0);
|
||||
|
||||
return map->get_edge_connection_margin();
|
||||
}
|
||||
|
||||
Vector<Vector3> GdNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Vector<Vector3>());
|
||||
ERR_FAIL_COND_V(map == nullptr, Vector<Vector3>());
|
||||
|
||||
return map->get_path(p_origin, p_destination, p_optimize);
|
||||
}
|
||||
|
||||
Vector3 GdNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Vector3());
|
||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||
|
||||
return map->get_closest_point_to_segment(p_from, p_to, p_use_collision);
|
||||
}
|
||||
|
||||
Vector3 GdNavigationServer::map_get_closest_point(RID p_map, const Vector3 &p_point) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Vector3());
|
||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||
|
||||
return map->get_closest_point(p_point);
|
||||
}
|
||||
|
||||
Vector3 GdNavigationServer::map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Vector3());
|
||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||
|
||||
return map->get_closest_point_normal(p_point);
|
||||
}
|
||||
|
||||
RID GdNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const {
|
||||
const NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, RID());
|
||||
ERR_FAIL_COND_V(map == nullptr, RID());
|
||||
|
||||
return map->get_closest_point_owner(p_point);
|
||||
}
|
||||
|
|
@ -247,20 +247,20 @@ RID GdNavigationServer::region_create() const {
|
|||
|
||||
COMMAND_2(region_set_map, RID, p_region, RID, p_map) {
|
||||
NavRegion *region = region_owner.getornull(p_region);
|
||||
ERR_FAIL_COND(region == NULL);
|
||||
ERR_FAIL_COND(region == nullptr);
|
||||
|
||||
if (region->get_map() != NULL) {
|
||||
if (region->get_map() != nullptr) {
|
||||
|
||||
if (region->get_map()->get_self() == p_map)
|
||||
return; // Pointless
|
||||
|
||||
region->get_map()->remove_region(region);
|
||||
region->set_map(NULL);
|
||||
region->set_map(nullptr);
|
||||
}
|
||||
|
||||
if (p_map.is_valid()) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
map->add_region(region);
|
||||
region->set_map(map);
|
||||
|
|
@ -269,21 +269,21 @@ COMMAND_2(region_set_map, RID, p_region, RID, p_map) {
|
|||
|
||||
COMMAND_2(region_set_transform, RID, p_region, Transform, p_transform) {
|
||||
NavRegion *region = region_owner.getornull(p_region);
|
||||
ERR_FAIL_COND(region == NULL);
|
||||
ERR_FAIL_COND(region == nullptr);
|
||||
|
||||
region->set_transform(p_transform);
|
||||
}
|
||||
|
||||
COMMAND_2(region_set_navmesh, RID, p_region, Ref<NavigationMesh>, p_nav_mesh) {
|
||||
NavRegion *region = region_owner.getornull(p_region);
|
||||
ERR_FAIL_COND(region == NULL);
|
||||
ERR_FAIL_COND(region == nullptr);
|
||||
|
||||
region->set_mesh(p_nav_mesh);
|
||||
}
|
||||
|
||||
void GdNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p_node) const {
|
||||
ERR_FAIL_COND(r_mesh.is_null());
|
||||
ERR_FAIL_COND(p_node == NULL);
|
||||
ERR_FAIL_COND(p_node == nullptr);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
NavigationMeshGenerator::get_singleton()->clear(r_mesh);
|
||||
|
|
@ -302,7 +302,7 @@ RID GdNavigationServer::agent_create() const {
|
|||
|
||||
COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
if (agent->get_map()) {
|
||||
if (agent->get_map()->get_self() == p_map)
|
||||
|
|
@ -311,11 +311,11 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
|
|||
agent->get_map()->remove_agent(agent);
|
||||
}
|
||||
|
||||
agent->set_map(NULL);
|
||||
agent->set_map(nullptr);
|
||||
|
||||
if (p_map.is_valid()) {
|
||||
NavMap *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND(map == NULL);
|
||||
ERR_FAIL_COND(map == nullptr);
|
||||
|
||||
agent->set_map(map);
|
||||
map->add_agent(agent);
|
||||
|
|
@ -328,82 +328,82 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
|
|||
|
||||
COMMAND_2(agent_set_neighbor_dist, RID, p_agent, real_t, p_dist) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->neighborDist_ = p_dist;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->maxNeighbors_ = p_count;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_time_horizon, RID, p_agent, real_t, p_time) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->timeHorizon_ = p_time;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->radius_ = p_radius;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_max_speed, RID, p_agent, real_t, p_max_speed) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->maxSpeed_ = p_max_speed;
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_velocity, RID, p_agent, Vector3, p_velocity) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->velocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_target_velocity, RID, p_agent, Vector3, p_velocity) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->prefVelocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_position, RID, p_agent, Vector3, p_position) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->position_ = RVO::Vector3(p_position.x, p_position.y, p_position.z);
|
||||
}
|
||||
|
||||
COMMAND_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->get_agent()->ignore_y_ = p_ignore;
|
||||
}
|
||||
|
||||
bool GdNavigationServer::agent_is_map_changed(RID p_agent) const {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND_V(agent == NULL, false);
|
||||
ERR_FAIL_COND_V(agent == nullptr, false);
|
||||
|
||||
return agent->is_map_changed();
|
||||
}
|
||||
|
||||
COMMAND_4(agent_set_callback, RID, p_agent, Object *, p_receiver, StringName, p_method, Variant, p_udata) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == NULL);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->set_callback(p_receiver == NULL ? ObjectID() : p_receiver->get_instance_id(), p_method, p_udata);
|
||||
agent->set_callback(p_receiver == nullptr ? ObjectID() : p_receiver->get_instance_id(), p_method, p_udata);
|
||||
|
||||
if (agent->get_map()) {
|
||||
if (p_receiver == NULL) {
|
||||
if (p_receiver == nullptr) {
|
||||
agent->get_map()->remove_agent_as_controlled(agent);
|
||||
} else {
|
||||
agent->get_map()->set_agent_as_controlled(agent);
|
||||
|
|
@ -419,14 +419,14 @@ COMMAND_1(free, RID, p_object) {
|
|||
std::vector<NavRegion *> regions = map->get_regions();
|
||||
for (size_t i(0); i < regions.size(); i++) {
|
||||
map->remove_region(regions[i]);
|
||||
regions[i]->set_map(NULL);
|
||||
regions[i]->set_map(nullptr);
|
||||
}
|
||||
|
||||
// Remove any assigned agent
|
||||
std::vector<RvoAgent *> agents = map->get_agents();
|
||||
for (size_t i(0); i < agents.size(); i++) {
|
||||
map->remove_agent(agents[i]);
|
||||
agents[i]->set_map(NULL);
|
||||
agents[i]->set_map(nullptr);
|
||||
}
|
||||
|
||||
active_maps.erase(map);
|
||||
|
|
@ -437,9 +437,9 @@ COMMAND_1(free, RID, p_object) {
|
|||
NavRegion *region = region_owner.getornull(p_object);
|
||||
|
||||
// Removes this region from the map if assigned
|
||||
if (region->get_map() != NULL) {
|
||||
if (region->get_map() != nullptr) {
|
||||
region->get_map()->remove_region(region);
|
||||
region->set_map(NULL);
|
||||
region->set_map(nullptr);
|
||||
}
|
||||
|
||||
region_owner.free(p_object);
|
||||
|
|
@ -449,9 +449,9 @@ COMMAND_1(free, RID, p_object) {
|
|||
RvoAgent *agent = agent_owner.getornull(p_object);
|
||||
|
||||
// Removes this agent from the map if assigned
|
||||
if (agent->get_map() != NULL) {
|
||||
if (agent->get_map() != nullptr) {
|
||||
agent->get_map()->remove_agent(agent);
|
||||
agent->set_map(NULL);
|
||||
agent->set_map(nullptr);
|
||||
}
|
||||
|
||||
agent_owner.free(p_object);
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ gd::PointKey NavMap::get_point_key(const Vector3 &p_pos) const {
|
|||
|
||||
Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize) const {
|
||||
|
||||
const gd::Polygon *begin_poly = NULL;
|
||||
const gd::Polygon *end_poly = NULL;
|
||||
const gd::Polygon *begin_poly = nullptr;
|
||||
const gd::Polygon *end_poly = nullptr;
|
||||
Vector3 begin_point;
|
||||
Vector3 end_point;
|
||||
float begin_d = 1e20;
|
||||
|
|
@ -146,7 +146,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||
|
||||
open_list.push_back(0);
|
||||
|
||||
const gd::Polygon *reachable_end = NULL;
|
||||
const gd::Polygon *reachable_end = nullptr;
|
||||
float reachable_d = 1e30;
|
||||
bool is_reachable = true;
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||
// so use the further reachable polygon
|
||||
ERR_BREAK_MSG(is_reachable == false, "It's not expect to not find the most reachable polygons");
|
||||
is_reachable = false;
|
||||
if (reachable_end == NULL) {
|
||||
if (reachable_end == nullptr) {
|
||||
// The path is not found and there is not a way out.
|
||||
break;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||
open_list.clear();
|
||||
open_list.push_back(0);
|
||||
|
||||
reachable_end = NULL;
|
||||
reachable_end = nullptr;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||
least_cost_id = -1;
|
||||
float least_cost = 1e30;
|
||||
|
||||
for (auto element = open_list.front(); element != NULL; element = element->next()) {
|
||||
for (auto element = open_list.front(); element != nullptr; element = element->next()) {
|
||||
gd::NavigationPoly *np = &navigation_polys[element->get()];
|
||||
float cost = np->traveled_distance;
|
||||
#ifdef USE_ENTRY_POINT
|
||||
|
|
@ -366,7 +366,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||
p = &navigation_polys[p->prev_navigation_poly_id];
|
||||
else
|
||||
// The end
|
||||
p = NULL;
|
||||
p = nullptr;
|
||||
}
|
||||
|
||||
if (path[path.size() - 1] != begin_point)
|
||||
|
|
@ -637,12 +637,12 @@ void NavMap::sync() {
|
|||
gd::Connection c;
|
||||
c.A = &poly;
|
||||
c.A_edge = p;
|
||||
c.B = NULL;
|
||||
c.B = nullptr;
|
||||
c.B_edge = -1;
|
||||
connections[ek] = c;
|
||||
|
||||
} else if (connection->get().B == NULL) {
|
||||
CRASH_COND(connection->get().A == NULL); // Unreachable
|
||||
} else if (connection->get().B == nullptr) {
|
||||
CRASH_COND(connection->get().A == nullptr); // Unreachable
|
||||
|
||||
// Connect the two Polygons by this edge
|
||||
connection->get().B = &poly;
|
||||
|
|
@ -667,8 +667,8 @@ void NavMap::sync() {
|
|||
free_edges.reserve(connections.size());
|
||||
|
||||
for (auto connection_element = connections.front(); connection_element; connection_element = connection_element->next()) {
|
||||
if (connection_element->get().B == NULL) {
|
||||
CRASH_COND(connection_element->get().A == NULL); // Unreachable
|
||||
if (connection_element->get().B == nullptr) {
|
||||
CRASH_COND(connection_element->get().A == nullptr); // Unreachable
|
||||
CRASH_COND(connection_element->get().A_edge < 0); // Unreachable
|
||||
|
||||
// This is a free edge
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
NavRegion::NavRegion() :
|
||||
map(NULL),
|
||||
map(nullptr),
|
||||
polygons_dirty(true) {
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void NavRegion::update_polygons() {
|
|||
polygons.clear();
|
||||
polygons_dirty = false;
|
||||
|
||||
if (map == NULL) {
|
||||
if (map == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ struct Edge {
|
|||
|
||||
Edge() {
|
||||
this_edge = -1;
|
||||
other_polygon = NULL;
|
||||
other_polygon = nullptr;
|
||||
other_edge = -1;
|
||||
}
|
||||
};
|
||||
|
|
@ -119,8 +119,8 @@ struct Connection {
|
|||
int B_edge;
|
||||
|
||||
Connection() {
|
||||
A = NULL;
|
||||
B = NULL;
|
||||
A = nullptr;
|
||||
B = nullptr;
|
||||
A_edge = -1;
|
||||
B_edge = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
void NavigationMeshEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
node = NULL;
|
||||
node = nullptr;
|
||||
|
||||
hide();
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ void NavigationMeshEditor::_clear_pressed() {
|
|||
|
||||
void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) {
|
||||
|
||||
if (p_nav_region == NULL || node == p_nav_region) {
|
||||
if (p_nav_region == nullptr || node == p_nav_region) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ NavigationMeshEditor::NavigationMeshEditor() {
|
|||
|
||||
err_dialog = memnew(AcceptDialog);
|
||||
add_child(err_dialog);
|
||||
node = NULL;
|
||||
node = nullptr;
|
||||
}
|
||||
|
||||
NavigationMeshEditor::~NavigationMeshEditor() {
|
||||
|
|
@ -142,7 +142,7 @@ void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
|
|||
|
||||
navigation_mesh_editor->hide();
|
||||
navigation_mesh_editor->bake_hbox->hide();
|
||||
navigation_mesh_editor->edit(NULL);
|
||||
navigation_mesh_editor->edit(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
#include "modules/gridmap/grid_map.h"
|
||||
#endif
|
||||
|
||||
NavigationMeshGenerator *NavigationMeshGenerator::singleton = NULL;
|
||||
NavigationMeshGenerator *NavigationMeshGenerator::singleton = nullptr;
|
||||
|
||||
void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
|
||||
p_verticies.push_back(p_vec3.x);
|
||||
|
|
@ -405,7 +405,7 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
|
|||
ERR_FAIL_COND(!rcBuildCompactHeightfield(&ctx, cfg.walkableHeight, cfg.walkableClimb, *hf, *chf));
|
||||
|
||||
rcFreeHeightField(hf);
|
||||
hf = 0;
|
||||
hf = nullptr;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (ep)
|
||||
|
|
@ -452,9 +452,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
|
|||
ERR_FAIL_COND(!rcBuildPolyMeshDetail(&ctx, *poly_mesh, *chf, cfg.detailSampleDist, cfg.detailSampleMaxError, *detail_mesh));
|
||||
|
||||
rcFreeCompactHeightfield(chf);
|
||||
chf = 0;
|
||||
chf = nullptr;
|
||||
rcFreeContourSet(cset);
|
||||
cset = 0;
|
||||
cset = nullptr;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (ep)
|
||||
|
|
@ -464,9 +464,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
|
|||
_convert_detail_mesh_to_native_navigation_mesh(detail_mesh, p_nav_mesh);
|
||||
|
||||
rcFreePolyMesh(poly_mesh);
|
||||
poly_mesh = 0;
|
||||
poly_mesh = nullptr;
|
||||
rcFreePolyMeshDetail(detail_mesh);
|
||||
detail_mesh = 0;
|
||||
detail_mesh = nullptr;
|
||||
}
|
||||
|
||||
NavigationMeshGenerator *NavigationMeshGenerator::get_singleton() {
|
||||
|
|
@ -485,7 +485,7 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
|
|||
ERR_FAIL_COND(!p_nav_mesh.is_valid());
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorProgress *ep(NULL);
|
||||
EditorProgress *ep(nullptr);
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
ep = memnew(EditorProgress("bake", TTR("Navigation Mesh Generator Setup:"), 11));
|
||||
}
|
||||
|
|
@ -515,11 +515,11 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
|
|||
|
||||
if (vertices.size() > 0 && indices.size() > 0) {
|
||||
|
||||
rcHeightfield *hf = NULL;
|
||||
rcCompactHeightfield *chf = NULL;
|
||||
rcContourSet *cset = NULL;
|
||||
rcPolyMesh *poly_mesh = NULL;
|
||||
rcPolyMeshDetail *detail_mesh = NULL;
|
||||
rcHeightfield *hf = nullptr;
|
||||
rcCompactHeightfield *chf = nullptr;
|
||||
rcContourSet *cset = nullptr;
|
||||
rcPolyMesh *poly_mesh = nullptr;
|
||||
rcPolyMeshDetail *detail_mesh = nullptr;
|
||||
|
||||
_build_recast_navigation_mesh(
|
||||
p_nav_mesh,
|
||||
|
|
@ -535,19 +535,19 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
|
|||
indices);
|
||||
|
||||
rcFreeHeightField(hf);
|
||||
hf = 0;
|
||||
hf = nullptr;
|
||||
|
||||
rcFreeCompactHeightfield(chf);
|
||||
chf = 0;
|
||||
chf = nullptr;
|
||||
|
||||
rcFreeContourSet(cset);
|
||||
cset = 0;
|
||||
cset = nullptr;
|
||||
|
||||
rcFreePolyMesh(poly_mesh);
|
||||
poly_mesh = 0;
|
||||
poly_mesh = nullptr;
|
||||
|
||||
rcFreePolyMeshDetail(detail_mesh);
|
||||
detail_mesh = 0;
|
||||
detail_mesh = nullptr;
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
*/
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
NavigationMeshGenerator *_nav_mesh_generator = NULL;
|
||||
NavigationMeshGenerator *_nav_mesh_generator = nullptr;
|
||||
#endif
|
||||
|
||||
NavigationServer3D *new_server() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
RvoAgent::RvoAgent() :
|
||||
map(NULL) {
|
||||
map(nullptr) {
|
||||
callback.id = ObjectID();
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ void RvoAgent::dispatch_callback() {
|
|||
return;
|
||||
}
|
||||
Object *obj = ObjectDB::get_instance(callback.id);
|
||||
if (obj == NULL) {
|
||||
if (obj == nullptr) {
|
||||
callback.id = ObjectID();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,13 +114,13 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
|
|||
|
||||
if (r_error.error != Callable::CallError::CALL_OK) {
|
||||
instance->script = Ref<GDScript>();
|
||||
instance->owner->set_script_instance(NULL);
|
||||
instance->owner->set_script_instance(nullptr);
|
||||
{
|
||||
MutexLock lock(GDScriptLanguage::singleton->lock);
|
||||
instances.erase(p_owner);
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, NULL); //error constructing
|
||||
ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, nullptr); //error constructing
|
||||
}
|
||||
|
||||
//@TODO make thread safe
|
||||
|
|
@ -138,7 +138,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
|
|||
|
||||
r_error.error = Callable::CallError::CALL_OK;
|
||||
REF ref;
|
||||
Object *owner = NULL;
|
||||
Object *owner = nullptr;
|
||||
|
||||
GDScript *_baseptr = this;
|
||||
while (_baseptr->_base) {
|
||||
|
|
@ -158,7 +158,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
|
|||
ref = REF(r);
|
||||
}
|
||||
|
||||
GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
|
||||
GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != nullptr, r_error);
|
||||
if (!instance) {
|
||||
if (ref.is_null()) {
|
||||
memdelete(owner); //no owner, sorry
|
||||
|
|
@ -318,12 +318,12 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
|
|||
if (EngineDebugger::is_active()) {
|
||||
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
|
||||
}
|
||||
ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
|
||||
ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
|
||||
}
|
||||
}
|
||||
|
||||
Callable::CallError unchecked_error;
|
||||
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
|
||||
return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
|
||||
}
|
||||
|
||||
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
|
||||
|
|
@ -333,7 +333,7 @@ PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this)
|
|||
_update_exports();
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p
|
|||
|
||||
ERR_FAIL_COND_V_MSG(!E->get()->is_static(), Variant(), "Can't call non-static function '" + String(p_method) + "' in script.");
|
||||
|
||||
return E->get()->call(NULL, p_args, p_argcount, r_error);
|
||||
return E->get()->call(nullptr, p_args, p_argcount, r_error);
|
||||
}
|
||||
top = top->_base;
|
||||
}
|
||||
|
|
@ -938,9 +938,9 @@ GDScript::GDScript() :
|
|||
|
||||
valid = false;
|
||||
subclass_count = 0;
|
||||
initializer = NULL;
|
||||
_base = NULL;
|
||||
_owner = NULL;
|
||||
initializer = nullptr;
|
||||
_base = nullptr;
|
||||
_owner = nullptr;
|
||||
tool = false;
|
||||
#ifdef TOOLS_ENABLED
|
||||
source_changed_cache = false;
|
||||
|
|
@ -964,7 +964,7 @@ void GDScript::_save_orphaned_subclasses() {
|
|||
Vector<ClassRefWithName> weak_subclasses;
|
||||
// collect subclasses ObjectID and name
|
||||
for (Map<StringName, Ref<GDScript>>::Element *E = subclasses.front(); E; E = E->next()) {
|
||||
E->get()->_owner = NULL; //bye, you are no longer owned cause I died
|
||||
E->get()->_owner = nullptr; //bye, you are no longer owned cause I died
|
||||
ClassRefWithName subclass;
|
||||
subclass.id = E->get()->get_instance_id();
|
||||
subclass.fully_qualified_name = E->get()->fully_qualified_name;
|
||||
|
|
@ -1028,7 +1028,7 @@ void GDScript::_init_rpc_methods_properties() {
|
|||
if (sub_E)
|
||||
cscript = sub_E->get().ptr();
|
||||
else
|
||||
cscript = NULL;
|
||||
cscript = nullptr;
|
||||
}
|
||||
|
||||
// Sort so we are 100% that they are always the same.
|
||||
|
|
@ -1120,7 +1120,7 @@ bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
|
|||
if (E) {
|
||||
if (E->get().getter) {
|
||||
Callable::CallError err;
|
||||
r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, NULL, 0, err);
|
||||
r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, nullptr, 0, err);
|
||||
if (err.error == Callable::CallError::CALL_OK) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1194,7 +1194,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
|
|||
if (E) {
|
||||
|
||||
Callable::CallError err;
|
||||
Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), NULL, 0, err);
|
||||
Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), nullptr, 0, err);
|
||||
if (err.error == Callable::CallError::CALL_OK) {
|
||||
|
||||
ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, "Wrong type for _get_property_list, must be an array of dictionaries.");
|
||||
|
|
@ -1351,7 +1351,7 @@ void GDScriptInstance::notification(int p_notification) {
|
|||
String GDScriptInstance::to_string(bool *r_valid) {
|
||||
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
|
||||
Callable::CallError ce;
|
||||
Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
|
||||
Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce);
|
||||
if (ce.error == Callable::CallError::CALL_OK) {
|
||||
if (ret.get_type() != Variant::STRING) {
|
||||
if (r_valid)
|
||||
|
|
@ -1450,7 +1450,7 @@ void GDScriptInstance::reload_members() {
|
|||
}
|
||||
|
||||
GDScriptInstance::GDScriptInstance() {
|
||||
owner = NULL;
|
||||
owner = nullptr;
|
||||
base_ref = false;
|
||||
}
|
||||
|
||||
|
|
@ -1464,7 +1464,7 @@ GDScriptInstance::~GDScriptInstance() {
|
|||
|
||||
/************* SCRIPT LANGUAGE **************/
|
||||
|
||||
GDScriptLanguage *GDScriptLanguage::singleton = NULL;
|
||||
GDScriptLanguage *GDScriptLanguage::singleton = nullptr;
|
||||
|
||||
String GDScriptLanguage::get_name() const {
|
||||
|
||||
|
|
@ -1900,7 +1900,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
|
|||
"remotesync",
|
||||
"mastersync",
|
||||
"puppetsync",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char **w = _reserved_words;
|
||||
|
|
@ -1933,7 +1933,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||
String source = f->get_as_utf8_string();
|
||||
|
||||
GDScriptParser parser;
|
||||
parser.parse(source, p_path.get_base_dir(), true, p_path, false, NULL, true);
|
||||
parser.parse(source, p_path.get_base_dir(), true, p_path, false, nullptr, true);
|
||||
|
||||
if (parser.get_parse_tree() && parser.get_parse_tree()->type == GDScriptParser::Node::TYPE_CLASS) {
|
||||
|
||||
|
|
@ -1954,7 +1954,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||
if (subclass->extends_file) {
|
||||
if (subclass->extends_class.size() == 0) {
|
||||
get_global_class_name(subclass->extends_file, r_base_type);
|
||||
subclass = NULL;
|
||||
subclass = nullptr;
|
||||
break;
|
||||
} else {
|
||||
Vector<StringName> extend_classes = subclass->extends_class;
|
||||
|
|
@ -1973,7 +1973,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||
subpath = path.get_base_dir().plus_file(subpath).simplify_path();
|
||||
}
|
||||
|
||||
if (OK != subparser.parse(subsource, subpath.get_base_dir(), true, subpath, false, NULL, true)) {
|
||||
if (OK != subparser.parse(subsource, subpath.get_base_dir(), true, subpath, false, nullptr, true)) {
|
||||
break;
|
||||
}
|
||||
path = subpath;
|
||||
|
|
@ -1994,20 +1994,20 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
subclass = NULL;
|
||||
subclass = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (subclass->extends_class.size() == 1) {
|
||||
*r_base_type = subclass->extends_class[0];
|
||||
subclass = NULL;
|
||||
subclass = nullptr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
*r_base_type = "Reference";
|
||||
subclass = NULL;
|
||||
subclass = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2168,7 +2168,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
|
|||
"UNSAFE_CALL_ARGUMENT",
|
||||
"DEPRECATED_KEYWORD",
|
||||
"STANDALONE_TERNARY",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
return names[(int)p_code];
|
||||
|
|
@ -2215,7 +2215,7 @@ GDScriptLanguage::GDScriptLanguage() {
|
|||
|
||||
} else {
|
||||
_debug_max_call_stack = 0;
|
||||
_call_stack = NULL;
|
||||
_call_stack = nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -2236,7 +2236,7 @@ GDScriptLanguage::~GDScriptLanguage() {
|
|||
if (_call_stack) {
|
||||
memdelete_arr(_call_stack);
|
||||
}
|
||||
singleton = NULL;
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
void GDScriptLanguage::add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass) {
|
||||
|
|
@ -2319,7 +2319,7 @@ void ResourceFormatLoaderGDScript::get_dependencies(const String &p_path, List<S
|
|||
}
|
||||
|
||||
GDScriptParser parser;
|
||||
if (OK != parser.parse(source, p_path.get_base_dir(), true, p_path, false, NULL, true)) {
|
||||
if (OK != parser.parse(source, p_path.get_base_dir(), true, p_path, false, nullptr, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2363,5 +2363,5 @@ void ResourceFormatSaverGDScript::get_recognized_extensions(const RES &p_resourc
|
|||
}
|
||||
bool ResourceFormatSaverGDScript::recognize(const RES &p_resource) const {
|
||||
|
||||
return Object::cast_to<GDScript>(*p_resource) != NULL;
|
||||
return Object::cast_to<GDScript>(*p_resource) != nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ public:
|
|||
virtual bool set(const StringName &p_name, const Variant &p_value);
|
||||
virtual bool get(const StringName &p_name, Variant &r_ret) const;
|
||||
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
|
||||
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
|
||||
|
||||
virtual void get_method_list(List<MethodInfo> *p_list) const;
|
||||
virtual bool has_method(const StringName &p_method) const;
|
||||
|
|
@ -483,7 +483,7 @@ public:
|
|||
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
|
||||
virtual bool is_using_templates();
|
||||
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
|
||||
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
|
||||
virtual Script *create_script() const;
|
||||
virtual bool has_named_classes() const;
|
||||
virtual bool supports_builtin_mode() const;
|
||||
|
|
@ -534,7 +534,7 @@ public:
|
|||
/* GLOBAL CLASSES */
|
||||
|
||||
virtual bool handles_global_class_type(const String &p_type) const;
|
||||
virtual String get_global_class_name(const String &p_path, String *r_base_type = NULL, String *r_icon_path = NULL) const;
|
||||
virtual String get_global_class_name(const String &p_path, String *r_base_type = nullptr, String *r_icon_path = nullptr) const;
|
||||
|
||||
void add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass);
|
||||
Ref<GDScript> get_orphan_subclass(const String &p_qualified_name);
|
||||
|
|
@ -545,7 +545,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderGDScript : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ bool GDScriptCompiler::_is_class_member_property(CodeGen &codegen, const StringN
|
|||
bool GDScriptCompiler::_is_class_member_property(GDScript *owner, const StringName &p_name) {
|
||||
|
||||
GDScript *scr = owner;
|
||||
GDScriptNativeClass *nc = NULL;
|
||||
GDScriptNativeClass *nc = nullptr;
|
||||
while (scr) {
|
||||
|
||||
if (scr->native.is_valid())
|
||||
|
|
@ -265,7 +265,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||
while (owner) {
|
||||
|
||||
GDScript *scr = owner;
|
||||
GDScriptNativeClass *nc = NULL;
|
||||
GDScriptNativeClass *nc = nullptr;
|
||||
while (scr) {
|
||||
|
||||
if (scr->constants.has(identifier)) {
|
||||
|
|
@ -1700,14 +1700,14 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
|
|||
gdfunc->_constant_count = codegen.constant_map.size();
|
||||
gdfunc->constants.resize(codegen.constant_map.size());
|
||||
gdfunc->_constants_ptr = gdfunc->constants.ptrw();
|
||||
const Variant *K = NULL;
|
||||
const Variant *K = nullptr;
|
||||
while ((K = codegen.constant_map.next(K))) {
|
||||
int idx = codegen.constant_map[*K];
|
||||
gdfunc->constants.write[idx] = *K;
|
||||
}
|
||||
} else {
|
||||
|
||||
gdfunc->_constants_ptr = NULL;
|
||||
gdfunc->_constants_ptr = nullptr;
|
||||
gdfunc->_constant_count = 0;
|
||||
}
|
||||
//global names
|
||||
|
|
@ -1722,7 +1722,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
|
|||
gdfunc->_global_names_count = gdfunc->global_names.size();
|
||||
|
||||
} else {
|
||||
gdfunc->_global_names_ptr = NULL;
|
||||
gdfunc->_global_names_ptr = nullptr;
|
||||
gdfunc->_global_names_count = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1746,7 +1746,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
|
|||
|
||||
} else {
|
||||
|
||||
gdfunc->_code_ptr = NULL;
|
||||
gdfunc->_code_ptr = nullptr;
|
||||
gdfunc->_code_size = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1757,7 +1757,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
|
|||
gdfunc->_default_arg_ptr = &gdfunc->default_arguments[0];
|
||||
} else {
|
||||
gdfunc->_default_arg_count = 0;
|
||||
gdfunc->_default_arg_ptr = NULL;
|
||||
gdfunc->_default_arg_ptr = nullptr;
|
||||
}
|
||||
|
||||
gdfunc->_argument_count = p_func ? p_func->arguments.size() : 0;
|
||||
|
|
@ -1838,7 +1838,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
|
|||
|
||||
p_script->native = Ref<GDScriptNativeClass>();
|
||||
p_script->base = Ref<GDScript>();
|
||||
p_script->_base = NULL;
|
||||
p_script->_base = nullptr;
|
||||
p_script->members.clear();
|
||||
p_script->constants.clear();
|
||||
for (Map<StringName, GDScriptFunction *>::Element *E = p_script->member_functions.front(); E; E = E->next()) {
|
||||
|
|
@ -1848,7 +1848,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
|
|||
p_script->member_indices.clear();
|
||||
p_script->member_info.clear();
|
||||
p_script->_signals.clear();
|
||||
p_script->initializer = NULL;
|
||||
p_script->initializer = nullptr;
|
||||
|
||||
p_script->tool = p_class->tool;
|
||||
p_script->name = p_class->name;
|
||||
|
|
@ -1962,7 +1962,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
|
|||
if (c->base.is_valid()) {
|
||||
c = c->base.ptr();
|
||||
} else {
|
||||
c = NULL;
|
||||
c = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2032,14 +2032,14 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
|
|||
|
||||
if (!has_initializer) {
|
||||
//create a constructor
|
||||
Error err = _parse_function(p_script, p_class, NULL);
|
||||
Error err = _parse_function(p_script, p_class, nullptr);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!has_ready && p_class->ready->statements.size()) {
|
||||
//create a constructor
|
||||
Error err = _parse_function(p_script, p_class, NULL, true);
|
||||
Error err = _parse_function(p_script, p_class, nullptr, true);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2077,7 +2077,7 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
|
|||
/* STEP 2, INITIALIZE AND CONSTRUCT */
|
||||
|
||||
Callable::CallError ce;
|
||||
p_script->initializer->call(instance, NULL, 0, ce);
|
||||
p_script->initializer->call(instance, nullptr, 0, ce);
|
||||
|
||||
if (ce.error != Callable::CallError::CALL_OK) {
|
||||
//well, tough luck, not goinna do anything here
|
||||
|
|
@ -2162,7 +2162,7 @@ Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_scri
|
|||
// Create scripts for subclasses beforehand so they can be referenced
|
||||
_make_scripts(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);
|
||||
|
||||
p_script->_owner = NULL;
|
||||
p_script->_owner = nullptr;
|
||||
Error err = _parse_class_level(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);
|
||||
|
||||
if (err)
|
||||
|
|
|
|||
|
|
@ -336,9 +336,9 @@ void GDScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *
|
|||
ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
|
||||
|
||||
if (_debug_parse_err_line >= 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
|
||||
ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, nullptr);
|
||||
|
||||
int l = _debug_call_stack_pos - p_level - 1;
|
||||
ScriptInstance *instance = _call_stack[l].instance;
|
||||
|
|
@ -501,10 +501,10 @@ struct GDScriptCompletionContext {
|
|||
uint32_t depth;
|
||||
|
||||
GDScriptCompletionContext() :
|
||||
_class(NULL),
|
||||
function(NULL),
|
||||
block(NULL),
|
||||
base(NULL),
|
||||
_class(nullptr),
|
||||
function(nullptr),
|
||||
block(nullptr),
|
||||
base(nullptr),
|
||||
line(0),
|
||||
depth(0) {}
|
||||
};
|
||||
|
|
@ -516,7 +516,7 @@ struct GDScriptCompletionIdentifier {
|
|||
const GDScriptParser::Node *assigned_expression;
|
||||
|
||||
GDScriptCompletionIdentifier() :
|
||||
assigned_expression(NULL) {}
|
||||
assigned_expression(nullptr) {}
|
||||
};
|
||||
|
||||
static void _get_directory_contents(EditorFileSystemDirectory *p_dir, Map<String, ScriptCodeCompletionOption> &r_list) {
|
||||
|
|
@ -911,7 +911,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce);
|
||||
|
||||
if (ce.error == Callable::CallError::CALL_OK && ret.get_type() != Variant::NIL) {
|
||||
if (ret.get_type() != Variant::OBJECT || ret.operator Object *() != NULL) {
|
||||
if (ret.get_type() != Variant::OBJECT || ret.operator Object *() != nullptr) {
|
||||
r_type = _type_from_variant(ret);
|
||||
found = true;
|
||||
}
|
||||
|
|
@ -965,7 +965,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
break;
|
||||
}
|
||||
|
||||
const GDScriptParser::DictionaryNode *dn = NULL;
|
||||
const GDScriptParser::DictionaryNode *dn = nullptr;
|
||||
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_DICTIONARY) {
|
||||
dn = static_cast<const GDScriptParser::DictionaryNode *>(op->arguments[0]);
|
||||
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_DICTIONARY) {
|
||||
|
|
@ -1019,7 +1019,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
}
|
||||
|
||||
// Look if it is a dictionary node
|
||||
const GDScriptParser::DictionaryNode *dn = NULL;
|
||||
const GDScriptParser::DictionaryNode *dn = nullptr;
|
||||
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_DICTIONARY) {
|
||||
dn = static_cast<const GDScriptParser::DictionaryNode *>(op->arguments[0]);
|
||||
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_DICTIONARY) {
|
||||
|
|
@ -1043,7 +1043,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
// Look if it is an array node
|
||||
if (!found && index.value.is_num()) {
|
||||
int idx = index.value;
|
||||
const GDScriptParser::ArrayNode *an = NULL;
|
||||
const GDScriptParser::ArrayNode *an = nullptr;
|
||||
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_ARRAY) {
|
||||
an = static_cast<const GDScriptParser::ArrayNode *>(op->arguments[0]);
|
||||
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_ARRAY) {
|
||||
|
|
@ -1063,7 +1063,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
found = _guess_identifier_type_from_base(c, base, id, r_type);
|
||||
} else if (!found && index.type.kind == GDScriptParser::DataType::BUILTIN) {
|
||||
Callable::CallError err;
|
||||
Variant base_val = Variant::construct(base.type.builtin_type, NULL, 0, err);
|
||||
Variant base_val = Variant::construct(base.type.builtin_type, nullptr, 0, err);
|
||||
bool valid = false;
|
||||
Variant res = base_val.get(index.value, &valid);
|
||||
if (valid) {
|
||||
|
|
@ -1118,9 +1118,9 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
|
|||
|
||||
Callable::CallError ce;
|
||||
bool v1_use_value = p1.value.get_type() != Variant::NIL && p1.value.get_type() != Variant::OBJECT;
|
||||
Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, NULL, 0, ce);
|
||||
Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, nullptr, 0, ce);
|
||||
bool v2_use_value = p2.value.get_type() != Variant::NIL && p2.value.get_type() != Variant::OBJECT;
|
||||
Variant v2 = (v2_use_value) ? p2.value : Variant::construct(p2.type.builtin_type, NULL, 0, ce);
|
||||
Variant v2 = (v2_use_value) ? p2.value : Variant::construct(p2.type.builtin_type, nullptr, 0, ce);
|
||||
// avoid potential invalid ops
|
||||
if ((vop == Variant::OP_DIVIDE || vop == Variant::OP_MODULE) && v2.get_type() == Variant::INT) {
|
||||
v2 = 1;
|
||||
|
|
@ -1175,7 +1175,7 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
|
|||
// Look in blocks first
|
||||
const GDScriptParser::BlockNode *blk = p_context.block;
|
||||
int last_assign_line = -1;
|
||||
const GDScriptParser::Node *last_assigned_expression = NULL;
|
||||
const GDScriptParser::Node *last_assigned_expression = nullptr;
|
||||
GDScriptParser::DataType var_type;
|
||||
while (blk) {
|
||||
if (blk->variables.has(p_identifier)) {
|
||||
|
|
@ -1229,7 +1229,7 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
|
|||
r_type.type.is_meta_type = false; // Right-hand of `is` will be a meta type, but the left-hand value is not
|
||||
// Not an assignment, it shouldn't carry any value
|
||||
r_type.value = Variant();
|
||||
r_type.assigned_expression = NULL;
|
||||
r_type.assigned_expression = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1273,8 +1273,8 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
|
|||
return false;
|
||||
}
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c.function = NULL;
|
||||
c.block = NULL;
|
||||
c.function = nullptr;
|
||||
c.block = nullptr;
|
||||
return _guess_expression_type(c, op->arguments[1], r_type);
|
||||
}
|
||||
}
|
||||
|
|
@ -1536,7 +1536,7 @@ static bool _guess_identifier_type_from_base(GDScriptCompletionContext &p_contex
|
|||
} break;
|
||||
case GDScriptParser::DataType::BUILTIN: {
|
||||
Callable::CallError err;
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
return false;
|
||||
|
|
@ -1614,7 +1614,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
|
|||
for (int i = 0; i < base_type.class_type->static_functions.size(); i++) {
|
||||
if (base_type.class_type->static_functions[i]->name == p_method) {
|
||||
int last_return_line = -1;
|
||||
const GDScriptParser::Node *last_returned_value = NULL;
|
||||
const GDScriptParser::Node *last_returned_value = nullptr;
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c._class = base_type.class_type;
|
||||
c.function = base_type.class_type->static_functions[i];
|
||||
|
|
@ -1631,7 +1631,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
|
|||
for (int i = 0; i < base_type.class_type->functions.size(); i++) {
|
||||
if (base_type.class_type->functions[i]->name == p_method) {
|
||||
int last_return_line = -1;
|
||||
const GDScriptParser::Node *last_returned_value = NULL;
|
||||
const GDScriptParser::Node *last_returned_value = nullptr;
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c._class = base_type.class_type;
|
||||
c.function = base_type.class_type->functions[i];
|
||||
|
|
@ -1706,7 +1706,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
|
|||
} break;
|
||||
case GDScriptParser::DataType::BUILTIN: {
|
||||
Callable::CallError err;
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1913,8 +1913,8 @@ static void _find_identifiers_in_class(const GDScriptCompletionContext &p_contex
|
|||
base_type.value = p_context.base;
|
||||
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c.block = NULL;
|
||||
c.function = NULL;
|
||||
c.block = nullptr;
|
||||
c.function = nullptr;
|
||||
|
||||
_find_identifiers_in_base(c, base_type, p_only_functions, r_result);
|
||||
}
|
||||
|
|
@ -1934,8 +1934,8 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
|
|||
case GDScriptParser::DataType::CLASS: {
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c._class = base_type.class_type;
|
||||
c.block = NULL;
|
||||
c.function = NULL;
|
||||
c.block = nullptr;
|
||||
c.function = nullptr;
|
||||
_find_identifiers_in_class(c, _static, p_only_functions, false, r_result);
|
||||
base_type = base_type.class_type->base_type;
|
||||
} break;
|
||||
|
|
@ -2091,7 +2091,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
|
|||
} break;
|
||||
case GDScriptParser::DataType::BUILTIN: {
|
||||
Callable::CallError err;
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2155,8 +2155,8 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
|
|||
while (clss) {
|
||||
GDScriptCompletionContext c = p_context;
|
||||
c._class = clss;
|
||||
c.block = NULL;
|
||||
c.function = NULL;
|
||||
c.block = nullptr;
|
||||
c.function = nullptr;
|
||||
_find_identifiers_in_class(c, _static, p_only_functions, false, r_result);
|
||||
_static = true;
|
||||
clss = clss->owner;
|
||||
|
|
@ -2190,7 +2190,7 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
|
|||
"const", "enum", "export", "onready", "static", "var", "break", "continue", "if", "elif",
|
||||
"else", "for", "pass", "return", "match", "while", "remote", "master", "puppet",
|
||||
"remotesync", "mastersync", "puppetsync",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char **kw = _keywords;
|
||||
|
|
@ -2375,7 +2375,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
|
|||
case GDScriptParser::DataType::BUILTIN: {
|
||||
if (base.get_type() == Variant::NIL) {
|
||||
Callable::CallError err;
|
||||
base = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
base = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2544,7 +2544,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
|
|||
context.function = parser.get_completion_function();
|
||||
context.line = parser.get_completion_line();
|
||||
|
||||
if (!context._class || context._class->owner == NULL) {
|
||||
if (!context._class || context._class->owner == nullptr) {
|
||||
context.base = p_owner;
|
||||
context.base_path = p_path.get_base_dir();
|
||||
}
|
||||
|
|
@ -2628,13 +2628,13 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
|
|||
}
|
||||
|
||||
GDScriptCompletionContext c = context;
|
||||
c.function = NULL;
|
||||
c.block = NULL;
|
||||
c.base = base.value.get_type() == Variant::OBJECT ? base.value.operator Object *() : NULL;
|
||||
c.function = nullptr;
|
||||
c.block = nullptr;
|
||||
c.base = base.value.get_type() == Variant::OBJECT ? base.value.operator Object *() : nullptr;
|
||||
if (base.type.kind == GDScriptParser::DataType::CLASS) {
|
||||
c._class = base.type.class_type;
|
||||
} else {
|
||||
c._class = NULL;
|
||||
c._class = nullptr;
|
||||
}
|
||||
|
||||
_find_identifiers_in_base(c, base, is_function, options);
|
||||
|
|
@ -2820,8 +2820,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
|
|||
for (Map<StringName, GDScriptParser::ClassNode::Constant>::Element *E = clss->constant_expressions.front(); E; E = E->next()) {
|
||||
GDScriptCompletionIdentifier constant;
|
||||
GDScriptCompletionContext c = context;
|
||||
c.function = NULL;
|
||||
c.block = NULL;
|
||||
c.function = nullptr;
|
||||
c.block = nullptr;
|
||||
c.line = E->value().expression->line;
|
||||
if (_guess_expression_type(c, E->value().expression, constant)) {
|
||||
if (constant.type.has_type && constant.type.is_meta_type) {
|
||||
|
|
@ -2889,9 +2889,9 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
|
|||
}
|
||||
|
||||
GDScriptCompletionContext c = context;
|
||||
c._class = NULL;
|
||||
c.function = NULL;
|
||||
c.block = NULL;
|
||||
c._class = nullptr;
|
||||
c.function = nullptr;
|
||||
c.block = nullptr;
|
||||
bool finding = true;
|
||||
index = index.right(index.find(".") + 1);
|
||||
while (index.find(".") != -1) {
|
||||
|
|
@ -2919,8 +2919,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
|
|||
GDScriptCompletionIdentifier constant;
|
||||
GDScriptCompletionContext c2 = context;
|
||||
c2._class = base_type.class_type;
|
||||
c2.function = NULL;
|
||||
c2.block = NULL;
|
||||
c2.function = nullptr;
|
||||
c2.block = nullptr;
|
||||
c2.line = E->value().expression->line;
|
||||
if (_guess_expression_type(c2, E->value().expression, constant)) {
|
||||
if (constant.type.has_type && constant.type.is_meta_type) {
|
||||
|
|
@ -3222,7 +3222,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
v = v_ref;
|
||||
} else {
|
||||
Callable::CallError err;
|
||||
v = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
v = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -3442,7 +3442,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
|
|||
// We cannot determine the exact nature of the identifier here
|
||||
// Otherwise these codes would work
|
||||
StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true);
|
||||
if (enumName != NULL) {
|
||||
if (enumName != nullptr) {
|
||||
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM;
|
||||
r_result.class_name = "@GlobalScope";
|
||||
r_result.class_member = enumName;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (unlikely(!p_instance)) {
|
||||
r_error = "Cannot access self without instance.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
return &self;
|
||||
|
|
@ -58,7 +58,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (unlikely(!p_instance)) {
|
||||
r_error = "Cannot access member without instance.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
//member indexing is O(1)
|
||||
|
|
@ -69,7 +69,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
//todo change to index!
|
||||
GDScript *s = p_script;
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, _global_names_count, NULL);
|
||||
ERR_FAIL_INDEX_V(address, _global_names_count, nullptr);
|
||||
#endif
|
||||
const StringName *sn = &_global_names_ptr[address];
|
||||
|
||||
|
|
@ -86,31 +86,31 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
s = s->_base;
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(NULL, "GDScriptCompiler bug.");
|
||||
ERR_FAIL_V_MSG(nullptr, "GDScriptCompiler bug.");
|
||||
} break;
|
||||
case ADDR_TYPE_LOCAL_CONSTANT: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, _constant_count, NULL);
|
||||
ERR_FAIL_INDEX_V(address, _constant_count, nullptr);
|
||||
#endif
|
||||
return &_constants_ptr[address];
|
||||
} break;
|
||||
case ADDR_TYPE_STACK:
|
||||
case ADDR_TYPE_STACK_VARIABLE: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, _stack_size, NULL);
|
||||
ERR_FAIL_INDEX_V(address, _stack_size, nullptr);
|
||||
#endif
|
||||
return &p_stack[address];
|
||||
} break;
|
||||
case ADDR_TYPE_GLOBAL: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), NULL);
|
||||
ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), nullptr);
|
||||
#endif
|
||||
return &GDScriptLanguage::get_singleton()->get_global_array()[address];
|
||||
} break;
|
||||
#ifdef TOOLS_ENABLED
|
||||
case ADDR_TYPE_NAMED_GLOBAL: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
ERR_FAIL_INDEX_V(address, _named_globals_count, NULL);
|
||||
ERR_FAIL_INDEX_V(address, _named_globals_count, nullptr);
|
||||
#endif
|
||||
StringName id = _named_globals_ptr[address];
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id];
|
||||
} else {
|
||||
r_error = "Autoload singleton '" + String(id) + "' has been removed.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
|
|
@ -127,8 +127,8 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
|||
} break;
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(NULL, "Bad code! (unknown addressing mode).");
|
||||
return NULL;
|
||||
ERR_FAIL_V_MSG(nullptr, "Bad code! (unknown addressing mode).");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -272,7 +272,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
Variant self;
|
||||
Variant static_ref;
|
||||
Variant retvalue;
|
||||
Variant *stack = NULL;
|
||||
Variant *stack = nullptr;
|
||||
Variant **call_args;
|
||||
int defarg = 0;
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
memnew_placement(&stack[i], Variant);
|
||||
}
|
||||
} else {
|
||||
stack = NULL;
|
||||
stack = nullptr;
|
||||
}
|
||||
|
||||
if (_call_size) {
|
||||
|
|
@ -366,12 +366,12 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
call_args = (Variant **)&aptr[sizeof(Variant) * _stack_size];
|
||||
} else {
|
||||
|
||||
call_args = NULL;
|
||||
call_args = nullptr;
|
||||
}
|
||||
|
||||
} else {
|
||||
stack = NULL;
|
||||
call_args = NULL;
|
||||
stack = nullptr;
|
||||
call_args = nullptr;
|
||||
}
|
||||
|
||||
if (p_instance) {
|
||||
|
|
@ -490,7 +490,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
GET_VARIANT_PTR(dst, 3);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) {
|
||||
if (b->get_type() != Variant::OBJECT || b->operator Object *() == nullptr) {
|
||||
|
||||
err_text = "Right operand of 'is' is not a class.";
|
||||
OPCODE_BREAK;
|
||||
|
|
@ -498,7 +498,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#endif
|
||||
|
||||
bool extends_ok = false;
|
||||
if (a->get_type() == Variant::OBJECT && a->operator Object *() != NULL) {
|
||||
if (a->get_type() == Variant::OBJECT && a->operator Object *() != nullptr) {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool was_freed;
|
||||
|
|
@ -855,7 +855,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
OPCODE_BREAK;
|
||||
}
|
||||
|
||||
if (src->get_type() != Variant::NIL && src->operator Object *() != NULL) {
|
||||
if (src->get_type() != Variant::NIL && src->operator Object *() != nullptr) {
|
||||
|
||||
ScriptInstance *scr_inst = src->operator Object *()->get_script_instance();
|
||||
if (!scr_inst) {
|
||||
|
|
@ -960,7 +960,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
|
||||
bool valid = false;
|
||||
|
||||
if (src->get_type() != Variant::NIL && src->operator Object *() != NULL) {
|
||||
if (src->get_type() != Variant::NIL && src->operator Object *() != nullptr) {
|
||||
|
||||
ScriptInstance *scr_inst = src->operator Object *()->get_script_instance();
|
||||
|
||||
|
|
@ -1099,7 +1099,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
base->call_ptr(*methodname, (const Variant **)argptrs, argc, ret, err);
|
||||
} else {
|
||||
|
||||
base->call_ptr(*methodname, (const Variant **)argptrs, argc, NULL, err);
|
||||
base->call_ptr(*methodname, (const Variant **)argptrs, argc, nullptr, err);
|
||||
}
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (GDScriptLanguage::get_singleton()->profiling) {
|
||||
|
|
@ -1137,7 +1137,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
}
|
||||
#endif
|
||||
|
||||
//_call_func(NULL,base,*methodname,ip,argc,p_instance,stack);
|
||||
//_call_func(nullptr,base,*methodname,ip,argc,p_instance,stack);
|
||||
ip += argc + 1;
|
||||
}
|
||||
DISPATCH_OPCODE;
|
||||
|
|
@ -1216,7 +1216,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
|
||||
const GDScript *gds = _script;
|
||||
|
||||
const Map<StringName, GDScriptFunction *>::Element *E = NULL;
|
||||
const Map<StringName, GDScriptFunction *>::Element *E = nullptr;
|
||||
while (gds->base.ptr()) {
|
||||
gds = gds->base.ptr();
|
||||
E = gds->member_functions.find(*methodname);
|
||||
|
|
@ -1767,7 +1767,7 @@ GDScriptFunction::GDScriptFunction() :
|
|||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
name = "<anonymous>";
|
||||
#ifdef DEBUG_ENABLED
|
||||
_func_cname = NULL;
|
||||
_func_cname = nullptr;
|
||||
|
||||
{
|
||||
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
|
||||
|
|
@ -1834,7 +1834,7 @@ Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_ar
|
|||
|
||||
bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
|
||||
|
||||
if (function == NULL)
|
||||
if (function == nullptr)
|
||||
return false;
|
||||
|
||||
if (p_extended_check) {
|
||||
|
|
@ -1859,7 +1859,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
|
|||
|
||||
state.result = p_arg;
|
||||
Callable::CallError err;
|
||||
Variant ret = function->call(NULL, NULL, 0, err, &state);
|
||||
Variant ret = function->call(nullptr, nullptr, 0, err, &state);
|
||||
|
||||
bool completed = true;
|
||||
|
||||
|
|
@ -1873,7 +1873,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
|
|||
}
|
||||
}
|
||||
|
||||
function = NULL; //cleaned up;
|
||||
function = nullptr; //cleaned up;
|
||||
state.result = Variant();
|
||||
|
||||
if (completed) {
|
||||
|
|
@ -1909,12 +1909,12 @@ void GDScriptFunctionState::_bind_methods() {
|
|||
|
||||
GDScriptFunctionState::GDScriptFunctionState() {
|
||||
|
||||
function = NULL;
|
||||
function = nullptr;
|
||||
}
|
||||
|
||||
GDScriptFunctionState::~GDScriptFunctionState() {
|
||||
|
||||
if (function != NULL) {
|
||||
if (function != nullptr) {
|
||||
//never called, deinitialize stack
|
||||
for (int i = 0; i < state.stack_size; i++) {
|
||||
Variant *v = (Variant *)&state.stack[sizeof(Variant) * i];
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ struct GDScriptDataType {
|
|||
return false;
|
||||
}
|
||||
|
||||
Ref<Script> base = obj && obj->get_script_instance() ? obj->get_script_instance()->get_script() : NULL;
|
||||
Ref<Script> base = obj && obj->get_script_instance() ? obj->get_script_instance()->get_script() : nullptr;
|
||||
bool valid = false;
|
||||
while (base.is_valid()) {
|
||||
if (base == script_type) {
|
||||
|
|
@ -339,7 +339,7 @@ public:
|
|||
return default_arguments[p_idx];
|
||||
}
|
||||
|
||||
Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state = NULL);
|
||||
Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state = nullptr);
|
||||
|
||||
_FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const { return rpc_mode; }
|
||||
GDScriptFunction();
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
|
||||
PackedByteArray barr;
|
||||
int len;
|
||||
Error err = encode_variant(*p_args[0], NULL, len, full_objects);
|
||||
Error err = encode_variant(*p_args[0], nullptr, len, full_objects);
|
||||
if (err) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument = 0;
|
||||
|
|
@ -908,7 +908,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
Variant ret;
|
||||
{
|
||||
const uint8_t *r = varr.ptr();
|
||||
Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
|
||||
Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
|
||||
if (err != OK) {
|
||||
r_ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
|
|
@ -1198,7 +1198,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
}
|
||||
}
|
||||
|
||||
r_ret = gdscr->_new(NULL, 0, r_error);
|
||||
r_ret = gdscr->_new(nullptr, 0, r_error);
|
||||
|
||||
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
|
||||
Ref<GDScript> gd_ref = ins->get_script();
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
Vector<Expression> expression;
|
||||
|
||||
Node *expr = NULL;
|
||||
Node *expr = nullptr;
|
||||
|
||||
int op_line = tokenizer->get_token_line(); // when operators are created at the bottom, the line might have been changed (\n found)
|
||||
|
||||
|
|
@ -276,12 +276,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
Node *subexpr = _parse_expression(p_parent, p_static, p_allow_assign, p_parsing_constant);
|
||||
parenthesis--;
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||
|
||||
_set_error("Expected ')' in expression");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tokenizer->advance();
|
||||
|
|
@ -318,7 +318,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (tokenizer->get_token_constant().get_type() != Variant::STRING) {
|
||||
_set_error("Expected string constant or identifier after '$' or '/'.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
path += String(tokenizer->get_token_constant());
|
||||
|
|
@ -355,7 +355,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (path == "") {
|
||||
_set_error("Path expected after $.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
|
|
@ -427,7 +427,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
tokenizer->advance();
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
||||
_set_error("Expected '(' after 'preload'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
tokenizer->advance();
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (!valid) {
|
||||
_set_error("expected string constant as 'preload' argument.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!path.is_abs_path() && base_path != "")
|
||||
|
|
@ -485,7 +485,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (path == self_path) {
|
||||
|
||||
_set_error("Can't preload itself (use 'get_script()').");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<Resource> res;
|
||||
|
|
@ -503,26 +503,26 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (!FileAccess::exists(path)) {
|
||||
_set_error("Can't preload resource at path: " + path);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if (ScriptCodeCompletionCache::get_singleton()) {
|
||||
res = ScriptCodeCompletionCache::get_singleton()->get_cached_resource(path);
|
||||
}
|
||||
}
|
||||
if (!res.is_valid()) {
|
||||
_set_error("Can't preload resource at path: " + path);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||
_set_error("Expected ')' after 'preload' path");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<GDScript> gds = res;
|
||||
if (gds.is_valid() && !gds->is_valid()) {
|
||||
_set_error("Couldn't fully preload the script, possible cyclic reference or compilation error. Use \"load()\" instead if a cyclic reference is intended.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tokenizer->advance();
|
||||
|
|
@ -536,7 +536,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (!current_function) {
|
||||
_set_error("\"yield()\" can only be used inside function blocks.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
current_function->has_yield = true;
|
||||
|
|
@ -544,7 +544,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
tokenizer->advance();
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
||||
_set_error("Expected \"(\" after \"yield\".");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tokenizer->advance();
|
||||
|
|
@ -565,12 +565,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
Node *object = _parse_and_reduce_expression(p_parent, p_static);
|
||||
if (!object)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
yield->arguments.push_back(object);
|
||||
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) {
|
||||
_set_error("Expected \",\" after the first argument of \"yield\".");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tokenizer->advance();
|
||||
|
|
@ -591,12 +591,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
Node *signal = _parse_and_reduce_expression(p_parent, p_static);
|
||||
if (!signal)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
yield->arguments.push_back(signal);
|
||||
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||
_set_error("Expected \")\" after the second argument of \"yield\".");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
parenthesis--;
|
||||
|
|
@ -610,7 +610,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (p_static) {
|
||||
_set_error("\"self\" isn't allowed in a static function or constant expression.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
//constant defined by tokenizer
|
||||
SelfNode *self = alloc_node<SelfNode>();
|
||||
|
|
@ -631,7 +631,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (identifier == StringName()) {
|
||||
|
||||
_set_error("Built-in type constant or static function expected after \".\".");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (!Variant::has_constant(bi_type, identifier)) {
|
||||
|
||||
|
|
@ -657,7 +657,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
op->arguments.push_back(id);
|
||||
|
||||
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
expr = op;
|
||||
} else {
|
||||
|
|
@ -674,7 +674,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
}
|
||||
if (!valid) {
|
||||
_set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + ".");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -749,7 +749,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
}
|
||||
if (!replaced) {
|
||||
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
expr = op;
|
||||
}
|
||||
} else if (tokenizer->is_token_literal(0, true)) {
|
||||
|
|
@ -789,7 +789,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (lv->assignments == 0) {
|
||||
if (!lv->datatype.has_type) {
|
||||
_set_error("Using assignment with operation on a variable that was never assigned.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String());
|
||||
}
|
||||
|
|
@ -912,7 +912,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (e.op != OperatorNode::OP_NOT && tokenizer->get_token() == GDScriptTokenizer::TK_OP_NOT) {
|
||||
_set_error("Misplaced 'not'.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expression.push_back(e);
|
||||
|
|
@ -921,7 +921,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
/*
|
||||
Node *subexpr=_parse_expression(op,p_static);
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
op->arguments.push_back(subexpr);
|
||||
expr=op;*/
|
||||
|
||||
|
|
@ -929,7 +929,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
// 'is' operator with built-in type
|
||||
if (!expr) {
|
||||
_set_error("Expected identifier before 'is' operator");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
op->op = OperatorNode::OP_IS_BUILTIN;
|
||||
|
|
@ -955,7 +955,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) {
|
||||
|
||||
_set_error("Unterminated array");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) {
|
||||
tokenizer->advance();
|
||||
|
|
@ -966,7 +966,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
|
||||
if (!expecting_comma) {
|
||||
_set_error("expression or ']' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expecting_comma = false;
|
||||
|
|
@ -975,11 +975,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
//parse expression
|
||||
if (expecting_comma) {
|
||||
_set_error("',' or ']' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Node *n = _parse_expression(arr, p_static, p_allow_assign, p_parsing_constant);
|
||||
if (!n)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
arr->elements.push_back(n);
|
||||
expecting_comma = true;
|
||||
}
|
||||
|
|
@ -1001,7 +1001,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
};
|
||||
|
||||
Node *key = NULL;
|
||||
Node *key = nullptr;
|
||||
Set<Variant> keys;
|
||||
|
||||
DictExpect expecting = DICT_EXPECT_KEY;
|
||||
|
|
@ -1011,17 +1011,17 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) {
|
||||
|
||||
_set_error("Unterminated dictionary");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) {
|
||||
|
||||
if (expecting == DICT_EXPECT_COLON) {
|
||||
_set_error("':' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_VALUE) {
|
||||
_set_error("value expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
tokenizer->advance();
|
||||
break;
|
||||
|
|
@ -1032,15 +1032,15 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (expecting == DICT_EXPECT_KEY) {
|
||||
_set_error("key or '}' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_VALUE) {
|
||||
_set_error("value expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_COLON) {
|
||||
_set_error("':' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expecting = DICT_EXPECT_KEY;
|
||||
|
|
@ -1050,15 +1050,15 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (expecting == DICT_EXPECT_KEY) {
|
||||
_set_error("key or '}' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_VALUE) {
|
||||
_set_error("value expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_COMMA) {
|
||||
_set_error("',' or '}' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expecting = DICT_EXPECT_VALUE;
|
||||
|
|
@ -1067,11 +1067,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (expecting == DICT_EXPECT_COMMA) {
|
||||
_set_error("',' or '}' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (expecting == DICT_EXPECT_COLON) {
|
||||
_set_error("':' expected");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (expecting == DICT_EXPECT_KEY) {
|
||||
|
|
@ -1089,7 +1089,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
//python/js style more flexible
|
||||
key = _parse_expression(dict, p_static, p_allow_assign, p_parsing_constant);
|
||||
if (!key)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
expecting = DICT_EXPECT_COLON;
|
||||
}
|
||||
}
|
||||
|
|
@ -1097,7 +1097,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (expecting == DICT_EXPECT_VALUE) {
|
||||
Node *value = _parse_expression(dict, p_static, p_allow_assign, p_parsing_constant);
|
||||
if (!value)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
expecting = DICT_EXPECT_COMMA;
|
||||
|
||||
if (key->type == GDScriptParser::Node::TYPE_CONSTANT) {
|
||||
|
|
@ -1105,7 +1105,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (keys.has(keyName)) {
|
||||
_set_error("Duplicate key found in Dictionary literal");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
keys.insert(keyName);
|
||||
}
|
||||
|
|
@ -1114,7 +1114,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
pair.key = key;
|
||||
pair.value = value;
|
||||
dict->elements.push_back(pair);
|
||||
key = NULL;
|
||||
key = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1142,12 +1142,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
||||
if (!is_completion) {
|
||||
_set_error("Expected '(' for parent function call.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
tokenizer->advance();
|
||||
if (!_parse_arguments(op, op->arguments, p_static, false, p_parsing_constant)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1166,10 +1166,10 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
//find list [ or find dictionary {
|
||||
_set_error("Error parsing expression, misplaced: " + String(tokenizer->get_token_name(tokenizer->get_token())));
|
||||
return NULL; //nothing
|
||||
return nullptr; //nothing
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!expr, NULL, "GDScriptParser bug, couldn't figure out what expression is.");
|
||||
ERR_FAIL_COND_V_MSG(!expr, nullptr, "GDScriptParser bug, couldn't figure out what expression is.");
|
||||
|
||||
/******************/
|
||||
/* Parse Indexing */
|
||||
|
|
@ -1186,7 +1186,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (tokenizer->get_token(1) != GDScriptTokenizer::TK_CURSOR && !tokenizer->is_token_literal(1)) {
|
||||
// We check with is_token_literal, as this allows us to use match/sync/etc. as a name
|
||||
_set_error("Expected identifier as member");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
||||
//call!!
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
|
|
@ -1212,7 +1212,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
completion_node = op;
|
||||
}
|
||||
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
expr = op;
|
||||
|
||||
} else {
|
||||
|
|
@ -1251,12 +1251,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
Node *subexpr = _parse_expression(op, p_static, p_allow_assign, p_parsing_constant);
|
||||
if (!subexpr) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tokenizer->get_token() != GDScriptTokenizer::TK_BRACKET_CLOSE) {
|
||||
_set_error("Expected ']'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
op->arguments.push_back(expr);
|
||||
|
|
@ -1276,12 +1276,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_AS) {
|
||||
if (has_casting) {
|
||||
_set_error("Unexpected 'as'.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
CastNode *cn = alloc_node<CastNode>();
|
||||
if (!_parse_type(cn->cast_type)) {
|
||||
_set_error("Expected type after 'as'.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
has_casting = true;
|
||||
cn->source_node = expr;
|
||||
|
|
@ -1313,7 +1313,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
#define _VALIDATE_ASSIGN \
|
||||
if (!p_allow_assign || has_casting) { \
|
||||
_set_error("Unexpected assign."); \
|
||||
return NULL; \
|
||||
return nullptr; \
|
||||
} \
|
||||
p_allow_assign = false;
|
||||
|
||||
|
|
@ -1479,7 +1479,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
default: {
|
||||
_set_error("GDScriptParser bug, invalid operator in expression: " + itos(expression[i].op));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1488,7 +1488,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
// <= is used for right to left
|
||||
if (error) {
|
||||
_set_error("Unexpected operator");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
next_op = i;
|
||||
min_priority = priority;
|
||||
|
|
@ -1500,7 +1500,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (next_op == -1) {
|
||||
|
||||
_set_error("Yet another parser bug....");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
// OK! create operator..
|
||||
|
|
@ -1513,7 +1513,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (expr_pos == expression.size()) {
|
||||
//can happen..
|
||||
_set_error("Unexpected end of expression...");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1532,16 +1532,16 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
} else if (is_ternary) {
|
||||
if (next_op < 1 || next_op >= (expression.size() - 1)) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
if (next_op >= (expression.size() - 2) || expression[next_op + 2].op != OperatorNode::OP_TERNARY_ELSE) {
|
||||
_set_error("Expected else after ternary if.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (next_op >= (expression.size() - 3)) {
|
||||
_set_error("Expected value after ternary else.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
|
|
@ -1551,7 +1551,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (expression[next_op - 1].is_op) {
|
||||
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
if (expression[next_op + 1].is_op) {
|
||||
|
|
@ -1561,7 +1561,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
// due to how precedence works, unaries will always disappear first
|
||||
|
||||
_set_error("Unexpected two consecutive operators after ternary if.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (expression[next_op + 3].is_op) {
|
||||
|
|
@ -1571,7 +1571,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
// due to how precedence works, unaries will always disappear first
|
||||
|
||||
_set_error("Unexpected two consecutive operators after ternary else.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
op->arguments.push_back(expression[next_op + 1].node); //next expression goes as first
|
||||
|
|
@ -1588,7 +1588,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
|
||||
if (next_op < 1 || next_op >= (expression.size() - 1)) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
|
|
@ -1598,7 +1598,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
if (expression[next_op - 1].is_op) {
|
||||
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
if (expression[next_op + 1].is_op) {
|
||||
|
|
@ -1608,7 +1608,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|||
// due to how precedence works, unaries will always disappear first
|
||||
|
||||
_set_error("Unexpected two consecutive operators.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
op->arguments.push_back(expression[next_op - 1].node); //expression goes as left
|
||||
|
|
@ -1725,7 +1725,7 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to
|
|||
if ((op->arguments[0]->type == Node::TYPE_TYPE || (op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && GDScriptFunctions::is_deterministic(static_cast<BuiltInFunctionNode *>(op->arguments[0])->function))) && last_not_constant == 0) {
|
||||
|
||||
//native type constructor or intrinsic function
|
||||
const Variant **vptr = NULL;
|
||||
const Variant **vptr = nullptr;
|
||||
Vector<Variant *> ptrs;
|
||||
if (op->arguments.size() > 1) {
|
||||
|
||||
|
|
@ -2015,10 +2015,10 @@ GDScriptParser::Node *GDScriptParser::_parse_and_reduce_expression(Node *p_paren
|
|||
|
||||
Node *expr = _parse_expression(p_parent, p_static, p_allow_assign, p_reduce_const);
|
||||
if (!expr || error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
expr = _reduce_expression(expr, p_reduce_const);
|
||||
if (!expr || error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
|
@ -2046,10 +2046,10 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
|
||||
GDScriptTokenizer::Token token = tokenizer->get_token();
|
||||
if (error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (token == GDScriptTokenizer::TK_EOF) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (token) {
|
||||
|
|
@ -2078,13 +2078,13 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
break;
|
||||
} else {
|
||||
_set_error("'..' pattern only allowed at the end of an array pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PatternNode *sub_pattern = _parse_pattern(p_static);
|
||||
if (!sub_pattern) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pattern->array.push_back(sub_pattern);
|
||||
|
|
@ -2097,7 +2097,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
break;
|
||||
} else {
|
||||
_set_error("Not a valid pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
|
@ -2106,7 +2106,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
tokenizer->advance();
|
||||
if (!tokenizer->is_token_literal()) {
|
||||
_set_error("Expected identifier for binding variable name.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
pattern->pt_type = GDScriptParser::PatternNode::PT_BIND;
|
||||
pattern->bind = tokenizer->get_token_literal();
|
||||
|
|
@ -2115,7 +2115,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
while (bl) {
|
||||
if (bl->variables.has(pattern->bind)) {
|
||||
_set_error("Binding name of '" + pattern->bind.operator String() + "' is already declared in this scope.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
bl = bl->parent_block;
|
||||
}
|
||||
|
|
@ -2150,19 +2150,19 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
break;
|
||||
} else {
|
||||
_set_error("'..' pattern only allowed at the end of a dictionary pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Node *key = _parse_and_reduce_expression(pattern, p_static);
|
||||
if (!key) {
|
||||
_set_error("Not a valid key in pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (key->type != GDScriptParser::Node::TYPE_CONSTANT) {
|
||||
_set_error("Not a constant expression as key");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
||||
|
|
@ -2171,12 +2171,12 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
PatternNode *value = _parse_pattern(p_static);
|
||||
if (!value) {
|
||||
_set_error("Expected pattern in dictionary value");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pattern->dictionary.insert(static_cast<ConstantNode *>(key), value);
|
||||
} else {
|
||||
pattern->dictionary.insert(static_cast<ConstantNode *>(key), NULL);
|
||||
pattern->dictionary.insert(static_cast<ConstantNode *>(key), nullptr);
|
||||
}
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
|
||||
|
|
@ -2187,7 +2187,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
break;
|
||||
} else {
|
||||
_set_error("Not a valid pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
|
@ -2200,7 +2200,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
Node *value = _parse_and_reduce_expression(pattern, p_static);
|
||||
if (!value) {
|
||||
_set_error("Expect constant expression or variables in a pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (value->type == Node::TYPE_OPERATOR) {
|
||||
|
|
@ -2212,19 +2212,19 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
|
|||
|
||||
if (op_node->op != OperatorNode::OP_INDEX_NAMED) {
|
||||
_set_error("Invalid operator in pattern. Only index (`A.B`) is allowed");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
current_value = op_node->arguments[0];
|
||||
}
|
||||
|
||||
if (current_value->type != Node::TYPE_IDENTIFIER) {
|
||||
_set_error("Only constant expression or variables allowed in a pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} else if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
|
||||
_set_error("Only constant expressions or variables allowed in a pattern");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pattern->pt_type = PatternNode::PT_CONSTANT;
|
||||
|
|
@ -2332,7 +2332,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
|
|||
return;
|
||||
}
|
||||
|
||||
OperatorNode *type_comp = NULL;
|
||||
OperatorNode *type_comp = nullptr;
|
||||
|
||||
// static type check if possible
|
||||
if (pattern_type.has_type && to_match_type.has_type) {
|
||||
|
|
@ -2402,7 +2402,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
|
|||
// typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() == length
|
||||
|
||||
{
|
||||
OperatorNode *type_comp = NULL;
|
||||
OperatorNode *type_comp = nullptr;
|
||||
// static type check if possible
|
||||
if (to_match_type.has_type) {
|
||||
// must be an array
|
||||
|
|
@ -2461,7 +2461,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
|
|||
for (int i = 0; i < p_pattern->array.size(); i++) {
|
||||
PatternNode *pattern = p_pattern->array[i];
|
||||
|
||||
Node *condition = NULL;
|
||||
Node *condition = nullptr;
|
||||
|
||||
ConstantNode *index = alloc_node<ConstantNode>();
|
||||
index->value = Variant(i);
|
||||
|
|
@ -2495,7 +2495,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
|
|||
// typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() == length
|
||||
|
||||
{
|
||||
OperatorNode *type_comp = NULL;
|
||||
OperatorNode *type_comp = nullptr;
|
||||
// static type check if possible
|
||||
if (to_match_type.has_type) {
|
||||
// must be an dictionary
|
||||
|
|
@ -2553,7 +2553,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
|
|||
|
||||
for (Map<ConstantNode *, PatternNode *>::Element *e = p_pattern->dictionary.front(); e; e = e->next()) {
|
||||
|
||||
Node *condition = NULL;
|
||||
Node *condition = nullptr;
|
||||
|
||||
// check for has, then for pattern
|
||||
|
||||
|
|
@ -2629,7 +2629,7 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
|
|||
PatternBranchNode *branch = p_match_statement->branches[i];
|
||||
|
||||
MatchNode::CompiledPatternBranch compiled_branch;
|
||||
compiled_branch.compiled_pattern = NULL;
|
||||
compiled_branch.compiled_pattern = nullptr;
|
||||
|
||||
Map<StringName, Node *> binding;
|
||||
|
||||
|
|
@ -2638,7 +2638,7 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
|
|||
_mark_line_as_safe(pattern->line);
|
||||
|
||||
Map<StringName, Node *> bindings;
|
||||
Node *resulting_node = NULL;
|
||||
Node *resulting_node = nullptr;
|
||||
_generate_pattern(pattern, id, resulting_node, bindings);
|
||||
|
||||
if (!resulting_node) {
|
||||
|
|
@ -2838,7 +2838,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
|||
lv->line = var_line;
|
||||
p_block->statements.push_back(lv);
|
||||
|
||||
Node *assigned = NULL;
|
||||
Node *assigned = nullptr;
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
||||
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||
|
|
@ -3934,7 +3934,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
|
||||
current_function = function;
|
||||
Node *arg = _parse_and_reduce_expression(p_class, _static);
|
||||
current_function = NULL;
|
||||
current_function = nullptr;
|
||||
cparent->arguments.push_back(arg);
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
|
||||
|
|
@ -3989,7 +3989,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
function->body = block;
|
||||
current_block = block;
|
||||
_parse_block(block, _static);
|
||||
current_block = NULL;
|
||||
current_block = nullptr;
|
||||
|
||||
//arguments
|
||||
} break;
|
||||
|
|
@ -4735,7 +4735,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
}
|
||||
|
||||
member.identifier = tokenizer->get_token_literal();
|
||||
member.expression = NULL;
|
||||
member.expression = nullptr;
|
||||
member._export.name = member.identifier;
|
||||
member.line = tokenizer->get_token_line();
|
||||
member.usages = 0;
|
||||
|
|
@ -4815,7 +4815,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Callable::CallError ce;
|
||||
member.default_value = Variant::construct(member._export.type, NULL, 0, ce);
|
||||
member.default_value = Variant::construct(member._export.type, nullptr, 0, ce);
|
||||
#endif
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||
|
|
@ -4868,7 +4868,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||
if (cn->value.get_type() == Variant::OBJECT) {
|
||||
Object *obj = cn->value;
|
||||
Resource *res = Object::cast_to<Resource>(obj);
|
||||
if (res == NULL) {
|
||||
if (res == nullptr) {
|
||||
_set_error("The exported constant isn't a type or resource.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -5256,7 +5256,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
|||
|
||||
Ref<GDScript> script;
|
||||
StringName native;
|
||||
ClassNode *base_class = NULL;
|
||||
ClassNode *base_class = nullptr;
|
||||
|
||||
if (path != "") {
|
||||
//path (and optionally subclasses)
|
||||
|
|
@ -5318,7 +5318,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
|||
_set_error("The class \"" + base + "\" couldn't be fully loaded (script error or cyclic dependency).", p_class->line);
|
||||
return;
|
||||
}
|
||||
p = NULL;
|
||||
p = nullptr;
|
||||
} else {
|
||||
List<PropertyInfo> props;
|
||||
ProjectSettings::get_singleton()->get_property_list(&props);
|
||||
|
|
@ -5341,7 +5341,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
|||
_set_error("Class '" + base + "' could not be fully loaded (script error or cyclic inheritance).", p_class->line);
|
||||
return;
|
||||
}
|
||||
p = NULL;
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5661,7 +5661,7 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
|
|||
StringName id = full_name[name_part];
|
||||
DataType base_type = result;
|
||||
|
||||
ClassNode *p = NULL;
|
||||
ClassNode *p = nullptr;
|
||||
if (name_part == 0) {
|
||||
if (ScriptServer::is_global_class(id)) {
|
||||
String script_path = ScriptServer::get_global_class_path(id);
|
||||
|
|
@ -5943,7 +5943,7 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper
|
|||
a = a_ref;
|
||||
} else {
|
||||
Callable::CallError err;
|
||||
a = Variant::construct(a_type, NULL, 0, err);
|
||||
a = Variant::construct(a_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
r_valid = false;
|
||||
return DataType();
|
||||
|
|
@ -5956,7 +5956,7 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper
|
|||
b = b_ref;
|
||||
} else {
|
||||
Callable::CallError err;
|
||||
b = Variant::construct(b_type, NULL, 0, err);
|
||||
b = Variant::construct(b_type, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
r_valid = false;
|
||||
return DataType();
|
||||
|
|
@ -6117,7 +6117,7 @@ bool GDScriptParser::_is_type_compatible(const DataType &p_container, const Data
|
|||
|
||||
StringName expr_native;
|
||||
Ref<Script> expr_script;
|
||||
ClassNode *expr_class = NULL;
|
||||
ClassNode *expr_class = nullptr;
|
||||
|
||||
switch (p_expression.kind) {
|
||||
case DataType::NATIVE: {
|
||||
|
|
@ -6228,7 +6228,7 @@ GDScriptParser::Node *GDScriptParser::_get_default_value_for_type(const DataType
|
|||
} else {
|
||||
ConstantNode *c = alloc_node<ConstantNode>();
|
||||
Callable::CallError err;
|
||||
c->value = Variant::construct(p_type.builtin_type, NULL, 0, err);
|
||||
c->value = Variant::construct(p_type.builtin_type, nullptr, 0, err);
|
||||
result = c;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -6307,7 +6307,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
|
|||
int idx = current_function->arguments.find(id->name);
|
||||
node_type = current_function->argument_types[idx];
|
||||
} else {
|
||||
node_type = _reduce_identifier_type(NULL, id->name, id->line, false);
|
||||
node_type = _reduce_identifier_type(nullptr, id->name, id->line, false);
|
||||
}
|
||||
} break;
|
||||
case Node::TYPE_CAST: {
|
||||
|
|
@ -6541,7 +6541,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
|
|||
} break;
|
||||
default: {
|
||||
Callable::CallError err;
|
||||
Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant temp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
|
||||
bool valid = false;
|
||||
Variant res = temp.get(member_id->name.operator String(), &valid);
|
||||
|
|
@ -6670,7 +6670,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
|
|||
}
|
||||
default: {
|
||||
Callable::CallError err;
|
||||
Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant temp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
|
||||
bool valid = false;
|
||||
Variant res = temp.get(cn->value, &valid);
|
||||
|
|
@ -6777,8 +6777,8 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String
|
|||
r_default_arg_count = 0;
|
||||
|
||||
DataType original_type = p_base_type;
|
||||
ClassNode *base = NULL;
|
||||
FunctionNode *callee = NULL;
|
||||
ClassNode *base = nullptr;
|
||||
FunctionNode *callee = nullptr;
|
||||
|
||||
if (p_base_type.kind == DataType::CLASS) {
|
||||
base = p_base_type.class_type;
|
||||
|
|
@ -7111,7 +7111,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
|||
|
||||
if (base_type.kind == DataType::BUILTIN) {
|
||||
Callable::CallError err;
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
|
||||
Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
|
||||
|
||||
if (check_types) {
|
||||
if (!tmp.has_method(callee_name)) {
|
||||
|
|
@ -7275,7 +7275,7 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN
|
|||
DataType base_type = p_base_type;
|
||||
|
||||
// Check classes in current file
|
||||
ClassNode *base = NULL;
|
||||
ClassNode *base = nullptr;
|
||||
if (base_type.kind == DataType::CLASS) {
|
||||
base = base_type.class_type;
|
||||
}
|
||||
|
|
@ -7993,8 +7993,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
|||
current_block = current_function->body;
|
||||
_mark_line_as_safe(current_function->line);
|
||||
_check_block_types(current_block);
|
||||
current_block = NULL;
|
||||
current_function = NULL;
|
||||
current_block = nullptr;
|
||||
current_function = nullptr;
|
||||
if (error_set) return;
|
||||
}
|
||||
|
||||
|
|
@ -8003,8 +8003,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
|||
current_block = current_function->body;
|
||||
_mark_line_as_safe(current_function->line);
|
||||
_check_block_types(current_block);
|
||||
current_block = NULL;
|
||||
current_function = NULL;
|
||||
current_block = nullptr;
|
||||
current_function = nullptr;
|
||||
if (error_set) return;
|
||||
}
|
||||
|
||||
|
|
@ -8053,7 +8053,7 @@ static String _find_function_name(const GDScriptParser::OperatorNode *p_call) {
|
|||
|
||||
void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
||||
|
||||
Node *last_var_assign = NULL;
|
||||
Node *last_var_assign = nullptr;
|
||||
|
||||
// Check each statement
|
||||
for (List<Node *>::Element *E = p_block->statements.front(); E; E = E->next()) {
|
||||
|
|
@ -8444,7 +8444,7 @@ void GDScriptParser::_add_warning(int p_code, int p_line, const Vector<String> &
|
|||
warn.symbols = p_symbols;
|
||||
warn.line = p_line == -1 ? tokenizer->get_token_line() : p_line;
|
||||
|
||||
List<GDScriptWarning>::Element *before = NULL;
|
||||
List<GDScriptWarning>::Element *before = nullptr;
|
||||
for (List<GDScriptWarning>::Element *E = warnings.front(); E; E = E->next()) {
|
||||
if (E->get().line > warn.line) {
|
||||
break;
|
||||
|
|
@ -8511,8 +8511,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|||
}
|
||||
|
||||
current_class = main_class;
|
||||
current_function = NULL;
|
||||
current_block = NULL;
|
||||
current_function = nullptr;
|
||||
current_block = nullptr;
|
||||
|
||||
if (for_completion) check_types = false;
|
||||
|
||||
|
|
@ -8575,7 +8575,7 @@ Error GDScriptParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const St
|
|||
tokenizer = tb;
|
||||
Error ret = _parse(p_base_path);
|
||||
memdelete(tb);
|
||||
tokenizer = NULL;
|
||||
tokenizer = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -8596,7 +8596,7 @@ Error GDScriptParser::parse(const String &p_code, const String &p_base_path, boo
|
|||
tokenizer = tt;
|
||||
Error ret = _parse(p_base_path);
|
||||
memdelete(tt);
|
||||
tokenizer = NULL;
|
||||
tokenizer = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -8619,21 +8619,21 @@ void GDScriptParser::clear() {
|
|||
memdelete(l);
|
||||
}
|
||||
|
||||
head = NULL;
|
||||
list = NULL;
|
||||
head = nullptr;
|
||||
list = nullptr;
|
||||
|
||||
completion_type = COMPLETION_NONE;
|
||||
completion_node = NULL;
|
||||
completion_class = NULL;
|
||||
completion_function = NULL;
|
||||
completion_block = NULL;
|
||||
current_block = NULL;
|
||||
current_class = NULL;
|
||||
completion_node = nullptr;
|
||||
completion_class = nullptr;
|
||||
completion_function = nullptr;
|
||||
completion_block = nullptr;
|
||||
current_block = nullptr;
|
||||
current_class = nullptr;
|
||||
|
||||
completion_found = false;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
current_function = NULL;
|
||||
current_function = nullptr;
|
||||
|
||||
validating = false;
|
||||
for_completion = false;
|
||||
|
|
@ -8650,7 +8650,7 @@ void GDScriptParser::clear() {
|
|||
dependencies.clear();
|
||||
error = "";
|
||||
#ifdef DEBUG_ENABLED
|
||||
safe_lines = NULL;
|
||||
safe_lines = nullptr;
|
||||
#endif // DEBUG_ENABLED
|
||||
}
|
||||
|
||||
|
|
@ -8706,9 +8706,9 @@ int GDScriptParser::get_completion_identifier_is_function() {
|
|||
|
||||
GDScriptParser::GDScriptParser() {
|
||||
|
||||
head = NULL;
|
||||
list = NULL;
|
||||
tokenizer = NULL;
|
||||
head = nullptr;
|
||||
list = nullptr;
|
||||
tokenizer = nullptr;
|
||||
pending_newline = -1;
|
||||
clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
infer_type(false),
|
||||
may_yield(false),
|
||||
builtin_type(Variant::NIL),
|
||||
class_type(NULL) {}
|
||||
class_type(nullptr) {}
|
||||
};
|
||||
|
||||
struct Node {
|
||||
|
|
@ -201,7 +201,7 @@ public:
|
|||
extends_used = false;
|
||||
classname_used = false;
|
||||
end_line = -1;
|
||||
owner = NULL;
|
||||
owner = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -248,11 +248,11 @@ public:
|
|||
List<BlockNode *> sub_blocks;
|
||||
int end_line;
|
||||
BlockNode() {
|
||||
if_condition = NULL;
|
||||
if_condition = nullptr;
|
||||
type = TYPE_BLOCK;
|
||||
end_line = -1;
|
||||
parent_block = NULL;
|
||||
parent_class = NULL;
|
||||
parent_block = nullptr;
|
||||
parent_class = nullptr;
|
||||
has_return = false;
|
||||
}
|
||||
};
|
||||
|
|
@ -276,7 +276,7 @@ public:
|
|||
virtual void set_datatype(const DataType &p_datatype) { datatype = p_datatype; }
|
||||
IdentifierNode() {
|
||||
type = TYPE_IDENTIFIER;
|
||||
declared_block = NULL;
|
||||
declared_block = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -292,8 +292,8 @@ public:
|
|||
virtual void set_datatype(const DataType &p_datatype) { datatype = p_datatype; }
|
||||
LocalVarNode() {
|
||||
type = TYPE_LOCAL_VAR;
|
||||
assign = NULL;
|
||||
assign_op = NULL;
|
||||
assign = nullptr;
|
||||
assign_op = nullptr;
|
||||
assignments = 0;
|
||||
usages = 0;
|
||||
}
|
||||
|
|
@ -465,8 +465,8 @@ public:
|
|||
ControlFlowNode() {
|
||||
type = TYPE_CONTROL_FLOW;
|
||||
cf_type = CF_IF;
|
||||
body = NULL;
|
||||
body_else = NULL;
|
||||
body = nullptr;
|
||||
body_else = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -608,7 +608,7 @@ private:
|
|||
bool _recover_from_completion();
|
||||
|
||||
bool _parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_static, bool p_can_codecomplete = false, bool p_parsing_constant = false);
|
||||
bool _enter_indent_block(BlockNode *p_block = NULL);
|
||||
bool _enter_indent_block(BlockNode *p_block = nullptr);
|
||||
bool _parse_newline();
|
||||
Node *_parse_expression(Node *p_parent, bool p_static, bool p_allow_assign = false, bool p_parsing_constant = false);
|
||||
Node *_reduce_expression(Node *p_node, bool p_to_const = false);
|
||||
|
|
@ -665,7 +665,7 @@ public:
|
|||
#ifdef DEBUG_ENABLED
|
||||
const List<GDScriptWarning> &get_warnings() const { return warnings; }
|
||||
#endif // DEBUG_ENABLED
|
||||
Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = NULL, bool p_dependencies_only = false);
|
||||
Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = nullptr, bool p_dependencies_only = false);
|
||||
Error parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path = "", const String &p_self_path = "");
|
||||
|
||||
bool is_tool_script() const;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ static const _bit _type_list[] = {
|
|||
{ Variant::PACKED_VECTOR2_ARRAY, "PackedVector2Array" },
|
||||
{ Variant::PACKED_VECTOR3_ARRAY, "PackedVector3Array" },
|
||||
{ Variant::PACKED_COLOR_ARRAY, "PackedColorArray" },
|
||||
{ Variant::VARIANT_MAX, NULL },
|
||||
{ Variant::VARIANT_MAX, nullptr },
|
||||
};
|
||||
|
||||
struct _kws {
|
||||
|
|
@ -236,7 +236,7 @@ static const _kws _keyword_list[] = {
|
|||
{ GDScriptTokenizer::TK_WILDCARD, "_" },
|
||||
{ GDScriptTokenizer::TK_CONST_INF, "INF" },
|
||||
{ GDScriptTokenizer::TK_CONST_NAN, "NAN" },
|
||||
{ GDScriptTokenizer::TK_ERROR, NULL }
|
||||
{ GDScriptTokenizer::TK_ERROR, nullptr }
|
||||
};
|
||||
|
||||
const char *GDScriptTokenizer::get_token_name(Token p_token) {
|
||||
|
|
@ -1075,7 +1075,7 @@ void GDScriptTokenizerText::set_code(const String &p_code) {
|
|||
if (len) {
|
||||
_code = &code[0];
|
||||
} else {
|
||||
_code = NULL;
|
||||
_code = nullptr;
|
||||
}
|
||||
code_pos = 0;
|
||||
line = 1; //it is stand-ar-ized that lines begin in 1 in code..
|
||||
|
|
@ -1358,7 +1358,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
|
|||
}
|
||||
|
||||
Map<int, Variant> rev_constant_map;
|
||||
const Variant *K = NULL;
|
||||
const Variant *K = nullptr;
|
||||
while ((K = constant_map.next(K))) {
|
||||
rev_constant_map[constant_map[*K]] = *K;
|
||||
}
|
||||
|
|
@ -1407,7 +1407,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
|
|||
|
||||
int len;
|
||||
// Objects cannot be constant, never encode objects
|
||||
Error err = encode_variant(E->get(), NULL, len, false);
|
||||
Error err = encode_variant(E->get(), nullptr, len, false);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, Vector<uint8_t>(), "Error when trying to encode Variant.");
|
||||
int pos = buf.size();
|
||||
buf.resize(pos + len);
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
|||
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
|
||||
if (default_value_idx >= 0) {
|
||||
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
|
||||
if (const_node == NULL) {
|
||||
if (const_node == nullptr) {
|
||||
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
|
||||
if (operator_node) {
|
||||
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
|
||||
|
|
@ -507,7 +507,7 @@ String ExtendGDScriptParser::get_uri() const {
|
|||
}
|
||||
|
||||
const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent) const {
|
||||
const lsp::DocumentSymbol *ret = NULL;
|
||||
const lsp::DocumentSymbol *ret = nullptr;
|
||||
if (p_line < p_parent.range.start.line) {
|
||||
return ret;
|
||||
} else if (p_parent.range.start.line == p_line) {
|
||||
|
|
@ -591,7 +591,7 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
|
||||
|
|
@ -602,7 +602,7 @@ const Array &ExtendGDScriptParser::get_member_completions() {
|
|||
|
||||
if (member_completions.empty()) {
|
||||
|
||||
const String *name = members.next(NULL);
|
||||
const String *name = members.next(nullptr);
|
||||
while (name) {
|
||||
|
||||
const lsp::DocumentSymbol *symbol = members.get(*name);
|
||||
|
|
@ -613,11 +613,11 @@ const Array &ExtendGDScriptParser::get_member_completions() {
|
|||
name = members.next(name);
|
||||
}
|
||||
|
||||
const String *_class = inner_classes.next(NULL);
|
||||
const String *_class = inner_classes.next(nullptr);
|
||||
while (_class) {
|
||||
|
||||
const ClassMembers *inner_class = inner_classes.getptr(*_class);
|
||||
const String *member_name = inner_class->next(NULL);
|
||||
const String *member_name = inner_class->next(nullptr);
|
||||
while (member_name) {
|
||||
const lsp::DocumentSymbol *symbol = inner_class->get(*member_name);
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
|
|
@ -648,7 +648,7 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio
|
|||
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
|
||||
if (default_value_idx >= 0) {
|
||||
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
|
||||
if (const_node == NULL) {
|
||||
if (const_node == nullptr) {
|
||||
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
|
||||
if (operator_node) {
|
||||
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
|
||||
|
|
@ -778,7 +778,7 @@ Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) {
|
|||
path = p_path;
|
||||
lines = p_code.split("\n");
|
||||
|
||||
Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, NULL, false);
|
||||
Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, nullptr, false);
|
||||
update_diagnostics();
|
||||
update_symbols();
|
||||
update_document_links(p_code);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "editor/editor_log.h"
|
||||
#include "editor/editor_node.h"
|
||||
|
||||
GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = NULL;
|
||||
GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = nullptr;
|
||||
|
||||
Error GDScriptLanguageProtocol::LSPeer::handle_data() {
|
||||
int read = 0;
|
||||
|
|
@ -191,7 +191,7 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
|
|||
Dictionary request = make_notification("gdscrip_client/changeWorkspace", params);
|
||||
|
||||
Ref<LSPeer> peer = clients.get(latest_client_id);
|
||||
if (peer != NULL) {
|
||||
if (peer != nullptr) {
|
||||
String msg = JSON::print(request);
|
||||
msg = format_output(msg);
|
||||
(*peer)->res_queue.push_back(msg.utf8());
|
||||
|
|
@ -230,26 +230,26 @@ void GDScriptLanguageProtocol::poll() {
|
|||
if (server->is_connection_available()) {
|
||||
on_client_connected();
|
||||
}
|
||||
const int *id = NULL;
|
||||
const int *id = nullptr;
|
||||
while ((id = clients.next(id))) {
|
||||
Ref<LSPeer> peer = clients.get(*id);
|
||||
StreamPeerTCP::Status status = peer->connection->get_status();
|
||||
if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
} else {
|
||||
if (peer->connection->get_available_bytes() > 0) {
|
||||
latest_client_id = *id;
|
||||
Error err = peer->handle_data();
|
||||
if (err != OK && err != ERR_BUSY) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
}
|
||||
}
|
||||
Error err = peer->send_data();
|
||||
if (err != OK && err != ERR_BUSY) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ Error GDScriptLanguageProtocol::start(int p_port, const IP_Address &p_bind_ip) {
|
|||
}
|
||||
|
||||
void GDScriptLanguageProtocol::stop() {
|
||||
const int *id = NULL;
|
||||
const int *id = nullptr;
|
||||
while ((id = clients.next(id))) {
|
||||
Ref<LSPeer> peer = clients.get(*id);
|
||||
peer->connection->disconnect_from_host();
|
||||
|
|
@ -274,7 +274,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
|
|||
p_client_id = latest_client_id;
|
||||
}
|
||||
Ref<LSPeer> peer = clients.get(p_client_id);
|
||||
ERR_FAIL_COND(peer == NULL);
|
||||
ERR_FAIL_COND(peer == nullptr);
|
||||
|
||||
Dictionary message = make_notification(p_method, p_params);
|
||||
String msg = JSON::print(message);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "editor/editor_node.h"
|
||||
|
||||
GDScriptLanguageServer::GDScriptLanguageServer() {
|
||||
thread = NULL;
|
||||
thread = nullptr;
|
||||
thread_running = false;
|
||||
started = false;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ void GDScriptLanguageServer::start() {
|
|||
if (protocol.start(port, IP_Address("127.0.0.1")) == OK) {
|
||||
EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR);
|
||||
if (use_thread) {
|
||||
ERR_FAIL_COND(thread != NULL);
|
||||
ERR_FAIL_COND(thread != nullptr);
|
||||
thread_running = true;
|
||||
thread = Thread::create(GDScriptLanguageServer::thread_main, this);
|
||||
}
|
||||
|
|
@ -98,11 +98,11 @@ void GDScriptLanguageServer::start() {
|
|||
|
||||
void GDScriptLanguageServer::stop() {
|
||||
if (use_thread) {
|
||||
ERR_FAIL_COND(NULL == thread);
|
||||
ERR_FAIL_COND(nullptr == thread);
|
||||
thread_running = false;
|
||||
Thread::wait_to_finish(thread);
|
||||
memdelete(thread);
|
||||
thread = NULL;
|
||||
thread = nullptr;
|
||||
}
|
||||
protocol.stop();
|
||||
started = false;
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ void GDScriptTextDocument::initialize() {
|
|||
|
||||
const HashMap<StringName, ClassMembers> &native_members = GDScriptLanguageProtocol::get_singleton()->get_workspace()->native_members;
|
||||
|
||||
const StringName *class_ptr = native_members.next(NULL);
|
||||
const StringName *class_ptr = native_members.next(nullptr);
|
||||
while (class_ptr) {
|
||||
|
||||
const ClassMembers &members = native_members.get(*class_ptr);
|
||||
|
||||
const String *name = members.next(NULL);
|
||||
const String *name = members.next(nullptr);
|
||||
while (name) {
|
||||
|
||||
const lsp::DocumentSymbol *symbol = members.get(*name);
|
||||
|
|
@ -227,7 +227,7 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
|
|||
lsp::CompletionParams params;
|
||||
Variant data = p_params["data"];
|
||||
|
||||
const lsp::DocumentSymbol *symbol = NULL;
|
||||
const lsp::DocumentSymbol *symbol = nullptr;
|
||||
|
||||
if (data.get_type() == Variant::DICTIONARY) {
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_native_symbol(const String &p_
|
|||
class_name = ClassDB::get_parent_class(class_name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_path) const {
|
||||
|
|
@ -101,7 +101,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
|
|||
if (S) {
|
||||
return &(S->get()->get_symbols());
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GDScriptWorkspace::reload_all_workspace_scripts() {
|
||||
|
|
@ -152,7 +152,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_successed_script(const String
|
|||
if (S) {
|
||||
return S->get();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path) {
|
||||
|
|
@ -164,7 +164,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path)
|
|||
if (S) {
|
||||
return S->get();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Array GDScriptWorkspace::symbol(const Dictionary &p_params) {
|
||||
|
|
@ -402,7 +402,7 @@ void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_pa
|
|||
}
|
||||
|
||||
Node *GDScriptWorkspace::_get_owner_scene_node(String p_path) {
|
||||
Node *owner_scene_node = NULL;
|
||||
Node *owner_scene_node = nullptr;
|
||||
List<String> owners;
|
||||
|
||||
_get_owners(EditorFileSystem::get_singleton()->get_filesystem(), p_path, owners);
|
||||
|
|
@ -438,7 +438,7 @@ void GDScriptWorkspace::completion(const lsp::CompletionParams &p_params, List<S
|
|||
|
||||
const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocumentPositionParams &p_doc_pos, const String &p_symbol_name, bool p_func_requred) {
|
||||
|
||||
const lsp::DocumentSymbol *symbol = NULL;
|
||||
const lsp::DocumentSymbol *symbol = nullptr;
|
||||
|
||||
String path = get_file_path(p_doc_pos.textDocument.uri);
|
||||
if (const ExtendGDScriptParser *parser = get_parse_result(path)) {
|
||||
|
|
@ -466,7 +466,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu
|
|||
} else {
|
||||
|
||||
ScriptLanguage::LookupResult ret;
|
||||
if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, NULL, ret)) {
|
||||
if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, nullptr, ret)) {
|
||||
|
||||
if (ret.type == ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION) {
|
||||
|
||||
|
|
@ -506,7 +506,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
|
|||
Vector2i offset;
|
||||
symbol_identifier = parser->get_identifier_under_position(p_doc_pos.position, offset);
|
||||
|
||||
const StringName *class_ptr = native_members.next(NULL);
|
||||
const StringName *class_ptr = native_members.next(nullptr);
|
||||
while (class_ptr) {
|
||||
const ClassMembers &members = native_members.get(*class_ptr);
|
||||
if (const lsp::DocumentSymbol *const *symbol = members.getptr(symbol_identifier)) {
|
||||
|
|
@ -523,7 +523,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
|
|||
}
|
||||
|
||||
const HashMap<String, ClassMembers> &inner_classes = script->get_inner_classes();
|
||||
const String *_class = inner_classes.next(NULL);
|
||||
const String *_class = inner_classes.next(nullptr);
|
||||
while (_class) {
|
||||
|
||||
const ClassMembers *inner_class = inner_classes.getptr(*_class);
|
||||
|
|
@ -552,7 +552,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_native_symbol(const lsp::N
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GDScriptWorkspace::resolve_document_links(const String &p_uri, List<lsp::DocumentLink> &r_list) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "gdscript.h"
|
||||
#include "gdscript_tokenizer.h"
|
||||
|
||||
GDScriptLanguage *script_language_gd = NULL;
|
||||
GDScriptLanguage *script_language_gd = nullptr;
|
||||
Ref<ResourceFormatLoaderGDScript> resource_loader_gd;
|
||||
Ref<ResourceFormatSaverGDScript> resource_saver_gd;
|
||||
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ void GridMap::_notification(int p_what) {
|
|||
_octant_exit_world(E->key());
|
||||
}
|
||||
|
||||
navigation = NULL;
|
||||
navigation = nullptr;
|
||||
|
||||
//_queue_octants_dirty(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS);
|
||||
//_update_octants_callback();
|
||||
|
|
@ -1107,7 +1107,7 @@ GridMap::GridMap() {
|
|||
clip_above = true;
|
||||
cell_scale = 1.0;
|
||||
|
||||
navigation = NULL;
|
||||
navigation = nullptr;
|
||||
set_notify_transform(true);
|
||||
recreating_octants = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
void GridMapEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node)
|
||||
node = NULL;
|
||||
node = nullptr;
|
||||
}
|
||||
|
||||
void GridMapEditor::_configure() {
|
||||
|
|
@ -896,7 +896,7 @@ void GridMapEditor::update_palette() {
|
|||
Ref<MeshLibrary> mesh_library = node->get_mesh_library();
|
||||
|
||||
if (mesh_library.is_null()) {
|
||||
last_mesh_library = NULL;
|
||||
last_mesh_library = nullptr;
|
||||
search_box->set_text("");
|
||||
search_box->set_editable(false);
|
||||
info_message->show();
|
||||
|
|
@ -1548,7 +1548,7 @@ void GridMapEditorPlugin::make_visible(bool p_visible) {
|
|||
|
||||
grid_map_editor->spatial_editor_hb->hide();
|
||||
grid_map_editor->hide();
|
||||
grid_map_editor->edit(NULL);
|
||||
grid_map_editor->edit(nullptr);
|
||||
grid_map_editor->set_process(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "image_loader_hdr.h"
|
||||
|
||||
static ImageLoaderHDR *image_loader_hdr = NULL;
|
||||
static ImageLoaderHDR *image_loader_hdr = nullptr;
|
||||
|
||||
void register_hdr_types() {
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "image_loader_jpegd.h"
|
||||
|
||||
static ImageLoaderJPG *image_loader_jpg = NULL;
|
||||
static ImageLoaderJPG *image_loader_jpg = nullptr;
|
||||
|
||||
void register_jpg_types() {
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem
|
|||
id = dict["id"];
|
||||
}
|
||||
|
||||
if (object == NULL || !object->has_method(method)) {
|
||||
if (object == nullptr || !object->has_method(method)) {
|
||||
ret = make_response_error(JSONRPC::METHOD_NOT_FOUND, "Method not found", id);
|
||||
} else {
|
||||
Variant call_ret = object->callv(method, args);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ Error CryptoKeyMbedTLS::load(String p_path) {
|
|||
}
|
||||
memdelete(f);
|
||||
|
||||
int ret = mbedtls_pk_parse_key(&pkey, out.ptr(), out.size(), NULL, 0);
|
||||
int ret = mbedtls_pk_parse_key(&pkey, out.ptr(), out.size(), nullptr, 0);
|
||||
// We MUST zeroize the memory for safety!
|
||||
mbedtls_platform_zeroize(out.ptrw(), out.size());
|
||||
ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing private key '" + itos(ret) + "'.");
|
||||
|
|
@ -167,11 +167,11 @@ void CryptoMbedTLS::initialize_crypto() {
|
|||
}
|
||||
|
||||
void CryptoMbedTLS::finalize_crypto() {
|
||||
Crypto::_create = NULL;
|
||||
Crypto::_load_default_certificates = NULL;
|
||||
Crypto::_create = nullptr;
|
||||
Crypto::_load_default_certificates = nullptr;
|
||||
if (default_certs) {
|
||||
memdelete(default_certs);
|
||||
default_certs = NULL;
|
||||
default_certs = nullptr;
|
||||
}
|
||||
X509CertificateMbedTLS::finalize();
|
||||
CryptoKeyMbedTLS::finalize();
|
||||
|
|
@ -180,7 +180,7 @@ void CryptoMbedTLS::finalize_crypto() {
|
|||
CryptoMbedTLS::CryptoMbedTLS() {
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
mbedtls_entropy_init(&entropy);
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
|
||||
if (ret != 0) {
|
||||
ERR_PRINT(" failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
|
||||
}
|
||||
|
|
@ -191,17 +191,17 @@ CryptoMbedTLS::~CryptoMbedTLS() {
|
|||
mbedtls_entropy_free(&entropy);
|
||||
}
|
||||
|
||||
X509CertificateMbedTLS *CryptoMbedTLS::default_certs = NULL;
|
||||
X509CertificateMbedTLS *CryptoMbedTLS::default_certs = nullptr;
|
||||
|
||||
X509CertificateMbedTLS *CryptoMbedTLS::get_default_certificates() {
|
||||
return default_certs;
|
||||
}
|
||||
|
||||
void CryptoMbedTLS::load_default_certificates(String p_path) {
|
||||
ERR_FAIL_COND(default_certs != NULL);
|
||||
ERR_FAIL_COND(default_certs != nullptr);
|
||||
|
||||
default_certs = memnew(X509CertificateMbedTLS);
|
||||
ERR_FAIL_COND(default_certs == NULL);
|
||||
ERR_FAIL_COND(default_certs == nullptr);
|
||||
|
||||
if (p_path != "") {
|
||||
// Use certs defined in project settings.
|
||||
|
|
@ -227,15 +227,15 @@ Ref<CryptoKey> CryptoMbedTLS::generate_rsa(int p_bytes) {
|
|||
Ref<CryptoKeyMbedTLS> out;
|
||||
out.instance();
|
||||
int ret = mbedtls_pk_setup(&(out->pkey), mbedtls_pk_info_from_type(MBEDTLS_PK_RSA));
|
||||
ERR_FAIL_COND_V(ret != 0, NULL);
|
||||
ERR_FAIL_COND_V(ret != 0, nullptr);
|
||||
ret = mbedtls_rsa_gen_key(mbedtls_pk_rsa(out->pkey), mbedtls_ctr_drbg_random, &ctr_drbg, p_bytes, 65537);
|
||||
ERR_FAIL_COND_V(ret != 0, NULL);
|
||||
ERR_FAIL_COND_V(ret != 0, nullptr);
|
||||
return out;
|
||||
}
|
||||
|
||||
Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) {
|
||||
Ref<CryptoKeyMbedTLS> key = static_cast<Ref<CryptoKeyMbedTLS>>(p_key);
|
||||
ERR_FAIL_COND_V_MSG(key.is_null(), NULL, "Invalid private key argument.");
|
||||
ERR_FAIL_COND_V_MSG(key.is_null(), nullptr, "Invalid private key argument.");
|
||||
mbedtls_x509write_cert crt;
|
||||
mbedtls_x509write_crt_init(&crt);
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoK
|
|||
mbedtls_mpi_init(&serial);
|
||||
uint8_t rand_serial[20];
|
||||
mbedtls_ctr_drbg_random(&ctr_drbg, rand_serial, 20);
|
||||
ERR_FAIL_COND_V(mbedtls_mpi_read_binary(&serial, rand_serial, 20), NULL);
|
||||
ERR_FAIL_COND_V(mbedtls_mpi_read_binary(&serial, rand_serial, 20), nullptr);
|
||||
mbedtls_x509write_crt_set_serial(&crt, &serial);
|
||||
|
||||
mbedtls_x509write_crt_set_validity(&crt, p_not_before.utf8().get_data(), p_not_after.utf8().get_data());
|
||||
|
|
@ -268,7 +268,7 @@ Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoK
|
|||
mbedtls_mpi_free(&serial);
|
||||
mbedtls_x509write_crt_free(&crt);
|
||||
ERR_PRINT("Generated invalid certificate: " + itos(err));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mbedtls_mpi_free(&serial);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ private:
|
|||
public:
|
||||
static CryptoKey *create();
|
||||
static void make_default() { CryptoKey::_create = create; }
|
||||
static void finalize() { CryptoKey::_create = NULL; }
|
||||
static void finalize() { CryptoKey::_create = nullptr; }
|
||||
|
||||
virtual Error load(String p_path);
|
||||
virtual Error save(String p_path);
|
||||
|
|
@ -78,7 +78,7 @@ private:
|
|||
public:
|
||||
static X509Certificate *create();
|
||||
static void make_default() { X509Certificate::_create = create; }
|
||||
static void finalize() { X509Certificate::_create = NULL; }
|
||||
static void finalize() { X509Certificate::_create = nullptr; }
|
||||
|
||||
virtual Error load(String p_path);
|
||||
virtual Error load_from_memory(const uint8_t *p_buffer, int p_len);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void DTLSServerMbedTLS::initialize() {
|
|||
}
|
||||
|
||||
void DTLSServerMbedTLS::finalize() {
|
||||
_create = NULL;
|
||||
_create = nullptr;
|
||||
available = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@
|
|||
|
||||
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
||||
|
||||
if (buf == NULL || len <= 0) return 0;
|
||||
if (buf == nullptr || len <= 0) return 0;
|
||||
|
||||
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
||||
|
||||
ERR_FAIL_COND_V(sp == NULL, 0);
|
||||
ERR_FAIL_COND_V(sp == nullptr, 0);
|
||||
|
||||
Error err = sp->base->put_packet((const uint8_t *)buf, len);
|
||||
if (err == ERR_BUSY) {
|
||||
|
|
@ -53,11 +53,11 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len
|
|||
|
||||
int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||
|
||||
if (buf == NULL || len <= 0) return 0;
|
||||
if (buf == nullptr || len <= 0) return 0;
|
||||
|
||||
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
||||
|
||||
ERR_FAIL_COND_V(sp == NULL, 0);
|
||||
ERR_FAIL_COND_V(sp == nullptr, 0);
|
||||
|
||||
int pc = sp->base->get_available_packet_count();
|
||||
if (pc == 0) {
|
||||
|
|
@ -125,7 +125,7 @@ Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_vali
|
|||
ERR_FAIL_COND_V(err != OK, err);
|
||||
|
||||
mbedtls_ssl_set_hostname(ssl_ctx->get_context(), p_for_hostname.utf8().get_data());
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
|
||||
mbedtls_ssl_set_timer_cb(ssl_ctx->get_context(), &timer, mbedtls_timing_set_delay, mbedtls_timing_get_delay);
|
||||
|
||||
status = STATUS_HANDSHAKING;
|
||||
|
|
@ -154,7 +154,7 @@ Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey>
|
|||
ERR_FAIL_V_MSG(FAILED, "Error setting DTLS client cookie");
|
||||
}
|
||||
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
|
||||
mbedtls_ssl_set_timer_cb(ssl_ctx->get_context(), &timer, mbedtls_timing_set_delay, mbedtls_timing_get_delay);
|
||||
|
||||
status = STATUS_HANDSHAKING;
|
||||
|
|
@ -223,7 +223,7 @@ void PacketPeerMbedDTLS::poll() {
|
|||
|
||||
ERR_FAIL_COND(!base.is_valid());
|
||||
|
||||
int ret = mbedtls_ssl_read(ssl_ctx->get_context(), NULL, 0);
|
||||
int ret = mbedtls_ssl_read(ssl_ctx->get_context(), nullptr, 0);
|
||||
|
||||
if (ret < 0 && ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
|
||||
if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
|
||||
|
|
@ -292,6 +292,6 @@ void PacketPeerMbedDTLS::initialize_dtls() {
|
|||
}
|
||||
|
||||
void PacketPeerMbedDTLS::finalize_dtls() {
|
||||
_create = NULL;
|
||||
_create = nullptr;
|
||||
available = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ Error CookieContextMbedTLS::setup() {
|
|||
mbedtls_ssl_cookie_init(&cookie_ctx);
|
||||
inited = true;
|
||||
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
|
||||
if (ret != 0) {
|
||||
clear(); // Never leave unusable resources around.
|
||||
ERR_FAIL_V_MSG(FAILED, "mbedtls_ctr_drbg_seed returned an error " + itos(ret));
|
||||
|
|
@ -94,7 +94,7 @@ Error SSLContextMbedTLS::_setup(int p_endpoint, int p_transport, int p_authmode)
|
|||
mbedtls_entropy_init(&entropy);
|
||||
inited = true;
|
||||
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
|
||||
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
|
||||
if (ret != 0) {
|
||||
clear(); // Never leave unusable resources around.
|
||||
ERR_FAIL_V_MSG(FAILED, "mbedtls_ctr_drbg_seed returned an error " + itos(ret));
|
||||
|
|
@ -134,7 +134,7 @@ Error SSLContextMbedTLS::init_server(int p_transport, int p_authmode, Ref<Crypto
|
|||
}
|
||||
// Adding CA chain if available.
|
||||
if (certs->cert.next) {
|
||||
mbedtls_ssl_conf_ca_chain(&conf, certs->cert.next, NULL);
|
||||
mbedtls_ssl_conf_ca_chain(&conf, certs->cert.next, nullptr);
|
||||
}
|
||||
// DTLS Cookies
|
||||
if (p_transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
|
||||
|
|
@ -153,7 +153,7 @@ Error SSLContextMbedTLS::init_client(int p_transport, int p_authmode, Ref<X509Ce
|
|||
Error err = _setup(MBEDTLS_SSL_IS_CLIENT, p_transport, p_authmode);
|
||||
ERR_FAIL_COND_V(err != OK, err);
|
||||
|
||||
X509CertificateMbedTLS *cas = NULL;
|
||||
X509CertificateMbedTLS *cas = nullptr;
|
||||
|
||||
if (p_valid_cas.is_valid()) {
|
||||
// Locking CA certificates
|
||||
|
|
@ -163,14 +163,14 @@ Error SSLContextMbedTLS::init_client(int p_transport, int p_authmode, Ref<X509Ce
|
|||
} else {
|
||||
// Fall back to default certificates (no need to lock those).
|
||||
cas = CryptoMbedTLS::get_default_certificates();
|
||||
if (cas == NULL) {
|
||||
if (cas == nullptr) {
|
||||
clear();
|
||||
ERR_FAIL_V_MSG(ERR_UNCONFIGURED, "SSL module failed to initialize!");
|
||||
}
|
||||
}
|
||||
|
||||
// Set valid CAs
|
||||
mbedtls_ssl_conf_ca_chain(&conf, &(cas->cert), NULL);
|
||||
mbedtls_ssl_conf_ca_chain(&conf, &(cas->cert), nullptr);
|
||||
mbedtls_ssl_setup(&ssl, &conf);
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ void SSLContextMbedTLS::clear() {
|
|||
}
|
||||
|
||||
mbedtls_ssl_context *SSLContextMbedTLS::get_context() {
|
||||
ERR_FAIL_COND_V(!inited, NULL);
|
||||
ERR_FAIL_COND_V(!inited, nullptr);
|
||||
return &ssl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@
|
|||
|
||||
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
||||
|
||||
if (buf == NULL || len <= 0) return 0;
|
||||
if (buf == nullptr || len <= 0) return 0;
|
||||
|
||||
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
||||
|
||||
ERR_FAIL_COND_V(sp == NULL, 0);
|
||||
ERR_FAIL_COND_V(sp == nullptr, 0);
|
||||
|
||||
int sent;
|
||||
Error err = sp->base->put_partial_data((const uint8_t *)buf, len, sent);
|
||||
|
|
@ -54,11 +54,11 @@ int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len)
|
|||
|
||||
int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||
|
||||
if (buf == NULL || len <= 0) return 0;
|
||||
if (buf == nullptr || len <= 0) return 0;
|
||||
|
||||
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
||||
|
||||
ERR_FAIL_COND_V(sp == NULL, 0);
|
||||
ERR_FAIL_COND_V(sp == nullptr, 0);
|
||||
|
||||
int got;
|
||||
Error err = sp->base->get_partial_data((uint8_t *)buf, len, got);
|
||||
|
|
@ -112,7 +112,7 @@ Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
|
|||
ERR_FAIL_COND_V(err != OK, err);
|
||||
|
||||
mbedtls_ssl_set_hostname(ssl_ctx->get_context(), p_for_hostname.utf8().get_data());
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
|
||||
|
||||
status = STATUS_HANDSHAKING;
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ Error StreamPeerMbedTLS::accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_
|
|||
|
||||
base = p_base;
|
||||
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
|
||||
mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
|
||||
|
||||
status = STATUS_HANDSHAKING;
|
||||
|
||||
|
|
@ -320,5 +320,5 @@ void StreamPeerMbedTLS::initialize_ssl() {
|
|||
void StreamPeerMbedTLS::finalize_ssl() {
|
||||
|
||||
available = false;
|
||||
_create = NULL;
|
||||
_create = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ bool MobileVRInterface::initialize() {
|
|||
void MobileVRInterface::uninitialize() {
|
||||
if (initialized) {
|
||||
ARVRServer *arvr_server = ARVRServer::get_singleton();
|
||||
if (arvr_server != NULL) {
|
||||
if (arvr_server != nullptr) {
|
||||
// no longer our primary interface
|
||||
arvr_server->clear_primary_interface_if(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> names;
|
||||
|
||||
const StringName *k = NULL;
|
||||
const StringName *k = nullptr;
|
||||
|
||||
while ((k = ClassDB::classes.next(k))) {
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> snames;
|
||||
|
||||
k = NULL;
|
||||
k = nullptr;
|
||||
|
||||
while ((k = t->method_map.next(k))) {
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> snames;
|
||||
|
||||
k = NULL;
|
||||
k = nullptr;
|
||||
|
||||
while ((k = t->constant_map.next(k))) {
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> snames;
|
||||
|
||||
k = NULL;
|
||||
k = nullptr;
|
||||
|
||||
while ((k = t->signal_map.next(k))) {
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
|
|||
|
||||
List<StringName> snames;
|
||||
|
||||
k = NULL;
|
||||
k = nullptr;
|
||||
|
||||
while ((k = t->property_setget.next(k))) {
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void CSharpLanguage::finish() {
|
|||
|
||||
if (gdmono) {
|
||||
memdelete(gdmono);
|
||||
gdmono = NULL;
|
||||
gdmono = nullptr;
|
||||
}
|
||||
|
||||
// Clear here, after finalizing all domains to make sure there is nothing else referencing the elements.
|
||||
|
|
@ -614,7 +614,7 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObjec
|
|||
|
||||
GD_MONO_SCOPE_THREAD_ATTACH;
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
|
||||
MonoArray *frames = CACHED_METHOD_THUNK(System_Diagnostics_StackTrace, GetFrames).invoke(p_stack_trace, &exc);
|
||||
|
||||
|
|
@ -679,14 +679,14 @@ void CSharpLanguage::pre_unsafe_unreference(Object *p_obj) {
|
|||
|
||||
void CSharpLanguage::frame() {
|
||||
|
||||
if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != NULL) {
|
||||
if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != nullptr) {
|
||||
const Ref<MonoGCHandleRef> &task_scheduler_handle = GDMonoCache::cached_data.task_scheduler_handle;
|
||||
|
||||
if (task_scheduler_handle.is_valid()) {
|
||||
MonoObject *task_scheduler = task_scheduler_handle->get_target();
|
||||
|
||||
if (task_scheduler) {
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
CACHED_METHOD_THUNK(GodotTaskScheduler, Activate).invoke(task_scheduler, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -813,7 +813,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
Array serialized_data;
|
||||
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TrySerializeDelegate).invoke(delegate, managed_serialized_data, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -946,7 +946,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
|
||||
// Restore Variant properties state, it will be kept by the placeholder until the next script reloading
|
||||
for (List<Pair<StringName, Variant>>::Element *G = scr->pending_reload_state[obj_id].properties.front(); G; G = G->next()) {
|
||||
placeholder->property_set_fallback(G->get().first, G->get().second, NULL);
|
||||
placeholder->property_set_fallback(G->get().first, G->get().second, nullptr);
|
||||
}
|
||||
|
||||
scr->pending_reload_state.erase(obj_id);
|
||||
|
|
@ -980,12 +980,12 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
GDMonoAssembly *project_assembly = gdmono->get_project_assembly();
|
||||
|
||||
// Search in project and tools assemblies first as those are the most likely to have the class
|
||||
GDMonoClass *script_class = (project_assembly ? project_assembly->get_class(class_namespace, class_name) : NULL);
|
||||
GDMonoClass *script_class = (project_assembly ? project_assembly->get_class(class_namespace, class_name) : nullptr);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (!script_class) {
|
||||
GDMonoAssembly *tools_assembly = gdmono->get_tools_assembly();
|
||||
script_class = (tools_assembly ? tools_assembly->get_class(class_namespace, class_name) : NULL);
|
||||
script_class = (tools_assembly ? tools_assembly->get_class(class_namespace, class_name) : nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1056,7 +1056,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
continue;
|
||||
}
|
||||
#else
|
||||
CRASH_COND(si != NULL);
|
||||
CRASH_COND(si != nullptr);
|
||||
#endif
|
||||
// Re-create script instance
|
||||
obj->set_script(script); // will create the script instance as well
|
||||
|
|
@ -1105,9 +1105,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
const CSharpScript::EventSignal &event_signal = match->value();
|
||||
|
||||
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
|
||||
MonoDelegate *delegate = NULL;
|
||||
MonoDelegate *delegate = nullptr;
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TryDeserializeDelegate).invoke(managed_serialized_data, &delegate, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -1116,7 +1116,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
}
|
||||
|
||||
if (success) {
|
||||
ERR_CONTINUE(delegate == NULL);
|
||||
ERR_CONTINUE(delegate == nullptr);
|
||||
event_signal.field->set_value(csi->get_mono_object(), (MonoObject *)delegate);
|
||||
} else if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
OS::get_singleton()->print("Failed to deserialize event signal delegate\n");
|
||||
|
|
@ -1141,9 +1141,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
const Array &serialized_data = elem->value();
|
||||
|
||||
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
|
||||
MonoDelegate *delegate = NULL;
|
||||
MonoDelegate *delegate = nullptr;
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TryDeserializeDelegate).invoke(managed_serialized_data, &delegate, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -1152,7 +1152,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
}
|
||||
|
||||
if (success) {
|
||||
ERR_CONTINUE(delegate == NULL);
|
||||
ERR_CONTINUE(delegate == nullptr);
|
||||
managed_callable->set_delegate(delegate);
|
||||
} else if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
OS::get_singleton()->print("Failed to deserialize delegate\n");
|
||||
|
|
@ -1292,7 +1292,7 @@ void CSharpLanguage::_on_scripts_domain_unloaded() {
|
|||
for (SelfList<ManagedCallable> *elem = ManagedCallable::instances.first(); elem; elem = elem->next()) {
|
||||
ManagedCallable *managed_callable = elem->self();
|
||||
managed_callable->delegate_handle.release();
|
||||
managed_callable->delegate_invoke = NULL;
|
||||
managed_callable->delegate_invoke = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1307,17 +1307,17 @@ void CSharpLanguage::_editor_init_callback() {
|
|||
// Initialize GodotSharpEditor
|
||||
|
||||
GDMonoClass *editor_klass = GDMono::get_singleton()->get_tools_assembly()->get_class("GodotTools", "GodotSharpEditor");
|
||||
CRASH_COND(editor_klass == NULL);
|
||||
CRASH_COND(editor_klass == nullptr);
|
||||
|
||||
MonoObject *mono_object = mono_object_new(mono_domain_get(), editor_klass->get_mono_ptr());
|
||||
CRASH_COND(mono_object == NULL);
|
||||
CRASH_COND(mono_object == nullptr);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
GDMonoUtils::runtime_object_init(mono_object, editor_klass, &exc);
|
||||
UNHANDLED_EXCEPTION(exc);
|
||||
|
||||
EditorPlugin *godotsharp_editor = Object::cast_to<EditorPlugin>(GDMonoMarshal::mono_object_to_variant(mono_object));
|
||||
CRASH_COND(godotsharp_editor == NULL);
|
||||
CRASH_COND(godotsharp_editor == nullptr);
|
||||
|
||||
// Enable it as a plugin
|
||||
EditorNode::add_editor_plugin(godotsharp_editor);
|
||||
|
|
@ -1354,7 +1354,7 @@ void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, MonoGCH
|
|||
// already released and could have been replaced) or if we can't get its target MonoObject*
|
||||
// (which doesn't necessarily mean it was released, and we want it released in order to
|
||||
// avoid locking other threads unnecessarily).
|
||||
if (target == p_expected_obj || target == NULL) {
|
||||
if (target == p_expected_obj || target == nullptr) {
|
||||
p_gchandle.release();
|
||||
}
|
||||
}
|
||||
|
|
@ -1380,7 +1380,7 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b
|
|||
// I don't trust you
|
||||
if (p_object->get_script_instance()) {
|
||||
CSharpInstance *csharp_instance = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
|
||||
CRASH_COND(csharp_instance != NULL && !csharp_instance->is_destructing_script_instance());
|
||||
CRASH_COND(csharp_instance != nullptr && !csharp_instance->is_destructing_script_instance());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1434,7 +1434,7 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) {
|
|||
CSharpScriptBinding script_binding;
|
||||
|
||||
if (!setup_csharp_script_binding(script_binding, p_object))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (void *)insert_script_binding(p_object, script_binding);
|
||||
}
|
||||
|
|
@ -1446,7 +1446,7 @@ Map<Object *, CSharpScriptBinding>::Element *CSharpLanguage::insert_script_bindi
|
|||
|
||||
void CSharpLanguage::free_instance_binding_data(void *p_data) {
|
||||
|
||||
if (GDMono::get_singleton() == NULL) {
|
||||
if (GDMono::get_singleton() == nullptr) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!script_bindings.empty());
|
||||
#endif
|
||||
|
|
@ -1471,7 +1471,7 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
|
|||
// This is done to avoid trying to dispose the native instance from Dispose(bool).
|
||||
MonoObject *mono_object = script_binding.gchandle.get_target();
|
||||
if (mono_object) {
|
||||
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, NULL);
|
||||
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, nullptr);
|
||||
}
|
||||
script_binding.gchandle.release();
|
||||
}
|
||||
|
|
@ -1563,7 +1563,7 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
|
|||
|
||||
Reference *ref = Object::cast_to<Reference>(p_owner);
|
||||
|
||||
instance->base_ref = ref != NULL;
|
||||
instance->base_ref = ref != nullptr;
|
||||
instance->owner = p_owner;
|
||||
instance->gchandle = p_gchandle;
|
||||
|
||||
|
|
@ -1577,7 +1577,7 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
|
|||
|
||||
MonoObject *CSharpInstance::get_mono_object() const {
|
||||
|
||||
ERR_FAIL_COND_V(gchandle.is_released(), NULL);
|
||||
ERR_FAIL_COND_V(gchandle.is_released(), nullptr);
|
||||
return gchandle.get_target();
|
||||
}
|
||||
|
||||
|
|
@ -1662,7 +1662,7 @@ bool CSharpInstance::get(const StringName &p_name, Variant &r_ret) const {
|
|||
GDMonoProperty *property = top->get_property(p_name);
|
||||
|
||||
if (property) {
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
MonoObject *value = property->get_value(mono_object, &exc);
|
||||
if (exc) {
|
||||
r_ret = Variant();
|
||||
|
|
@ -1743,7 +1743,7 @@ void CSharpInstance::get_event_signals_state_for_reloading(List<Pair<StringName,
|
|||
Array serialized_data;
|
||||
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TrySerializeDelegate).invoke(delegate_field_value, managed_serialized_data, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -1910,7 +1910,7 @@ bool CSharpInstance::_reference_owner_unsafe() {
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!base_ref);
|
||||
CRASH_COND(owner == NULL);
|
||||
CRASH_COND(owner == nullptr);
|
||||
CRASH_COND(unsafe_referenced); // already referenced
|
||||
#endif
|
||||
|
||||
|
|
@ -1932,7 +1932,7 @@ bool CSharpInstance::_unreference_owner_unsafe() {
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!base_ref);
|
||||
CRASH_COND(owner == NULL);
|
||||
CRASH_COND(owner == nullptr);
|
||||
#endif
|
||||
|
||||
if (!unsafe_referenced)
|
||||
|
|
@ -1953,13 +1953,13 @@ bool CSharpInstance::_unreference_owner_unsafe() {
|
|||
MonoObject *CSharpInstance::_internal_new_managed() {
|
||||
// Search the constructor first, to fail with an error if it's not found before allocating anything else.
|
||||
GDMonoMethod *ctor = script->script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
|
||||
ERR_FAIL_NULL_V_MSG(ctor, NULL,
|
||||
ERR_FAIL_NULL_V_MSG(ctor, nullptr,
|
||||
"Cannot create script instance because the class does not define a parameterless constructor: '" + script->get_path() + "'.");
|
||||
|
||||
CSharpLanguage::get_singleton()->release_script_gchandle(gchandle);
|
||||
|
||||
ERR_FAIL_NULL_V(owner, NULL);
|
||||
ERR_FAIL_COND_V(script.is_null(), NULL);
|
||||
ERR_FAIL_NULL_V(owner, nullptr);
|
||||
ERR_FAIL_COND_V(script.is_null(), nullptr);
|
||||
|
||||
MonoObject *mono_object = mono_object_new(mono_domain_get(), script->script_class->get_mono_ptr());
|
||||
|
||||
|
|
@ -1971,9 +1971,9 @@ MonoObject *CSharpInstance::_internal_new_managed() {
|
|||
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
|
||||
CRASH_COND(die == true);
|
||||
|
||||
owner = NULL;
|
||||
owner = nullptr;
|
||||
|
||||
ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Failed to allocate memory for the object.");
|
||||
}
|
||||
|
||||
// Tie managed to unmanaged
|
||||
|
|
@ -1985,7 +1985,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
|
|||
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, owner);
|
||||
|
||||
// Construct
|
||||
ctor->invoke_raw(mono_object, NULL);
|
||||
ctor->invoke_raw(mono_object, nullptr);
|
||||
|
||||
return mono_object;
|
||||
}
|
||||
|
|
@ -2066,7 +2066,7 @@ void CSharpInstance::refcount_incremented() {
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!base_ref);
|
||||
CRASH_COND(owner == NULL);
|
||||
CRASH_COND(owner == nullptr);
|
||||
#endif
|
||||
|
||||
Reference *ref_owner = Object::cast_to<Reference>(owner);
|
||||
|
|
@ -2089,7 +2089,7 @@ bool CSharpInstance::refcount_decremented() {
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!base_ref);
|
||||
CRASH_COND(owner == NULL);
|
||||
CRASH_COND(owner == nullptr);
|
||||
#endif
|
||||
|
||||
Reference *ref_owner = Object::cast_to<Reference>(owner);
|
||||
|
|
@ -2181,7 +2181,7 @@ void CSharpInstance::notification(int p_notification) {
|
|||
MonoObject *mono_object = get_mono_object();
|
||||
ERR_FAIL_NULL(mono_object);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
GDMonoUtils::dispose(mono_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -2226,13 +2226,13 @@ String CSharpInstance::to_string(bool *r_valid) {
|
|||
|
||||
MonoObject *mono_object = get_mono_object();
|
||||
|
||||
if (mono_object == NULL) {
|
||||
if (mono_object == nullptr) {
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
}
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
MonoString *result = GDMonoUtils::object_to_string(mono_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -2242,7 +2242,7 @@ String CSharpInstance::to_string(bool *r_valid) {
|
|||
return String();
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
if (r_valid)
|
||||
*r_valid = false;
|
||||
return String();
|
||||
|
|
@ -2276,13 +2276,13 @@ CSharpInstance::~CSharpInstance() {
|
|||
// This destructor is not called from the owners destructor.
|
||||
// This could be being called from the owner's set_script_instance method,
|
||||
// meaning this script is being replaced with another one. If this is the case,
|
||||
// we must call Dispose here, because Dispose calls owner->set_script_instance(NULL)
|
||||
// we must call Dispose here, because Dispose calls owner->set_script_instance(nullptr)
|
||||
// and that would mess up with the new script instance if called later.
|
||||
|
||||
MonoObject *mono_object = gchandle.get_target();
|
||||
|
||||
if (mono_object) {
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
GDMonoUtils::dispose(mono_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -2312,7 +2312,7 @@ CSharpInstance::~CSharpInstance() {
|
|||
CRASH_COND(die == true); // `owner_keep_alive` holds a reference, so it can't die
|
||||
|
||||
void *data = owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
|
||||
CRASH_COND(data == NULL);
|
||||
CRASH_COND(data == nullptr);
|
||||
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
|
||||
|
|
@ -2455,11 +2455,11 @@ bool CSharpScript::_update_exports() {
|
|||
|
||||
GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
|
||||
|
||||
ERR_FAIL_NULL_V_MSG(ctor, NULL,
|
||||
ERR_FAIL_NULL_V_MSG(ctor, false,
|
||||
"Cannot construct temporary MonoObject because the class does not define a parameterless constructor: '" + get_path() + "'.");
|
||||
|
||||
MonoException *ctor_exc = NULL;
|
||||
ctor->invoke(tmp_object, NULL, &ctor_exc);
|
||||
MonoException *ctor_exc = nullptr;
|
||||
ctor->invoke(tmp_object, nullptr, &ctor_exc);
|
||||
|
||||
Object *tmp_native = GDMonoMarshal::unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(tmp_object));
|
||||
|
||||
|
|
@ -2467,7 +2467,7 @@ bool CSharpScript::_update_exports() {
|
|||
// TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
|
||||
|
||||
GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
|
||||
tmp_object = NULL;
|
||||
tmp_object = nullptr;
|
||||
|
||||
ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
|
||||
GDMonoUtils::debug_print_unhandled_exception(ctor_exc);
|
||||
|
|
@ -2514,7 +2514,7 @@ bool CSharpScript::_update_exports() {
|
|||
exported_members_cache.push_front(prop_info);
|
||||
|
||||
if (tmp_object) {
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
MonoObject *ret = property->get_value(tmp_object, &exc);
|
||||
if (exc) {
|
||||
exported_members_defval_cache[member_name] = Variant();
|
||||
|
|
@ -2533,11 +2533,11 @@ bool CSharpScript::_update_exports() {
|
|||
}
|
||||
|
||||
// Need to check this here, before disposal
|
||||
bool base_ref = Object::cast_to<Reference>(tmp_native) != NULL;
|
||||
bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr;
|
||||
|
||||
// Dispose the temporary managed instance
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
GDMonoUtils::dispose(tmp_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -2546,7 +2546,7 @@ bool CSharpScript::_update_exports() {
|
|||
}
|
||||
|
||||
GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
|
||||
tmp_object = NULL;
|
||||
tmp_object = nullptr;
|
||||
|
||||
if (tmp_native && !base_ref) {
|
||||
Node *node = Object::cast_to<Node>(tmp_native);
|
||||
|
|
@ -2609,9 +2609,9 @@ void CSharpScript::load_script_signals(GDMonoClass *p_class, GDMonoClass *p_nati
|
|||
|
||||
List<StringName> found_event_signals;
|
||||
|
||||
void *iter = NULL;
|
||||
MonoEvent *raw_event = NULL;
|
||||
while ((raw_event = mono_class_get_events(top->get_mono_ptr(), &iter)) != NULL) {
|
||||
void *iter = nullptr;
|
||||
MonoEvent *raw_event = nullptr;
|
||||
while ((raw_event = mono_class_get_events(top->get_mono_ptr(), &iter)) != nullptr) {
|
||||
MonoCustomAttrInfo *event_attrs = mono_custom_attrs_from_event(top->get_mono_ptr(), raw_event);
|
||||
if (event_attrs) {
|
||||
if (mono_custom_attrs_has_attr(event_attrs, CACHED_CLASS(SignalAttribute)->get_mono_ptr())) {
|
||||
|
|
@ -2811,7 +2811,7 @@ int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, Manage
|
|||
// Instead of using mono_field_get_value_object, we can do this without boxing. Check the
|
||||
// internal mono functions: ves_icall_System_Enum_GetEnumValuesAndNames and the get_enum_field.
|
||||
|
||||
MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, NULL);
|
||||
MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, nullptr);
|
||||
|
||||
ERR_FAIL_NULL_V_MSG(val_obj, -1, "Failed to get '" + enum_field_name + "' constant enum value.");
|
||||
|
||||
|
|
@ -2835,7 +2835,7 @@ int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, Manage
|
|||
}
|
||||
} else if (p_variant_type == Variant::OBJECT && CACHED_CLASS(GodotResource)->is_assignable_from(p_type.type_class)) {
|
||||
GDMonoClass *field_native_class = GDMonoUtils::get_class_native_base(p_type.type_class);
|
||||
CRASH_COND(field_native_class == NULL);
|
||||
CRASH_COND(field_native_class == nullptr);
|
||||
|
||||
r_hint = PROPERTY_HINT_RESOURCE_TYPE;
|
||||
r_hint_string = String(NATIVE_GDMONOCLASS_NAME(field_native_class));
|
||||
|
|
@ -2877,14 +2877,14 @@ void CSharpScript::_clear() {
|
|||
tool = false;
|
||||
valid = false;
|
||||
|
||||
base = NULL;
|
||||
native = NULL;
|
||||
script_class = NULL;
|
||||
base = nullptr;
|
||||
native = nullptr;
|
||||
script_class = nullptr;
|
||||
}
|
||||
|
||||
Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||
|
||||
if (unlikely(GDMono::get_singleton() == NULL)) {
|
||||
if (unlikely(GDMono::get_singleton() == nullptr)) {
|
||||
// Probably not the best error but eh.
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
return Variant();
|
||||
|
|
@ -2898,7 +2898,7 @@ Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, i
|
|||
GDMonoMethod *method = top->get_method(p_method, p_argcount);
|
||||
|
||||
if (method && method->is_static()) {
|
||||
MonoObject *result = method->invoke(NULL, p_args);
|
||||
MonoObject *result = method->invoke(nullptr, p_args);
|
||||
|
||||
if (result) {
|
||||
return GDMonoMarshal::mono_object_to_variant(result);
|
||||
|
|
@ -2960,7 +2960,7 @@ Ref<CSharpScript> CSharpScript::create_for_managed_type(GDMonoClass *p_class, GD
|
|||
|
||||
// This method should not fail, only assertions allowed
|
||||
|
||||
CRASH_COND(p_class == NULL);
|
||||
CRASH_COND(p_class == nullptr);
|
||||
|
||||
// TODO OPTIMIZE: Cache the 'CSharpScript' associated with this 'p_class' instead of allocating a new one every time
|
||||
Ref<CSharpScript> script = memnew(CSharpScript);
|
||||
|
|
@ -2974,13 +2974,13 @@ void CSharpScript::initialize_for_managed_type(Ref<CSharpScript> p_script, GDMon
|
|||
|
||||
// This method should not fail, only assertions allowed
|
||||
|
||||
CRASH_COND(p_class == NULL);
|
||||
CRASH_COND(p_class == nullptr);
|
||||
|
||||
p_script->name = p_class->get_name();
|
||||
p_script->script_class = p_class;
|
||||
p_script->native = p_native;
|
||||
|
||||
CRASH_COND(p_script->native == NULL);
|
||||
CRASH_COND(p_script->native == nullptr);
|
||||
|
||||
GDMonoClass *base = p_script->script_class->get_parent_class();
|
||||
|
||||
|
|
@ -3046,12 +3046,12 @@ bool CSharpScript::can_instance() const {
|
|||
// For tool scripts, this will never fire if the class is not found. That's because we
|
||||
// don't know if it's a tool script if we can't find the class to access the attributes.
|
||||
if (extra_cond && !script_class) {
|
||||
if (GDMono::get_singleton()->get_project_assembly() == NULL) {
|
||||
if (GDMono::get_singleton()->get_project_assembly() == nullptr) {
|
||||
// The project assembly is not loaded
|
||||
ERR_FAIL_V_MSG(NULL, "Cannot instance script because the project assembly is not loaded. Script: '" + get_path() + "'.");
|
||||
ERR_FAIL_V_MSG(false, "Cannot instance script because the project assembly is not loaded. Script: '" + get_path() + "'.");
|
||||
} else {
|
||||
// The project assembly is loaded, but the class could not found
|
||||
ERR_FAIL_V_MSG(NULL, "Cannot instance script because the class '" + name + "' could not be found. Script: '" + get_path() + "'.");
|
||||
ERR_FAIL_V_MSG(false, "Cannot instance script because the class '" + name + "' could not be found. Script: '" + get_path() + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3074,13 +3074,13 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
|
|||
|
||||
// Search the constructor first, to fail with an error if it's not found before allocating anything else.
|
||||
GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), p_argcount);
|
||||
if (ctor == NULL) {
|
||||
ERR_FAIL_COND_V_MSG(p_argcount == 0, NULL,
|
||||
if (ctor == nullptr) {
|
||||
ERR_FAIL_COND_V_MSG(p_argcount == 0, nullptr,
|
||||
"Cannot create script instance. The class '" + script_class->get_full_name() +
|
||||
"' does not define a parameterless constructor." +
|
||||
(get_path().empty() ? String() : " Path: '" + get_path() + "'."));
|
||||
|
||||
ERR_FAIL_V_MSG(NULL, "Constructor not found.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Constructor not found.");
|
||||
}
|
||||
|
||||
Ref<Reference> ref;
|
||||
|
|
@ -3092,13 +3092,13 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
|
|||
// If the object had a script instance binding, dispose it before adding the CSharpInstance
|
||||
if (p_owner->has_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index())) {
|
||||
void *data = p_owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
|
||||
CRASH_COND(data == NULL);
|
||||
CRASH_COND(data == nullptr);
|
||||
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited && !script_binding.gchandle.is_released()) {
|
||||
MonoObject *mono_object = script_binding.gchandle.get_target();
|
||||
if (mono_object) {
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
GDMonoUtils::dispose(mono_object, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -3123,15 +3123,15 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
|
|||
if (!mono_object) {
|
||||
// Important to clear this before destroying the script instance here
|
||||
instance->script = Ref<CSharpScript>();
|
||||
instance->owner = NULL;
|
||||
instance->owner = nullptr;
|
||||
|
||||
bool die = instance->_unreference_owner_unsafe();
|
||||
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
|
||||
CRASH_COND(die == true);
|
||||
|
||||
p_owner->set_script_instance(NULL);
|
||||
p_owner->set_script_instance(nullptr);
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
|
||||
ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Failed to allocate memory for the object.");
|
||||
}
|
||||
|
||||
// Tie managed to unmanaged
|
||||
|
|
@ -3177,7 +3177,7 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
|
|||
ref = REF(r);
|
||||
}
|
||||
|
||||
CSharpInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
|
||||
CSharpInstance *instance = _create_instance(p_args, p_argcount, owner, r != nullptr, r_error);
|
||||
if (!instance) {
|
||||
if (ref.is_null()) {
|
||||
memdelete(owner); //no owner, sorry
|
||||
|
|
@ -3206,15 +3206,15 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
|
|||
"Script inherits from native type '" + String(native_name) +
|
||||
"', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
|
||||
}
|
||||
ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(native_name) +
|
||||
"', so it can't be instanced in object of type: '" + p_this->get_class() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(native_name) +
|
||||
"', so it can't be instanced in object of type: '" + p_this->get_class() + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
GD_MONO_SCOPE_THREAD_ATTACH;
|
||||
|
||||
Callable::CallError unchecked_error;
|
||||
return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
|
||||
return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
|
||||
}
|
||||
|
||||
PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_this) {
|
||||
|
|
@ -3225,7 +3225,7 @@ PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_t
|
|||
_update_exports();
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -3333,7 +3333,7 @@ Error CSharpScript::reload(bool p_keep_state) {
|
|||
script_class = project_assembly->get_object_derived_class(name);
|
||||
}
|
||||
|
||||
valid = script_class != NULL;
|
||||
valid = script_class != nullptr;
|
||||
|
||||
if (script_class) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
|
@ -3355,7 +3355,7 @@ Error CSharpScript::reload(bool p_keep_state) {
|
|||
|
||||
native = GDMonoUtils::get_class_native_base(script_class);
|
||||
|
||||
CRASH_COND(native == NULL);
|
||||
CRASH_COND(native == nullptr);
|
||||
|
||||
GDMonoClass *base_class = script_class->get_parent_class();
|
||||
|
||||
|
|
@ -3767,7 +3767,7 @@ void ResourceFormatSaverCSharpScript::get_recognized_extensions(const RES &p_res
|
|||
|
||||
bool ResourceFormatSaverCSharpScript::recognize(const RES &p_resource) const {
|
||||
|
||||
return Object::cast_to<CSharpScript>(p_resource.ptr()) != NULL;
|
||||
return Object::cast_to<CSharpScript>(p_resource.ptr()) != nullptr;
|
||||
}
|
||||
|
||||
CSharpLanguage::StringNameCache::StringNameCache() {
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ public:
|
|||
};
|
||||
|
||||
struct EventSignal {
|
||||
GDMonoField *field = NULL;
|
||||
GDMonoMethod *invoke_method = NULL;
|
||||
GDMonoField *field = nullptr;
|
||||
GDMonoMethod *invoke_method = nullptr;
|
||||
Vector<SignalParameter> parameters;
|
||||
};
|
||||
|
||||
|
|
@ -331,8 +331,8 @@ struct CSharpScriptBinding {
|
|||
|
||||
CSharpScriptBinding() :
|
||||
inited(false),
|
||||
wrapper_class(NULL),
|
||||
owner(NULL) {
|
||||
wrapper_class(nullptr),
|
||||
owner(nullptr) {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
xml_output.append("\"/>");
|
||||
} else {
|
||||
// Try to find as global enum constant
|
||||
const EnumInterface *target_ienum = NULL;
|
||||
const EnumInterface *target_ienum = nullptr;
|
||||
|
||||
for (const List<EnumInterface>::Element *E = global_enums.front(); E; E = E->next()) {
|
||||
target_ienum = &E->get();
|
||||
|
|
@ -449,7 +449,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
xml_output.append("\"/>");
|
||||
} else {
|
||||
// Try to find as enum constant in the current class
|
||||
const EnumInterface *target_ienum = NULL;
|
||||
const EnumInterface *target_ienum = nullptr;
|
||||
|
||||
for (const List<EnumInterface>::Element *E = target_itype->enums.front(); E; E = E->next()) {
|
||||
target_ienum = &E->get();
|
||||
|
|
@ -782,7 +782,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
|
|||
const ConstantInterface &iconstant = E->get();
|
||||
|
||||
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
|
||||
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL);
|
||||
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr);
|
||||
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
|
||||
|
||||
if (summary_lines.size()) {
|
||||
|
|
@ -843,7 +843,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
|
|||
const ConstantInterface &iconstant = F->get();
|
||||
|
||||
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
|
||||
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL);
|
||||
String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr);
|
||||
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
|
||||
|
||||
if (summary_lines.size()) {
|
||||
|
|
@ -1494,7 +1494,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
|
|||
if (idx_arg.type.cname != name_cache.type_int) {
|
||||
// Assume the index parameter is an enum
|
||||
const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
|
||||
CRASH_COND(idx_arg_type == NULL);
|
||||
CRASH_COND(idx_arg_type == nullptr);
|
||||
p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index));
|
||||
} else {
|
||||
p_output.append(itos(p_iprop.index));
|
||||
|
|
@ -1522,7 +1522,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
|
|||
if (idx_arg.type.cname != name_cache.type_int) {
|
||||
// Assume the index parameter is an enum
|
||||
const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
|
||||
CRASH_COND(idx_arg_type == NULL);
|
||||
CRASH_COND(idx_arg_type == nullptr);
|
||||
p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index) + ", ");
|
||||
} else {
|
||||
p_output.append(itos(p_iprop.index) + ", ");
|
||||
|
|
@ -2121,7 +2121,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
|
|||
|
||||
if (return_type->is_object_type) {
|
||||
ptrcall_return_type = return_type->is_reference ? "Ref<Reference>" : return_type->c_type;
|
||||
initialization = return_type->is_reference ? "" : " = NULL";
|
||||
initialization = return_type->is_reference ? "" : " = nullptr";
|
||||
} else {
|
||||
ptrcall_return_type = return_type->c_type;
|
||||
}
|
||||
|
|
@ -2130,10 +2130,10 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
|
|||
p_output.append(" " C_LOCAL_RET);
|
||||
p_output.append(initialization + ";\n");
|
||||
|
||||
String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "NULL" : return_type->c_type_out + "()";
|
||||
String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "nullptr" : return_type->c_type_out + "()";
|
||||
|
||||
if (return_type->ret_as_byref_arg) {
|
||||
p_output.append("\tif (" CS_PARAM_INSTANCE " == NULL) { *arg_ret = ");
|
||||
p_output.append("\tif (" CS_PARAM_INSTANCE " == nullptr) { *arg_ret = ");
|
||||
p_output.append(fail_ret);
|
||||
p_output.append("; ERR_FAIL_MSG(\"Parameter ' arg_ret ' is null.\"); }\n");
|
||||
} else {
|
||||
|
|
@ -2198,8 +2198,8 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
|
|||
}
|
||||
} else {
|
||||
p_output.append("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", ");
|
||||
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "NULL, ");
|
||||
p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "NULL);\n");
|
||||
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "nullptr, ");
|
||||
p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "nullptr);\n");
|
||||
}
|
||||
|
||||
if (!ret_void) {
|
||||
|
|
@ -2241,11 +2241,11 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(con
|
|||
|
||||
// Enum not found. Most likely because none of its constants were bound, so it's empty. That's fine. Use int instead.
|
||||
const Map<StringName, TypeInterface>::Element *int_match = builtin_types.find(name_cache.type_int);
|
||||
ERR_FAIL_NULL_V(int_match, NULL);
|
||||
ERR_FAIL_NULL_V(int_match, nullptr);
|
||||
return &int_match->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placeholder(const TypeReference &p_typeref) {
|
||||
|
|
@ -2412,7 +2412,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
|
||||
iprop.proxy_name = iprop.proxy_name.replace("/", "__"); // Some members have a slash...
|
||||
|
||||
iprop.prop_doc = NULL;
|
||||
iprop.prop_doc = nullptr;
|
||||
|
||||
for (int i = 0; i < itype.class_doc->properties.size(); i++) {
|
||||
const DocData::PropertyDoc &prop_doc = itype.class_doc->properties[i];
|
||||
|
|
@ -2457,7 +2457,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
|
||||
PropertyInfo return_info = method_info.return_val;
|
||||
|
||||
MethodBind *m = imethod.is_virtual ? NULL : ClassDB::get_method(type_cname, method_info.name);
|
||||
MethodBind *m = imethod.is_virtual ? nullptr : ClassDB::get_method(type_cname, method_info.name);
|
||||
|
||||
imethod.is_vararg = m && m->is_vararg();
|
||||
|
||||
|
|
@ -2603,7 +2603,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
// Populate signals
|
||||
|
||||
const HashMap<StringName, MethodInfo> &signal_map = class_info->signal_map;
|
||||
const StringName *k = NULL;
|
||||
const StringName *k = nullptr;
|
||||
|
||||
while ((k = signal_map.next(k))) {
|
||||
SignalInterface isignal;
|
||||
|
|
@ -2685,7 +2685,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
ClassDB::get_integer_constant_list(type_cname, &constants, true);
|
||||
|
||||
const HashMap<StringName, List<StringName>> &enum_map = class_info->enum_map;
|
||||
k = NULL;
|
||||
k = nullptr;
|
||||
|
||||
while ((k = enum_map.next(k))) {
|
||||
StringName enum_proxy_cname = *k;
|
||||
|
|
@ -2707,7 +2707,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
|
||||
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
|
||||
|
||||
iconstant.const_doc = NULL;
|
||||
iconstant.const_doc = nullptr;
|
||||
for (int i = 0; i < itype.class_doc->constants.size(); i++) {
|
||||
const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i];
|
||||
|
||||
|
|
@ -2742,7 +2742,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
|
||||
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
|
||||
|
||||
iconstant.const_doc = NULL;
|
||||
iconstant.const_doc = nullptr;
|
||||
for (int i = 0; i < itype.class_doc->constants.size(); i++) {
|
||||
const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i];
|
||||
|
||||
|
|
@ -3262,7 +3262,7 @@ void BindingsGenerator::_populate_global_constants() {
|
|||
|
||||
String constant_name = GlobalConstants::get_global_constant_name(i);
|
||||
|
||||
const DocData::ConstantDoc *const_doc = NULL;
|
||||
const DocData::ConstantDoc *const_doc = nullptr;
|
||||
for (int j = 0; j < global_scope_doc.constants.size(); j++) {
|
||||
const DocData::ConstantDoc &curr_const_doc = global_scope_doc.constants[j];
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class BindingsGenerator {
|
|||
is_virtual = false;
|
||||
requires_object_call = false;
|
||||
is_internal = false;
|
||||
method_doc = NULL;
|
||||
method_doc = nullptr;
|
||||
is_deprecated = false;
|
||||
}
|
||||
};
|
||||
|
|
@ -202,7 +202,7 @@ class BindingsGenerator {
|
|||
}
|
||||
|
||||
SignalInterface() {
|
||||
method_doc = NULL;
|
||||
method_doc = nullptr;
|
||||
is_deprecated = false;
|
||||
}
|
||||
};
|
||||
|
|
@ -376,7 +376,7 @@ class BindingsGenerator {
|
|||
return &E->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const PropertyInterface *find_property_by_name(const StringName &p_cname) const {
|
||||
|
|
@ -385,7 +385,7 @@ class BindingsGenerator {
|
|||
return &E->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const PropertyInterface *find_property_by_proxy_name(const String &p_proxy_name) const {
|
||||
|
|
@ -394,7 +394,7 @@ class BindingsGenerator {
|
|||
return &E->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const {
|
||||
|
|
@ -403,7 +403,7 @@ class BindingsGenerator {
|
|||
return &E->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -498,7 +498,7 @@ class BindingsGenerator {
|
|||
|
||||
c_arg_in = "%s";
|
||||
|
||||
class_doc = NULL;
|
||||
class_doc = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -622,7 +622,7 @@ class BindingsGenerator {
|
|||
if (it->get().name == p_name) return it;
|
||||
it = it->next();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const ConstantInterface *find_constant_by_name(const String &p_name, const List<ConstantInterface> &p_constants) const {
|
||||
|
|
@ -631,7 +631,7 @@ class BindingsGenerator {
|
|||
return &E->get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline String get_unique_sig(const TypeInterface &p_type) {
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str
|
|||
Variant item_type = p_item_type;
|
||||
Variant include = p_include;
|
||||
const Variant *args[3] = { &project_path, &item_type, &include };
|
||||
MonoException *exc = NULL;
|
||||
klass->get_method("AddItemToProjectChecked", 3)->invoke(NULL, args, &exc);
|
||||
MonoException *exc = nullptr;
|
||||
klass->get_method("AddItemToProjectChecked", 3)->invoke(nullptr, args, &exc);
|
||||
|
||||
if (exc) {
|
||||
GDMonoUtils::debug_print_unhandled_exception(exc);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ MonoString *godot_icall_GodotSharpDirs_MonoSolutionsDir() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_mono_solutions_dir());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ MonoString *godot_icall_GodotSharpDirs_BuildLogsDirs() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_build_logs_dir());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectSlnPath() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_sln_path());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectCsProjPath() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_csproj_path());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorToolsDir() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_tools_dir());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorPrebuiltApiDir() {
|
|||
#ifdef TOOLS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_prebuilt_api_dir());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ MonoString *godot_icall_GodotSharpDirs_DataMonoBinDir() {
|
|||
#ifdef WINDOWS_ENABLED
|
||||
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_mono_bin_dir());
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ uint32_t godot_icall_BindingsGenerator_CsGlueVersion() {
|
|||
}
|
||||
|
||||
int32_t godot_icall_ScriptClassParser_ParseFile(MonoString *p_filepath, MonoObject *p_classes, MonoString **r_error_str) {
|
||||
*r_error_str = NULL;
|
||||
*r_error_str = nullptr;
|
||||
|
||||
String filepath = GDMonoMarshal::mono_string_to_godot(p_filepath);
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ MonoString *godot_icall_Internal_MonoWindowsInstallRoot() {
|
|||
String install_root_dir = GDMono::get_singleton()->get_mono_reg_info().install_root_dir;
|
||||
return GDMonoMarshal::mono_string_from_godot(install_root_dir);
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
|
|||
if (r_dependencies.has(ref_name))
|
||||
continue;
|
||||
|
||||
GDMonoAssembly *ref_assembly = NULL;
|
||||
GDMonoAssembly *ref_assembly = nullptr;
|
||||
String path;
|
||||
bool has_extension = ref_name.ends_with(".dll") || ref_name.ends_with(".exe");
|
||||
|
||||
|
|
@ -70,21 +70,21 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
|
|||
path = search_dir.plus_file(ref_name);
|
||||
if (FileAccess::exists(path)) {
|
||||
GDMono::get_singleton()->load_assembly_from(ref_name.get_basename(), path, &ref_assembly, true);
|
||||
if (ref_assembly != NULL)
|
||||
if (ref_assembly != nullptr)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
path = search_dir.plus_file(ref_name + ".dll");
|
||||
if (FileAccess::exists(path)) {
|
||||
GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true);
|
||||
if (ref_assembly != NULL)
|
||||
if (ref_assembly != nullptr)
|
||||
break;
|
||||
}
|
||||
|
||||
path = search_dir.plus_file(ref_name + ".exe");
|
||||
if (FileAccess::exists(path)) {
|
||||
GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true);
|
||||
if (ref_assembly != NULL)
|
||||
if (ref_assembly != nullptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ Error get_exported_assembly_dependencies(const Dictionary &p_initial_dependencie
|
|||
String assembly_name = *key;
|
||||
String assembly_path = p_initial_dependencies[*key];
|
||||
|
||||
GDMonoAssembly *assembly = NULL;
|
||||
GDMonoAssembly *assembly = nullptr;
|
||||
bool load_success = GDMono::get_singleton()->load_assembly_from(assembly_name, assembly_path, &assembly, /* refonly: */ true);
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!load_success, ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + assembly_name + "'.");
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Object *godot_icall_Object_Ctor(MonoObject *p_obj) {
|
|||
|
||||
void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(p_ptr == NULL);
|
||||
CRASH_COND(p_ptr == nullptr);
|
||||
#endif
|
||||
|
||||
if (p_ptr->get_script_instance()) {
|
||||
|
|
@ -59,7 +59,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
|
|||
if (cs_instance) {
|
||||
if (!cs_instance->is_destructing_script_instance()) {
|
||||
cs_instance->mono_object_disposed(p_obj);
|
||||
p_ptr->set_script_instance(NULL);
|
||||
p_ptr->set_script_instance(nullptr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
|
|||
|
||||
void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(p_ptr == NULL);
|
||||
CRASH_COND(p_ptr == nullptr);
|
||||
// This is only called with Reference derived classes
|
||||
CRASH_COND(!Object::cast_to<Reference>(p_ptr));
|
||||
#endif
|
||||
|
|
@ -99,7 +99,7 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
|
|||
if (delete_owner) {
|
||||
memdelete(ref);
|
||||
} else if (remove_script_instance) {
|
||||
ref->set_script_instance(NULL);
|
||||
ref->set_script_instance(nullptr);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -141,7 +141,7 @@ MethodBind *godot_icall_Object_ClassDB_get_method(StringName *p_type, MonoString
|
|||
|
||||
MonoObject *godot_icall_Object_weakref(Object *p_ptr) {
|
||||
if (!p_ptr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Ref<WeakRef> wref;
|
||||
Reference *ref = Object::cast_to<Reference>(p_ptr);
|
||||
|
|
@ -149,7 +149,7 @@ MonoObject *godot_icall_Object_weakref(Object *p_ptr) {
|
|||
if (ref) {
|
||||
REF r = ref;
|
||||
if (!r.is_valid())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
wref.instance();
|
||||
wref->set_ref(r);
|
||||
|
|
@ -230,7 +230,7 @@ MonoBoolean godot_icall_DynamicGodotObject_SetMember(Object *p_ptr, MonoString *
|
|||
MonoString *godot_icall_Object_ToString(Object *p_ptr) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
// Cannot happen in C#; would get an ObjectDisposedException instead.
|
||||
CRASH_COND(p_ptr == NULL);
|
||||
CRASH_COND(p_ptr == nullptr);
|
||||
#endif
|
||||
// Can't call 'Object::to_string()' here, as that can end up calling 'ToString' again resulting in an endless circular loop.
|
||||
String result = "[" + p_ptr->get_class() + ":" + itos(p_ptr->get_instance_id()) + "]";
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void godot_icall_Array_Dtor(Array *ptr) {
|
|||
MonoObject *godot_icall_Array_At(Array *ptr, int index) {
|
||||
if (index < 0 || index >= ptr->size()) {
|
||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return GDMonoMarshal::variant_to_mono_object(ptr->operator[](index));
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ MonoObject *godot_icall_Array_At(Array *ptr, int index) {
|
|||
MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class) {
|
||||
if (index < 0 || index >= ptr->size()) {
|
||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return GDMonoMarshal::variant_to_mono_object(ptr->operator[](index), ManagedType(type_encoding, type_class));
|
||||
}
|
||||
|
|
@ -162,28 +162,28 @@ void godot_icall_Dictionary_Dtor(Dictionary *ptr) {
|
|||
|
||||
MonoObject *godot_icall_Dictionary_GetValue(Dictionary *ptr, MonoObject *key) {
|
||||
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
|
||||
if (ret == NULL) {
|
||||
if (ret == nullptr) {
|
||||
MonoObject *exc = mono_object_new(mono_domain_get(), CACHED_CLASS(KeyNotFoundException)->get_mono_ptr());
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!exc);
|
||||
#endif
|
||||
GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
|
||||
GDMonoUtils::set_pending_exception((MonoException *)exc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return GDMonoMarshal::variant_to_mono_object(ret);
|
||||
}
|
||||
|
||||
MonoObject *godot_icall_Dictionary_GetValue_Generic(Dictionary *ptr, MonoObject *key, uint32_t type_encoding, GDMonoClass *type_class) {
|
||||
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
|
||||
if (ret == NULL) {
|
||||
if (ret == nullptr) {
|
||||
MonoObject *exc = mono_object_new(mono_domain_get(), CACHED_CLASS(KeyNotFoundException)->get_mono_ptr());
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(!exc);
|
||||
#endif
|
||||
GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
|
||||
GDMonoUtils::set_pending_exception((MonoException *)exc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return GDMonoMarshal::variant_to_mono_object(ret, ManagedType(type_encoding, type_class));
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ int godot_icall_Dictionary_Count(Dictionary *ptr) {
|
|||
void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value) {
|
||||
Variant varKey = GDMonoMarshal::mono_object_to_variant(key);
|
||||
Variant *ret = ptr->getptr(varKey);
|
||||
if (ret != NULL) {
|
||||
if (ret != nullptr) {
|
||||
GDMonoUtils::set_pending_exception(mono_get_exception_argument("key", "An element with the same key already exists"));
|
||||
return;
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ void godot_icall_Dictionary_Clear(Dictionary *ptr) {
|
|||
MonoBoolean godot_icall_Dictionary_Contains(Dictionary *ptr, MonoObject *key, MonoObject *value) {
|
||||
// no dupes
|
||||
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
|
||||
return ret != NULL && *ret == GDMonoMarshal::mono_object_to_variant(value);
|
||||
return ret != nullptr && *ret == GDMonoMarshal::mono_object_to_variant(value);
|
||||
}
|
||||
|
||||
MonoBoolean godot_icall_Dictionary_ContainsKey(Dictionary *ptr, MonoObject *key) {
|
||||
|
|
@ -241,7 +241,7 @@ MonoBoolean godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, Mono
|
|||
|
||||
// no dupes
|
||||
Variant *ret = ptr->getptr(varKey);
|
||||
if (ret != NULL && *ret == GDMonoMarshal::mono_object_to_variant(value)) {
|
||||
if (ret != nullptr && *ret == GDMonoMarshal::mono_object_to_variant(value)) {
|
||||
ptr->erase(varKey);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -251,8 +251,8 @@ MonoBoolean godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, Mono
|
|||
|
||||
MonoBoolean godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoObject **value) {
|
||||
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
|
||||
if (ret == NULL) {
|
||||
*value = NULL;
|
||||
if (ret == nullptr) {
|
||||
*value = nullptr;
|
||||
return false;
|
||||
}
|
||||
*value = GDMonoMarshal::variant_to_mono_object(ret);
|
||||
|
|
@ -261,8 +261,8 @@ MonoBoolean godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key,
|
|||
|
||||
MonoBoolean godot_icall_Dictionary_TryGetValue_Generic(Dictionary *ptr, MonoObject *key, MonoObject **value, uint32_t type_encoding, GDMonoClass *type_class) {
|
||||
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
|
||||
if (ret == NULL) {
|
||||
*value = NULL;
|
||||
if (ret == nullptr) {
|
||||
*value = nullptr;
|
||||
return false;
|
||||
}
|
||||
*value = GDMonoMarshal::variant_to_mono_object(ret, ManagedType(type_encoding, type_class));
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) {
|
||||
Variant ret;
|
||||
PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes);
|
||||
Error err = decode_variant(ret, varr.ptr(), varr.size(), NULL, p_allow_objects);
|
||||
Error err = decode_variant(ret, varr.ptr(), varr.size(), nullptr, p_allow_objects);
|
||||
if (err != OK) {
|
||||
ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ MonoObject *godot_icall_GD_convert(MonoObject *p_what, int32_t p_type) {
|
|||
const Variant *args[1] = { &what };
|
||||
Callable::CallError ce;
|
||||
Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce);
|
||||
ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, NULL);
|
||||
ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, nullptr);
|
||||
return GDMonoMarshal::variant_to_mono_object(ret);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ void godot_icall_GD_print(MonoArray *p_what) {
|
|||
for (int i = 0; i < length; i++) {
|
||||
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -98,7 +98,7 @@ void godot_icall_GD_printerr(MonoArray *p_what) {
|
|||
for (int i = 0; i < length; i++) {
|
||||
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -119,7 +119,7 @@ void godot_icall_GD_printraw(MonoArray *p_what) {
|
|||
for (int i = 0; i < length; i++) {
|
||||
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -140,7 +140,7 @@ void godot_icall_GD_prints(MonoArray *p_what) {
|
|||
for (int i = 0; i < length; i++) {
|
||||
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -164,7 +164,7 @@ void godot_icall_GD_printt(MonoArray *p_what) {
|
|||
for (int i = 0; i < length; i++) {
|
||||
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -259,8 +259,8 @@ MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_object
|
|||
|
||||
PackedByteArray barr;
|
||||
int len;
|
||||
Error err = encode_variant(var, NULL, len, p_full_objects);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
|
||||
Error err = encode_variant(var, nullptr, len, p_full_objects);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, nullptr, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
|
||||
|
||||
barr.resize(len);
|
||||
encode_variant(var, barr.ptrw(), len, p_full_objects);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void godot_register_glue_header_icalls() {
|
|||
#include "../mono_gd/gd_mono_utils.h"
|
||||
|
||||
#define GODOTSHARP_INSTANCE_OBJECT(m_instance, m_type) \
|
||||
static ClassDB::ClassInfo *ci = NULL; \
|
||||
static ClassDB::ClassInfo *ci = nullptr; \
|
||||
if (!ci) { \
|
||||
ci = ClassDB::classes.getptr(m_type); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void ManagedCallable::call(const Variant **p_arguments, int p_argcount, Variant
|
|||
|
||||
MonoObject *delegate = delegate_handle.get_target();
|
||||
|
||||
MonoException *exc = NULL;
|
||||
MonoException *exc = nullptr;
|
||||
MonoObject *ret = delegate_invoke->invoke(delegate, p_arguments, &exc);
|
||||
|
||||
if (exc) {
|
||||
|
|
@ -119,7 +119,7 @@ void ManagedCallable::set_delegate(MonoDelegate *p_delegate) {
|
|||
|
||||
ManagedCallable::ManagedCallable(MonoDelegate *p_delegate) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(p_delegate == NULL);
|
||||
CRASH_COND(p_delegate == nullptr);
|
||||
#endif
|
||||
|
||||
set_delegate(p_delegate);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
void MonoGCHandleData::release() {
|
||||
#ifdef DEBUG_ENABLED
|
||||
CRASH_COND(handle && GDMono::get_singleton() == NULL);
|
||||
CRASH_COND(handle && GDMono::get_singleton() == nullptr);
|
||||
#endif
|
||||
|
||||
if (handle && GDMono::get_singleton()->is_runtime_initialized()) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue