Fix coding style

master
Perttu Ahola 2014-11-01 22:08:03 +02:00
parent 7cbd9d3ac4
commit 52b9031100
59 changed files with 619 additions and 613 deletions

View File

@ -43,8 +43,7 @@ void interval_loop(int interval_us, std::function<bool(float load_avg)> f)
int64_t t_tick_end = get_timeofday_us();
int64_t t_tick_length = t_tick_end > t_tick_start ? t_tick_end -
t_tick_start :
0;
t_tick_start : 0;
float load_ratio = (float)t_tick_length / interval_us;
//log_i("loop", "load_ratio=%f", load_ratio);
load_log[load_log_i] = load_ratio;

View File

@ -10,7 +10,7 @@ namespace main_context
{
struct OpaqueSceneReference;
typedef OpaqueSceneReference* SceneReference;
};
}
namespace ground_plane_lighting
{

View File

@ -16,7 +16,7 @@ namespace main_context
{
struct OpaqueSceneReference;
typedef OpaqueSceneReference* SceneReference;
};
}
namespace replicate
{

View File

@ -85,10 +85,12 @@ struct Module: public interface::Module, public replicate::Interface
if(ps.scene_ref != nullptr){
scene = imc->find_scene(ps.scene_ref);
if(!scene)
log_w(MODULE, "~Module(): Scene %p not found", ps.scene_ref);
log_w(MODULE, "~Module(): Scene %p not found",
ps.scene_ref);
}
if(scene){
scene->CleanupConnection((magic::Connection*)&ps.scene_state);
scene->CleanupConnection(
(magic::Connection*)&ps.scene_state);
}
// Make sure to fully clear the SceneReplicationState in
// the context of main_context. Otherwise race conditions can

View File

@ -21,7 +21,7 @@ namespace main_context
{
struct OpaqueSceneReference;
typedef OpaqueSceneReference* SceneReference;
};
}
namespace voxelworld
{
@ -129,7 +129,8 @@ namespace voxelworld
std::function<void(voxelworld::Instance*instance)> cb)
{
return access(server, [&](voxelworld::Interface *i){
voxelworld::Instance *instance = check(i->get_instance(scene_ref));
voxelworld::Instance *instance =
check(i->get_instance(scene_ref));
cb(instance);
});
}

View File

@ -11,7 +11,7 @@ namespace main_context
{
struct OpaqueSceneReference;
typedef OpaqueSceneReference* SceneReference;
};
}
namespace worldgen
{
@ -62,11 +62,12 @@ namespace worldgen
std::function<void(worldgen::Instance*instance)> cb)
{
return access(server, [&](worldgen::Interface *i){
worldgen::Instance *instance = check(i->get_instance(scene_ref));
worldgen::Instance *instance =
check(i->get_instance(scene_ref));
cb(instance);
});
}
}
// vim: set noet ts=4 sw=4:
// vim: set noet ts=4 sw=4:

View File

@ -228,18 +228,15 @@ PathDefinition server_paths[] = {
{PD_READ, "share_path",
"",
"/builtin/network/network.cpp",
"Static files"
},
"Static files"},
{PD_READ, "interface_path",
"/src/interface",
"/event.h",
"Interface files"
},
"Interface files"},
{PD_WRITE, "rccpp_build_path",
"/cache/rccpp_build",
"/write.test",
"RCC++ build directory"
},
"RCC++ build directory"},
{PD_END, "", "", "", ""},
};
@ -257,8 +254,7 @@ PathDefinition compiler_bin_paths[] = {
{PD_RUN, "compiler_command",
"c++",
" --version",
"Compiler command"
},
"Compiler command"},
{PD_END, "", "", "", ""},
};
@ -266,7 +262,8 @@ static bool detect_compiler_bin_paths(core::Config &config)
{
sv_<ss_> roots;
generate_compiler_binary_dir_alternatives(roots);
return detect_paths(config, roots, compiler_bin_paths, "Compiler binary directory");
return detect_paths(config, roots, compiler_bin_paths,
"Compiler binary directory");
}
// Client-only paths
@ -275,13 +272,11 @@ PathDefinition client_paths[] = {
{PD_READ, "share_path",
"",
"/client/init.lua",
"Static files"
},
"Static files"},
{PD_WRITE, "cache_path",
"/cache",
"/write.test",
"Cache directory"
},
"Cache directory"},
{PD_END, "", "", "", ""},
};
@ -298,8 +293,7 @@ PathDefinition server_urho3d_paths[] = {
{PD_READ, "urho3d_path",
"",
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
"Urho3D path"
},
"Urho3D path"},
{PD_END, "", "", "", ""},
};
@ -316,8 +310,7 @@ PathDefinition client_urho3d_paths[] = {
{PD_READ, "urho3d_path",
"",
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
"Urho3D path"
},
"Urho3D path"},
{PD_END, "", "", "", ""},
};
@ -378,5 +371,6 @@ bool detect_client_paths(core::Config &config)
return ok;
}
}}
}
}
// vim: set noet ts=4 sw=4:

View File

@ -25,7 +25,8 @@ namespace boot
// Force '.' as decimal point
try {
std::locale::global(std::locale(std::locale(""), "C", std::locale::numeric));
std::locale::global(std::locale(std::locale(""), "C",
std::locale::numeric));
} catch(std::runtime_error &e){
// Can happen on Wine
fprintf(stderr, "Failed to set numeric C++ locale\n");

View File

@ -353,7 +353,8 @@ struct CApp: public App, public magic::Application
lua_bindings::replicate::set_scene(L, m_scene);
// Run initial client Lua scripts
ss_ init_lua_path = g_client_config.get<ss_>("share_path")+"/client/init.lua";
ss_ init_lua_path = g_client_config.get<ss_>("share_path")+
"/client/init.lua";
int error = luaL_dofile(L, init_lua_path.c_str());
if(error){
log_w(MODULE, "luaL_dofile: An error occurred: %s\n",

View File

@ -329,7 +329,8 @@ void CState::setup_packet_handlers()
return;
}
ss_ file_hash_hex = interface::sha1::hex(file_hash);
ss_ path = g_client_config.get<ss_>("cache_path")+"/remote/"+file_hash_hex;
ss_ path = g_client_config.get<ss_>("cache_path")+"/remote/"+
file_hash_hex;
log_i(MODULE, "Saving %s to %s", cs(file_name), cs(path));
std::ofstream of(path, std::ios::binary);
of<<file_content;

View File

@ -116,5 +116,6 @@ bool path_exists(const ss_ &path)
return c55fs::PathExists(path);
}
}}
}
}
// vim: set noet ts=4 sw=4:

View File

@ -848,6 +848,7 @@ void generate_voxel_physics_boxes(
uint8_t v = (def && def->physically_solid);
volume.setVoxelAt(x, y, z, v);
}

View File

@ -26,6 +26,6 @@ namespace interface
bool check_file_extension(const char *path, const char *ext);
ss_ strip_file_extension(const ss_ &path);
ss_ strip_file_name(const ss_ &path);
};
}
}
// vim: set noet ts=4 sw=4:

View File

@ -459,7 +459,8 @@ struct CState: public State, public interface::Server
up_<interface::Thread> m_file_watch_thread;
CState():
m_compiler(rccpp::createCompiler(g_server_config.get<ss_>("compiler_command"))),
m_compiler(rccpp::createCompiler(
g_server_config.get<ss_>("compiler_command"))),
m_thread_pool(interface::thread_pool::createThreadPool())
{
m_thread_pool->start(4); // TODO: Configurable
@ -476,7 +477,8 @@ struct CState: public State, public interface::Server
m_compiler->include_directories.push_back(
g_server_config.get<ss_>("interface_path")+"/..");
m_compiler->include_directories.push_back(
g_server_config.get<ss_>("interface_path")+"/../../3rdparty/cereal/include");
g_server_config.get<ss_>(
"interface_path")+"/../../3rdparty/cereal/include");
m_compiler->include_directories.push_back(
g_server_config.get<ss_>("interface_path")+
"/../../3rdparty/polyvox/library/PolyVoxCore/include");
@ -874,7 +876,8 @@ struct CState: public State, public interface::Server
mc.get())
new_sublist.push_back(mc1);
else
log_v(MODULE, "Removing %s subscription to event %zu",
log_v(MODULE,
"Removing %s subscription to event %zu",
cs(module_name), type);
}
sublist = new_sublist;
@ -899,7 +902,8 @@ struct CState: public State, public interface::Server
" reference; unloading shared executable is probably unsafe",
cs(module_name));
// Drop reference to container
log_t(MODULE, "unload_module_u[%s]: Dropping container", cs(module_name));
log_t(MODULE, "unload_module_u[%s]: Dropping container",
cs(module_name));
mc.reset();
// Unload shared executable
log_t(MODULE, "unload_module_u[%s]: Unloading shared executable",