Rename VoxelInstance::getId() to VoxelInstance::get_id()

This commit is contained in:
Perttu Ahola 2014-10-21 19:08:57 +03:00
parent d8a061f2b4
commit 2e4a1b3ed8
7 changed files with 19 additions and 19 deletions

View File

@ -197,7 +197,7 @@ struct YstCommitHook: public voxelworld::CommitHook
for(;; y--){
VoxelInstance v = ivoxelworld->get_voxel(
pv::Vector3DInt32(x, y, z), true);
if(v.getId() == interface::VOXELTYPEID_UNDEFINED){
if(v.get_id() == interface::VOXELTYPEID_UNDEFINED){
// NOTE: This leaves the chunks below unhandled;
// there would have to be some kind of a dirty
// flag based on which this seach would be
@ -208,7 +208,7 @@ struct YstCommitHook: public voxelworld::CommitHook
const auto *def = voxel_reg->get_cached(v);
if(!def)
throw Exception(ss_()+"Undefined voxel: "+
itos(v.getId()));
itos(v.get_id()));
bool light_passes = (!def || !def->physically_solid);
if(!light_passes)
break;

View File

@ -60,9 +60,9 @@ Buildat TODO
unloaded or not; eg. network can just store the socket fds and be reloaded
without anyone noticing
- Altough, network is very rarely modified so it doesn't really matter
- Rename VoxelInstance::getId() to VoxelInstance::get_id()
- If a file tracked by client_data is deleted and re-added, it won't get updated
before server restart(?)
- Debug instability in server at module reload
- An option in the server to just compile and quit (to be used when one wants to
check for compiler errors but not actually run anything)
- Figure out why digger doesn't work properly when the client connects via menu

View File

@ -385,7 +385,7 @@ struct Module: public interface::Module
for(; y>-50; y--){
pv::Vector3DInt32 p(x, y, z);
VoxelInstance v = ivoxelworld->get_voxel(p);
if(v.getId() != 1)
if(v.get_id() != 1)
break;
}
y++;*/

View File

@ -196,9 +196,9 @@ public:
const interface::CachedVoxelDefinition *front_def =
m_voxel_reg->get_cached(front);
if(!back_def)
throw Exception(ss_()+"Undefined voxel: back="+itos(back.getId()));
throw Exception(ss_()+"Undefined voxel: back="+itos(back.get_id()));
if(!front_def)
throw Exception(ss_()+"Undefined voxel: front="+itos(front.getId()));
throw Exception(ss_()+"Undefined voxel: front="+itos(front.get_id()));
if(!back_def || !back_def->physically_solid)
return false;
if(!front_def || !front_def->physically_solid){
@ -305,9 +305,9 @@ public:
const interface::CachedVoxelDefinition *front_def =
m_voxel_reg->get_cached(front);
if(!back_def)
throw Exception(ss_()+"Undefined voxel: back="+itos(back.getId()));
throw Exception(ss_()+"Undefined voxel: back="+itos(back.get_id()));
if(!front_def)
throw Exception(ss_()+"Undefined voxel: front="+itos(front.getId()));
throw Exception(ss_()+"Undefined voxel: front="+itos(front.get_id()));
/*if(!back_def){
return false;
}*/
@ -315,16 +315,16 @@ public:
return false;
}
else if(back_def->face_draw_type == interface::FaceDrawType::ALWAYS){
materialToUse = back.getId();
materialToUse = back.get_id();
return true;
}
// interface::FaceDrawType::ON_EDGE
if(!front_def){
materialToUse = back.getId();
materialToUse = back.get_id();
return true;
}
if(back_def->edge_material_id != front_def->edge_material_id){
materialToUse = back.getId();
materialToUse = back.get_id();
return true;
}
return false;
@ -423,7 +423,7 @@ void preload_textures(pv::RawVolume<VoxelInstance> &volume,
const interface::CachedVoxelDefinition *def =
voxel_reg->get_cached(v, atlas_reg);
if(!def)
throw Exception(ss_()+"Undefined voxel: "+itos(v.getId()));
throw Exception(ss_()+"Undefined voxel: "+itos(v.get_id()));
}
}
}
@ -641,11 +641,11 @@ up_<pv::RawVolume<VoxelInstance>> generate_voxel_lod_volume(
if(!region_orig.containsPoint(p_orig))
continue;
VoxelInstance v1 = volume_orig.getVoxelAt(p_orig);
if(v1.getId() == interface::VOXELTYPEID_UNDEFINED)
if(v1.get_id() == interface::VOXELTYPEID_UNDEFINED)
continue;
// TODO: Prioritize voxel types better
// Higher is probably more interesting
if(v1.getId() > v_orig.getId())
if(v1.get_id() > v_orig.get_id())
v_orig = v1;
}
}
@ -845,7 +845,7 @@ void generate_voxel_physics_boxes(
const interface::CachedVoxelDefinition *def =
voxel_reg->get_cached(v_orig);
if(!def)
throw Exception(ss_()+"Undefined voxel: "+itos(v_orig.getId()));
throw Exception(ss_()+"Undefined voxel: "+itos(v_orig.get_id()));
uint8_t v = (def && def->physically_solid);
volume.setVoxelAt(x, y, z, v);
}

View File

@ -141,7 +141,7 @@ struct CVoxelRegistry: public VoxelRegistry
const CachedVoxelDefinition* get_cached(const VoxelInstance &v,
AtlasRegistry *atlas_reg)
{
return get_cached(v.getId(), atlas_reg);
return get_cached(v.get_id(), atlas_reg);
}
void update_cache_basic(CachedVoxelDefinition &cache,

View File

@ -116,7 +116,7 @@ namespace interface
// Create voxel from raw data (MSBs are preserved)
VoxelInstance(uint32_t id): data(id){}
VoxelTypeId getId() const {return data & 0x001fffff; }
VoxelTypeId get_id() const {return data & 0x001fffff; }
uint8_t getMSB() const {return (data>>24) & 0xff; }
};
}

View File

@ -153,10 +153,10 @@ void init_voxel_volume(lua_State *L)
class_<VoxelInstance>("__buildat_VoxelInstance")
.def(constructor<uint32_t>())
.def_readwrite("data", &VoxelInstance::data)
.property("id", &VoxelInstance::getId)
.property("id", &VoxelInstance::get_id)
.property("int32", &voxelinstance_get_int32,
&voxelinstance_set_int32)
.def("get_id", &VoxelInstance::getId)
.def("get_id", &VoxelInstance::get_id)
,
class_<CommonVolume, bases<>, sp_<CommonVolume>>("__buildat_Volume")
.def(constructor<const pv::Region &>())