Break coding style

This commit is contained in:
Perttu Ahola 2014-10-22 12:30:29 +03:00
parent b033ac78b2
commit 917ef1b3ad
14 changed files with 51 additions and 45 deletions

View File

@ -36,9 +36,9 @@ namespace ground_plane_lighting
std::function<void(ground_plane_lighting::Interface*)> cb)
{
return server->access_module("ground_plane_lighting",
[&](interface::Module *module){
[&](interface::Module *module){
auto *iface = (ground_plane_lighting::Interface*)
module->check_interface();
module->check_interface();
cb(iface);
});
}

View File

@ -82,8 +82,8 @@ struct YSTSector
auto lc = region.getLowerCorner();
auto uc = region.getUpperCorner();
/*log_v(MODULE, "YSTSector volume lc=" PV3I_FORMAT ", uc=" PV3I_FORMAT
", size=%zu", PV3I_PARAMS(lc), PV3I_PARAMS(uc),
volume->m_dataSize);*/
", size=%zu", PV3I_PARAMS(lc), PV3I_PARAMS(uc),
volume->m_dataSize);*/
for(int z = lc.getZ(); z <= uc.getZ(); z++){
for(int x = lc.getX(); x <= uc.getX(); x++){
volume->setVoxelAt(x, 0, z, INT_MIN);
@ -196,7 +196,7 @@ struct YstCommitHook: public voxelworld::CommitHook
int y = uc.getY();
for(;; y--){
VoxelInstance v = ivoxelworld->get_voxel(
pv::Vector3DInt32(x, y, z), true);
pv::Vector3DInt32(x, y, z), true);
if(v.get_id() == interface::VOXELTYPEID_UNDEFINED){
// NOTE: This leaves the chunks below unhandled;
// there would have to be some kind of a dirty
@ -253,9 +253,9 @@ struct Module: public interface::Module, public ground_plane_lighting::Interface
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
{
pv::Vector3DInt16 section_size =
ivoxelworld->get_section_size_voxels();
ivoxelworld->get_section_size_voxels();
pv::Vector<2, int16_t> sector_size(
section_size.getX(), section_size.getZ());
section_size.getX(), section_size.getZ());
m_global_yst.reset(new GlobalYSTMap(sector_size));
});
}
@ -277,7 +277,7 @@ struct Module: public interface::Module, public ground_plane_lighting::Interface
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
{
ivoxelworld->add_commit_hook(
up_<YstCommitHook>(new YstCommitHook(m_server)));
up_<YstCommitHook>(new YstCommitHook(m_server)));
});
}
@ -308,7 +308,7 @@ struct Module: public interface::Module, public ground_plane_lighting::Interface
}
network::access(m_server, [&](network::Interface *inetwork){
sv_<network::PeerInfo::Id> peers = inetwork->list_peers();
for(auto &peer : peers){
for(auto &peer: peers){
inetwork->send(peer, "ground_plane_lighting:update",
os.str());
}

View File

@ -521,7 +521,7 @@ struct Module: public interface::Module, public voxelworld::Interface
Zone *node_zone = n->CreateComponent<Zone>();
node_zone->SetPriority(-1000);
node_zone->SetBoundingBox(BoundingBox(
Vector3(-w/2, -h/2, -d/2), Vector3(w/2, h/2, d/2)));
Vector3(-w/2, -h/2, -d/2), Vector3(w/2, h/2, d/2)));
n->SetScale(Vector3(1.0f, 1.0f, 1.0f));
n->SetPosition(node_p);

View File

@ -97,7 +97,8 @@ struct Module: public interface::Module
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
body->SetFriction(0.75f);
body->SetMass(1.0);
CollisionShape *shape = n->CreateComponent<CollisionShape>(LOCAL);
CollisionShape *shape = n->CreateComponent<CollisionShape>(
LOCAL);
shape->SetConvexHull(model, 0, Vector3::ONE);
//shape->SetTriangleMesh(model, 0, Vector3::ONE);
//shape->SetBox(Vector3::ONE);
@ -154,7 +155,8 @@ struct Module: public interface::Module
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
body->SetFriction(0.75f);
CollisionShape *shape = n->CreateComponent<CollisionShape>(LOCAL);
CollisionShape *shape = n->CreateComponent<CollisionShape>(
LOCAL);
shape->SetTriangleMesh(model, 0, Vector3::ONE);
}
});

View File

@ -173,7 +173,8 @@ struct Module: public interface::Module
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
body->SetFriction(0.75f);
body->SetMass(1.0);
CollisionShape *shape = n->CreateComponent<CollisionShape>(LOCAL);
CollisionShape *shape = n->CreateComponent<CollisionShape>(
LOCAL);
shape->SetConvexHull(model, 0, Vector3::ONE);
//shape->SetTriangleMesh(model, 0, Vector3::ONE);
//shape->SetBox(Vector3::ONE);
@ -238,7 +239,8 @@ struct Module: public interface::Module
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
body->SetFriction(0.75f);
CollisionShape *shape = n->CreateComponent<CollisionShape>(LOCAL);
CollisionShape *shape = n->CreateComponent<CollisionShape>(
LOCAL);
shape->SetTriangleMesh(model, 0, Vector3::ONE);
}
});

View File

@ -362,11 +362,11 @@ void CState::setup_packet_handlers()
// This is the scene
} else if(node){
log_w(MODULE, "replicate:create_node: Node %i (old name=\"%s\")"
" already exists. This could be due to a node having been"
" accidentally created on the client side without mode=LOCAL."
" If a node seems to mysteriously disappear, this is the"
" reason.",
node_id, node->GetName().CString());
" already exists. This could be due to a node having been"
" accidentally created on the client side without mode=LOCAL."
" If a node seems to mysteriously disappear, this is the"
" reason.",
node_id, node->GetName().CString());
} else {
log_v(MODULE, "Creating node %i", node_id);
// Add to the root level; it may be moved as we receive the parent
@ -401,11 +401,11 @@ void CState::setup_packet_handlers()
if(!c || c->GetType() != type || c->GetNode() != node){
if(c){
log_w(MODULE, "replicate:create_node: Component %i already"
" exists. This could be due to a component having"
" been accidentally created on the client side"
" without mode=LOCAL."
" If a component seems to mysteriously disappear,"
" this is the reason.", c_id);
" exists. This could be due to a component having"
" been accidentally created on the client side"
" without mode=LOCAL."
" If a component seems to mysteriously disappear,"
" this is the reason.", c_id);
c->Remove();
}
log_v(MODULE, "Creating component %i", c_id);

View File

@ -179,9 +179,9 @@ struct CAtlasRegistry: public AtlasRegistry
size_t max_segments = atlas.total_segments.x_ * atlas.total_segments.y_;
if(atlas.segments.size() > max_segments){
throw Exception("Atlas has too many segments (segments.size()="+
itos(atlas.segments.size())+", total_segments=("+
itos(atlas.total_segments.x_)+", "+
itos(atlas.total_segments.y_)+"))");
itos(atlas.segments.size())+", total_segments=("+
itos(atlas.total_segments.x_)+", "+
itos(atlas.total_segments.y_)+"))");
}
// Set segment texture
cache.texture = atlas.texture;

View File

@ -846,6 +846,7 @@ void generate_voxel_physics_boxes(
voxel_reg->get_cached(v_orig);
if(!def)
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

@ -13,5 +13,6 @@ int64_t get_timeofday_us()
return (int64_t)tv.tv_sec * 1000000 + (int64_t)tv.tv_usec;
}
}}
}
}
// vim: set noet ts=4 sw=4:

View File

@ -6,20 +6,20 @@
namespace std {
template<> struct hash<PolyVox::Vector<2u, int16_t>>{
std::size_t operator()(const PolyVox::Vector<2u, int16_t> &v) const {
return ((std::hash<int16_t>() (v.getX()) << 0) ^
(std::hash<int16_t>() (v.getY()) << 1));
}
};
template<> struct hash<PolyVox::Vector<2u, int16_t>>{
std::size_t operator()(const PolyVox::Vector<2u, int16_t> &v) const {
return ((std::hash<int16_t>() (v.getX()) << 0) ^
(std::hash<int16_t>() (v.getY()) << 1));
}
};
template<> struct hash<PolyVox::Vector<3u, int16_t>>{
std::size_t operator()(const PolyVox::Vector<3u, int16_t> &v) const {
return ((std::hash<int16_t>() (v.getX()) << 0) ^
(std::hash<int16_t>() (v.getY()) << 1) ^
(std::hash<int16_t>() (v.getZ()) << 2));
}
};
template<> struct hash<PolyVox::Vector<3u, int16_t>>{
std::size_t operator()(const PolyVox::Vector<3u, int16_t> &v) const {
return ((std::hash<int16_t>() (v.getX()) << 0) ^
(std::hash<int16_t>() (v.getY()) << 1) ^
(std::hash<int16_t>() (v.getZ()) << 2));
}
};
}

View File

@ -89,7 +89,7 @@ namespace interface
virtual void add_file_path(const ss_ &name, const ss_ &path) = 0;
virtual void access_thread_pool(std::function<void(
interface::thread_pool::ThreadPool *pool)> cb) = 0;
interface::thread_pool::ThreadPool*pool)> cb) = 0;
};
}
// vim: set noet ts=4 sw=4:

View File

@ -42,5 +42,5 @@
lua_pop(L, 2); /* unsafe, metatable */ \
}
// vim: set noet ts=4 sw=4:
// vim: set noet ts=4 sw=4:

View File

@ -944,7 +944,7 @@ struct CState: public State, public interface::Server
}
void access_thread_pool(std::function<void(
interface::thread_pool::ThreadPool *pool)> cb)
interface::thread_pool::ThreadPool*pool)> cb)
{
interface::MutexScope ms(m_thread_pool_mutex);
cb(m_thread_pool.get());

View File

@ -58,7 +58,7 @@ namespace server
virtual ss_ get_file_path(const ss_ &name) = 0;
virtual void access_thread_pool(std::function<void(
interface::thread_pool::ThreadPool *pool)> cb) = 0;
interface::thread_pool::ThreadPool*pool)> cb) = 0;
};
State* createState();