Skip to content

Commit 0e78aa2

Browse files
committedDec 5, 2014
Add name of node 'pointed at' to debug
This is "Add name of node pointed at to debug #1677" by @rubenwardy updated to work with game.cpp after it was refactored.
1 parent 5da6896 commit 0e78aa2

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed
 

‎src/game.cpp

+20-5
Original file line numberDiff line numberDiff line change
@@ -1502,8 +1502,9 @@ class Game
15021502
void updateFrame(std::vector<aabb3f> &highlight_boxes, ProfilerGraph *graph,
15031503
RunStats *stats, GameRunData *runData,
15041504
f32 dtime, const VolatileRunFlags &flags, const CameraOrientation &cam);
1505-
void updateGui(float *statustext_time, const RunStats &stats, f32 dtime,
1506-
const VolatileRunFlags &flags, const CameraOrientation &cam);
1505+
void updateGui(float *statustext_time, const RunStats &stats,
1506+
const GameRunData& runData, f32 dtime, const VolatileRunFlags &flags,
1507+
const CameraOrientation &cam);
15071508
void updateProfilerGraphs(ProfilerGraph *graph);
15081509

15091510
// Misc
@@ -3836,7 +3837,7 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
38363837
runData->update_draw_list_last_cam_dir = camera_direction;
38373838
}
38383839

3839-
updateGui(&runData->statustext_time, *stats, dtime, flags, cam);
3840+
updateGui(&runData->statustext_time, *stats, *runData, dtime, flags, cam);
38403841

38413842
/*
38423843
make sure menu is on top
@@ -3913,8 +3914,9 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
39133914
}
39143915

39153916

3916-
void Game::updateGui(float *statustext_time, const RunStats& stats,
3917-
f32 dtime, const VolatileRunFlags &flags, const CameraOrientation &cam)
3917+
void Game::updateGui(float *statustext_time, const RunStats &stats,
3918+
const GameRunData& runData, f32 dtime, const VolatileRunFlags &flags,
3919+
const CameraOrientation &cam)
39183920
{
39193921
v2u32 screensize = driver->getScreenSize();
39203922
LocalPlayer *player = client->getEnv().getLocalPlayer();
@@ -3969,6 +3971,19 @@ void Game::updateGui(float *statustext_time, const RunStats& stats,
39693971
<< ") (yaw=" << (wrapDegrees_0_360(cam.camera_yaw))
39703972
<< ") (seed = " << ((u64)client->getMapSeed())
39713973
<< ")";
3974+
3975+
if (runData.pointed_old.type == POINTEDTHING_NODE) {
3976+
ClientMap &map = client->getEnv().getClientMap();
3977+
const INodeDefManager *nodedef = client->getNodeDefManager();
3978+
MapNode n = map.getNodeNoEx(runData.pointed_old.node_undersurface);
3979+
if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") {
3980+
const ContentFeatures &features = nodedef->get(n);
3981+
os << " (pointing_at = " << nodedef->get(n).name
3982+
<< " - " << features.tiledef[0].name.c_str()
3983+
<< ")";
3984+
}
3985+
}
3986+
39723987
guitext2->setText(narrow_to_wide(os.str()).c_str());
39733988
guitext2->setVisible(true);
39743989

0 commit comments

Comments
 (0)
Please sign in to comment.