Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -13,8 +13,6 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "PhysicsServerExampleBullet2.h"
|
||||
|
||||
#include "Bullet3Common/b3CommandLineArgs.h"
|
||||
@@ -23,12 +21,11 @@ subject to the following restrictions:
|
||||
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
||||
#include "SharedMemoryCommon.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int gSharedMemoryKey = -1;
|
||||
|
||||
static SharedMemoryCommon* example = NULL;
|
||||
static SharedMemoryCommon* example = NULL;
|
||||
static bool interrupted = false;
|
||||
|
||||
#ifndef _WIN32
|
||||
@@ -37,57 +34,57 @@ static bool interrupted = false;
|
||||
#include <unistd.h>
|
||||
static void cleanup(int signo)
|
||||
{
|
||||
if (interrupted) { // this is the second time, we're hanging somewhere
|
||||
// if (example) {
|
||||
// example->abort();
|
||||
// }
|
||||
b3Printf("Aborting and deleting SharedMemoryCommon object");
|
||||
sleep(1);
|
||||
delete example;
|
||||
errx(EXIT_FAILURE, "aborted example on signal %d", signo);
|
||||
}
|
||||
interrupted = true;
|
||||
warnx("caught signal %d", signo);
|
||||
if (interrupted)
|
||||
{ // this is the second time, we're hanging somewhere
|
||||
// if (example) {
|
||||
// example->abort();
|
||||
// }
|
||||
b3Printf("Aborting and deleting SharedMemoryCommon object");
|
||||
sleep(1);
|
||||
delete example;
|
||||
errx(EXIT_FAILURE, "aborted example on signal %d", signo);
|
||||
}
|
||||
interrupted = true;
|
||||
warnx("caught signal %d", signo);
|
||||
}
|
||||
#endif//_WIN32
|
||||
|
||||
#endif //_WIN32
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifndef _WIN32
|
||||
struct sigaction action;
|
||||
memset(&action, 0x0, sizeof(action));
|
||||
action.sa_handler = cleanup;
|
||||
static const int signos[] = { SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGSEGV, SIGPIPE, SIGTERM };
|
||||
for (int ii(0); ii < sizeof(signos) / sizeof(*signos); ++ii) {
|
||||
if (0 != sigaction(signos[ii], &action, NULL)) {
|
||||
err(EXIT_FAILURE, "signal %d", signos[ii]);
|
||||
}
|
||||
}
|
||||
struct sigaction action;
|
||||
memset(&action, 0x0, sizeof(action));
|
||||
action.sa_handler = cleanup;
|
||||
static const int signos[] = {SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGSEGV, SIGPIPE, SIGTERM};
|
||||
for (int ii(0); ii < sizeof(signos) / sizeof(*signos); ++ii)
|
||||
{
|
||||
if (0 != sigaction(signos[ii], &action, NULL))
|
||||
{
|
||||
err(EXIT_FAILURE, "signal %d", signos[ii]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
b3CommandLineArgs args(argc, argv);
|
||||
|
||||
|
||||
DummyGUIHelper noGfx;
|
||||
|
||||
CommonExampleOptions options(&noGfx);
|
||||
|
||||
args.GetCmdLineArgument("shared_memory_key", gSharedMemoryKey);
|
||||
args.GetCmdLineArgument("sharedMemoryKey", gSharedMemoryKey);
|
||||
|
||||
// options.m_option |= PHYSICS_SERVER_ENABLE_COMMAND_LOGGING;
|
||||
// options.m_option |= PHYSICS_SERVER_REPLAY_FROM_COMMAND_LOG;
|
||||
|
||||
|
||||
// options.m_option |= PHYSICS_SERVER_ENABLE_COMMAND_LOGGING;
|
||||
// options.m_option |= PHYSICS_SERVER_REPLAY_FROM_COMMAND_LOG;
|
||||
|
||||
example = (SharedMemoryCommon*)PhysicsServerCreateFuncBullet2(options);
|
||||
|
||||
|
||||
|
||||
example->initPhysics();
|
||||
|
||||
|
||||
while (example->isConnected() && !(example->wantsTermination() || interrupted))
|
||||
{
|
||||
example->stepSimulation(1.f/60.f);
|
||||
}
|
||||
example->stepSimulation(1.f / 60.f);
|
||||
}
|
||||
|
||||
example->exitPhysics();
|
||||
|
||||
@@ -95,4 +92,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user