summaryrefslogtreecommitdiff
path: root/src/client/game.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-12-23 22:03:49 +0100
committersfan5 <sfan5@live.de>2020-12-24 13:44:54 +0100
commit74762470b2aa11a5271b846549ff14b86c1705d2 (patch)
treecf4fd29ba05a94395674ac6cd5b2eeb7bdac0ee1 /src/client/game.cpp
parent289425f6bd6cfe1f66218918d9d5bd1b9f89aa7c (diff)
downloadminetest-74762470b2aa11a5271b846549ff14b86c1705d2.tar.gz
minetest-74762470b2aa11a5271b846549ff14b86c1705d2.tar.bz2
minetest-74762470b2aa11a5271b846549ff14b86c1705d2.zip
Fix some minor code issues all over the place
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r--src/client/game.cpp36
1 files changed, 5 insertions, 31 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 6151d2aa6..9e942f47a 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -186,7 +186,7 @@ struct LocalFormspecHandler : public TextDest
return;
}
- if (m_client && m_client->modsLoaded())
+ if (m_client->modsLoaded())
m_client->getScript()->on_formspec_input(m_formname, fields);
}
@@ -583,7 +583,7 @@ public:
virtual IShaderConstantSetter* create()
{
- GameGlobalShaderConstantSetter *scs = new GameGlobalShaderConstantSetter(
+ auto *scs = new GameGlobalShaderConstantSetter(
m_sky, m_force_fog_off, m_fog_range, m_client);
if (!m_sky)
created_nosky.push_back(scs);
@@ -1338,7 +1338,7 @@ bool Game::createClient(const GameStartData &start_data)
return false;
}
- GameGlobalShaderConstantSetterFactory *scsf = new GameGlobalShaderConstantSetterFactory(
+ auto *scsf = new GameGlobalShaderConstantSetterFactory(
&m_flags.force_fog_off, &runData.fog_range, client);
shader_src->addShaderConstantSetterFactory(scsf);
@@ -1348,20 +1348,14 @@ bool Game::createClient(const GameStartData &start_data)
/* Camera
*/
camera = new Camera(*draw_control, client);
- if (!camera || !camera->successfullyCreated(*error_message))
+ if (!camera->successfullyCreated(*error_message))
return false;
client->setCamera(camera);
/* Clouds
*/
- if (m_cache_enable_clouds) {
+ if (m_cache_enable_clouds)
clouds = new Clouds(smgr, -1, time(0));
- if (!clouds) {
- *error_message = "Memory allocation error (clouds)";
- errorstream << *error_message << std::endl;
- return false;
- }
- }
/* Skybox
*/
@@ -1369,12 +1363,6 @@ bool Game::createClient(const GameStartData &start_data)
scsf->setSky(sky);
skybox = NULL; // This is used/set later on in the main run loop
- if (!sky) {
- *error_message = "Memory allocation error sky";
- errorstream << *error_message << std::endl;
- return false;
- }
-
/* Pre-calculated values
*/
video::ITexture *t = texture_src->getTexture("crack_anylength.png");
@@ -1404,12 +1392,6 @@ bool Game::createClient(const GameStartData &start_data)
hud = new Hud(guienv, client, player, &player->inventory);
- if (!hud) {
- *error_message = "Memory error: could not create HUD";
- errorstream << *error_message << std::endl;
- return false;
- }
-
mapper = client->getMinimap();
if (mapper && client->modsLoaded())
@@ -1431,11 +1413,6 @@ bool Game::initGui()
// Chat backend and console
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
-1, chat_backend, client, &g_menumgr);
- if (!gui_chat_console) {
- *error_message = "Could not allocate memory for chat console";
- errorstream << *error_message << std::endl;
- return false;
- }
#ifdef HAVE_TOUCHSCREENGUI
@@ -1492,9 +1469,6 @@ bool Game::connectToServer(const GameStartData &start_data,
itemdef_manager, nodedef_manager, sound, eventmgr,
connect_address.isIPv6(), m_game_ui.get());
- if (!client)
- return false;
-
client->m_simple_singleplayer_mode = simple_singleplayer_mode;
infostream << "Connecting to server at ";