mirror of https://github.com/minetest/minetest.git
Replace hasElementOfType with protocol version
This commit is contained in:
parent
e8f92ba825
commit
f24116ed01
|
@ -369,20 +369,13 @@ void Hud::drawLuaElements(const v3s16 &camera_offset, bool draw_crosshairs)
|
||||||
elems.insert(it, e);
|
elems.insert(it, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy (Remove this when version 5.8.0 and older is not supported anymore.)
|
// Add builtin cosshair if the server doesn't send it.
|
||||||
// If a new client connects to a sever version 5.8.0 and older some HUD elements
|
if (client->getProtoVersion() < 44 && (player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE)) {
|
||||||
// are not hard coded in the client code anymore, but handled in builtin.
|
|
||||||
// So the client must add them again.
|
|
||||||
|
|
||||||
// Crosshair
|
|
||||||
if ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) && !hasElementOfType(HUD_ELEM_CROSSHAIR)) {
|
|
||||||
HudElement crosshair{HUD_ELEM_CROSSHAIR, v2f(0.5, 0.5), "", v2f(1, 1), "", 0 , 0, 0, v2f(),
|
HudElement crosshair{HUD_ELEM_CROSSHAIR, v2f(0.5, 0.5), "", v2f(1, 1), "", 0 , 0, 0, v2f(),
|
||||||
v2f(), v3f(), v2s32(), 0, "", 0};
|
v2f(), v3f(), v2s32(), 0, "", 0};
|
||||||
elems.push_back(&crosshair);
|
elems.push_back(&crosshair);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of legacy support code.
|
|
||||||
|
|
||||||
for (HudElement *e : elems) {
|
for (HudElement *e : elems) {
|
||||||
|
|
||||||
v2s32 pos(floor(e->pos.X * (float) m_screensize.X + 0.5),
|
v2s32 pos(floor(e->pos.X * (float) m_screensize.X + 0.5),
|
||||||
|
|
|
@ -222,7 +222,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
PROTOCOL VERSION 44:
|
PROTOCOL VERSION 44:
|
||||||
AO_CMD_SET_BONE_POSITION extended
|
AO_CMD_SET_BONE_POSITION extended
|
||||||
Add TOCLIENT_MOVE_PLAYER_REL
|
Add TOCLIENT_MOVE_PLAYER_REL
|
||||||
Move default minimap from client-side C++ to server-side builtin Lua
|
Move default minimap and crosshair from client-side C++ to server-side builtin Lua
|
||||||
[scheduled bump for 5.9.0]
|
[scheduled bump for 5.9.0]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue