Report collisionMoveSimple for client and server. (#13105)

This commit is contained in:
lhofhansl 2023-01-07 16:31:31 -08:00 committed by GitHub
parent d82d18bfb1
commit 55804c56e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -229,10 +229,12 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
v3f accel_f, ActiveObject *self, v3f accel_f, ActiveObject *self,
bool collideWithObjects) bool collideWithObjects)
{ {
#define PROFILER_NAME(text) (s_env ? ("Server: " text) : ("Client: " text))
static bool time_notification_done = false; static bool time_notification_done = false;
Map *map = &env->getMap(); Map *map = &env->getMap();
ServerEnvironment *s_env = dynamic_cast<ServerEnvironment*>(env);
ScopeProfiler sp(g_profiler, "collisionMoveSimple()", SPT_AVG); ScopeProfiler sp(g_profiler, PROFILER_NAME("collisionMoveSimple()"), SPT_AVG);
collisionMoveResult result; collisionMoveResult result;
@ -271,7 +273,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
std::vector<NearbyCollisionInfo> cinfo; std::vector<NearbyCollisionInfo> cinfo;
{ {
//TimeTaker tt2("collisionMoveSimple collect boxes"); //TimeTaker tt2("collisionMoveSimple collect boxes");
ScopeProfiler sp2(g_profiler, "collisionMoveSimple(): collect boxes", SPT_AVG); ScopeProfiler sp2(g_profiler, PROFILER_NAME("collisionMoveSimple(): collect boxes"), SPT_AVG);
v3f minpos_f( v3f minpos_f(
MYMIN(pos_f->X, newpos_f.X), MYMIN(pos_f->X, newpos_f.X),
@ -390,7 +392,6 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
else else
#endif #endif
{ {
ServerEnvironment *s_env = dynamic_cast<ServerEnvironment*>(env);
if (s_env != NULL) { if (s_env != NULL) {
// Calculate distance by speed, add own extent and 1.5m of tolerance // Calculate distance by speed, add own extent and 1.5m of tolerance
f32 distance = speed_f->getLength() * dtime + f32 distance = speed_f->getLength() * dtime +