diff --git a/.gitignore b/.gitignore index 1fc29fca..bd5dbebf 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,6 @@ gtags.files ## Configuration/log files minetest.conf debug.txt -Thumbs.db ## Doxygen files doc/Doxyfile @@ -81,8 +80,6 @@ build/android/Debug build/android/deps build/android/gen build/android/jni/src -## Need for WVersionManager -##build/android/libs build/android/obj build/android/path.cfg build/android/and_env diff --git a/build/android/Makefile b/build/android/Makefile index 27c71336..17419480 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -611,7 +611,6 @@ curl_binary: tar -xzf curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz || exit 1;\ mv curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android curl-${CURL_VERSION_BINARY};\ rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \ - \ fi $(GMP_TIMESTAMP) : gmp_download diff --git a/src/cavegen.cpp b/src/cavegen.cpp index 2f8b925b..6006ad5f 100644 --- a/src/cavegen.cpp +++ b/src/cavegen.cpp @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapgen_v5.h" #include "mapgen_v6.h" #include "mapgen_v7.h" -#include "mapgen_fractal.h" #include "cavegen.h" NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0); diff --git a/src/cavegen.h b/src/cavegen.h index e96791b7..5766d838 100644 --- a/src/cavegen.h +++ b/src/cavegen.h @@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., class MapgenV5; class MapgenV6; class MapgenV7; -class MapgenFractal; class CaveV5 { public: diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 57339c23..c071cb06 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -34,10 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "fontengine.h" #include "clientlauncher.h" -#ifdef ANDROID - #include "porting_android.h" -#endif - /* mainmenumanager.h */ gui::IGUIEnvironment *guienv = NULL; @@ -71,11 +67,8 @@ u32 getTime(TimePrecision prec) { ClientLauncher::~ClientLauncher() { - if (receiver) { - if (device) - device->setEventReceiver(NULL); + if (receiver) delete receiver; - } if (input) delete input; @@ -83,10 +76,8 @@ ClientLauncher::~ClientLauncher() if (g_fontengine) delete g_fontengine; - if (device) { - device->closeDevice(); + if (device) device->drop(); - } } @@ -196,10 +187,6 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args) device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) + L" [" + text + L"]").c_str()); delete[] text; -#ifdef ANDROID - porting::handleAndroidActivityEvents(); -#endif - try { // This is used for catching disconnects guienv->clear(); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index ec7b65c8..40b25301 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -337,7 +337,7 @@ void set_default_settings(Settings *settings) settings->setDefault("enable_particles", "false"); settings->setDefault("video_driver", "ogles1"); settings->setDefault("touchtarget", "true"); - settings->setDefault("TMPFolder","/sdcard/Android/data/net.MultiCraft.Official/tmp/"); + settings->setDefault("TMPFolder","/sdcard/tmp/"); settings->setDefault("touchscreen_threshold","20"); settings->setDefault("smooth_lighting", "false"); settings->setDefault("emergequeue_limit_diskonly", "8"); @@ -348,7 +348,7 @@ void set_default_settings(Settings *settings) settings->setDefault("viewing_range_nodes_min", "5"); settings->setDefault("enable_node_highlighting", "true"); settings->setDefault("inventory_image_hack", "true"); - settings->setDefault("minimap_double_scan_height", "false"); + //settings->setDefault("minimap_double_scan_height", "false"); settings->setDefault("mouse_sensitivity", "0.05"); settings->setDefault("enable_3d_clouds", "false"); settings->setDefault("wanted_fps", "20"); @@ -363,6 +363,7 @@ void set_default_settings(Settings *settings) else if (x_inches < 4.5) { settings->setDefault("hud_scaling", "0.7"); } + settings->setDefault("gui_scaling", "1.1"); settings->setDefault("curl_verify_cert","false"); #else settings->setDefault("screen_dpi", "72"); diff --git a/src/game.cpp b/src/game.cpp index 9be38ebf..016447ef 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -68,10 +68,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "touchscreengui.h" #endif -#ifdef ANDROID - #include "porting_android.h" -#endif - extern Settings *g_settings; extern Profiler *g_profiler; @@ -282,11 +278,11 @@ public: Check if a node is pointable */ inline bool isPointableNode(const MapNode &n, - Client *client, bool liquids_pointable) + Client *client, bool liquids_pointable) { const ContentFeatures &features = client->getNodeDefManager()->get(n); return features.pointable || - (liquids_pointable && features.isLiquid()); + (liquids_pointable && features.isLiquid()); } /* @@ -321,8 +317,8 @@ PointedThing getPointedThing(Client *client, v3f player_position, v3f pos = selected_object->getPosition(); hilightboxes.push_back(aabb3f( - selection_box->MinEdge + pos - intToFloat(camera_offset, BS), - selection_box->MaxEdge + pos - intToFloat(camera_offset, BS))); + selection_box->MinEdge + pos - intToFloat(camera_offset, BS), + selection_box->MaxEdge + pos - intToFloat(camera_offset, BS))); } mindistance = (selected_object->getPosition() - camera_position).getLength(); @@ -905,8 +901,8 @@ bool nodePlacementPrediction(Client &client, if (prediction != "" && !nodedef->get(node).rightclickable) { verbosestream << "Node placement prediction for " - << playeritem_def.name << " is " - << prediction << std::endl; + << playeritem_def.name << " is " + << prediction << std::endl; v3s16 p = neighbourpos; // Place inside node itself if buildable_to @@ -928,9 +924,9 @@ bool nodePlacementPrediction(Client &client, if (!found) { errorstream << "Node placement prediction failed for " - << playeritem_def.name << " (places " - << prediction - << ") - Name not known" << std::endl; + << playeritem_def.name << " (places " + << prediction + << ") - Name not known" << std::endl; return false; } @@ -1003,9 +999,9 @@ bool nodePlacementPrediction(Client &client, } } catch (InvalidPositionException &e) { errorstream << "Node placement prediction failed for " - << playeritem_def.name << " (places " - << prediction - << ") - Position not loaded" << std::endl; + << playeritem_def.name << " (places " + << prediction + << ") - Position not loaded" << std::endl; } } @@ -1020,7 +1016,7 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec, if (*cur_formspec == 0) { *cur_formspec = new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, - invmgr, gamedef, tsrc, fs_src, txt_dest, client); + invmgr, gamedef, tsrc, fs_src, txt_dest, client); (*cur_formspec)->doPause = false; /* @@ -1204,13 +1200,14 @@ static void updateChat(Client &client, f32 dtime, bool show_debug, // first pass to calculate height of text to be set s32 width = std::min(g_fontengine->getTextWidth(recent_chat) + 10, - porting::getWindowSize().X - 20); + porting::getWindowSize().X - 20); core::rect rect(10, chat_y, width, chat_y + porting::getWindowSize().Y); guitext_chat->setRelativePosition(rect); //now use real height of text and adjust rect according to this size rect = core::rect(10, chat_y, width, - chat_y + guitext_chat->getTextHeight()); + chat_y + guitext_chat->getTextHeight()); + guitext_chat->setRelativePosition(rect); @@ -1591,7 +1588,7 @@ private: GUIChatConsole *gui_chat_console; // Free using ->Drop() MapDrawControl *draw_control; Camera *camera; - Clouds *clouds; // Free using ->Drop() + Clouds *clouds; // Free using ->Drop() Sky *sky; // Free using ->Drop() Inventory *local_inventory; Hud *hud; @@ -1624,7 +1621,7 @@ private: gui::IGUIStaticText *guitext2; // Second line of debug text gui::IGUIStaticText *guitext_info; // At the middle of the screen gui::IGUIStaticText *guitext_status; - gui::IGUIStaticText *guitext_chat; // Chat text + gui::IGUIStaticText *guitext_chat; // Chat text gui::IGUIStaticText *guitext_profiler; // Profiler text std::wstring infotext; @@ -1829,10 +1826,6 @@ void Game::run() while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) { -#ifdef ANDROID - porting::handleAndroidActivityEvents(); -#endif - /* Must be called immediately after a device->run() call because it * uses device->getTimer()->getTime() */ @@ -2018,7 +2011,7 @@ bool Game::createSingleplayerServer(const std::string map_dir, } server = new Server(map_dir, gamespec, simple_singleplayer_mode, - bind_addr.isIPv6()); + bind_addr.isIPv6()); server->start(bind_addr); @@ -2081,7 +2074,7 @@ bool Game::createClient(const std::string &playername, /* Skybox */ sky = new Sky(smgr->getRootSceneNode(), smgr, -1, texture_src); - skybox = NULL; // This is used/set later on in the main run loop + skybox = NULL; // This is used/set later on in the main run loop local_inventory = new Inventory(itemdef_manager); @@ -2199,7 +2192,7 @@ bool Game::connectToServer(const std::string &playername, const std::string &password, std::string *address, u16 port, bool *connect_ok, bool *aborted) { - *connect_ok = false; // Let's not be overly optimistic + *connect_ok = false; // Let's not be overly optimistic *aborted = false; bool local_server_mode = false; @@ -2244,7 +2237,7 @@ bool Game::connectToServer(const std::string &playername, if (!client) return false; - gamedef = client; // Client acts as our GameDef + gamedef = client; // Client acts as our GameDef infostream << "Connecting to server at "; connect_address.print(&infostream); @@ -2419,6 +2412,7 @@ inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime) runData->time_from_last_punch += dtime; } + /* returns false if game should exit, otherwise true */ inline bool Game::checkConnection() @@ -2452,13 +2446,13 @@ inline bool Game::handleCallbacks() if (g_gamecallback->changevolume_requested) { (new GUIVolumeChange(guienv, guiroot, -1, - &g_menumgr, client))->drop(); + &g_menumgr, client))->drop(); g_gamecallback->changevolume_requested = false; } if (g_gamecallback->keyconfig_requested) { (new GUIKeyChangeMenu(guienv, guiroot, -1, - &g_menumgr))->drop(); + &g_menumgr))->drop(); g_gamecallback->keyconfig_requested = false; } @@ -2637,7 +2631,6 @@ void Game::processKeyboardInput(VolatileRunFlags *flags, if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) { dropSelectedItem(); - // Add WoW-style autorun by toggling continuous forward. } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) { toggleAutorun(statustext_time); } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) { @@ -2701,7 +2694,7 @@ void Game::processKeyboardInput(VolatileRunFlags *flags, << std::endl; dstream << "Printing debug stacks:" << std::endl; dstream << "-----------------------------------------" - << std::endl; + << std::endl; debug_stacks_print(); } @@ -2730,7 +2723,7 @@ void Game::processItemSelection(u16 *new_playeritem) s32 wheel = input->getMouseWheel(); u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1, - player->hud_hotbar_itemcount - 1); + player->hud_hotbar_itemcount - 1); if (wheel < 0) *new_playeritem = *new_playeritem < max_item ? *new_playeritem + 1 : 0; @@ -3008,7 +3001,7 @@ void Game::toggleProfiler(float *statustext_time, u32 *profiler_current_page, if (*profiler_current_page != 0) { std::wstringstream sstr; sstr << "Profiler shown (page " << *profiler_current_page - << " of " << profiler_max_page << ")"; + << " of " << profiler_max_page << ")"; statustext = sstr.str(); } else { statustext = L"Profiler hidden"; @@ -3175,7 +3168,7 @@ inline void Game::step(f32 *dtime) bool can_be_and_is_paused = (simple_singleplayer_mode && g_menumgr.pausesGame()); - if (can_be_and_is_paused) { // This is for a singleplayer server + if (can_be_and_is_paused) { // This is for a singleplayer server *dtime = 0; // No time passes } else { if (server != NULL) { @@ -3218,7 +3211,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) show_deathscreen(¤t_formspec, client, gamedef, texture_src, device, client); - // chat_backend->addMessage(L"", L"You died."); + chat_backend->addMessage(L"", L"You died."); /* Handle visualization */ *damage_flash = 0; @@ -3232,7 +3225,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) new TextDestPlayerInventory(client, *(event.show_formspec.formname)); create_formspec_menu(¤t_formspec, client, gamedef, - texture_src, device, fs_src, txt_dst, client); + texture_src, device, fs_src, txt_dst, client); delete(event.show_formspec.formspec); delete(event.show_formspec.formname); @@ -3437,7 +3430,7 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time, tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0); camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio, - client->getEnv()); + client->getEnv()); camera->step(dtime); v3f camera_position = camera->getPosition(); @@ -3467,13 +3460,13 @@ void Game::updateSound(f32 dtime) // Update sound listener v3s16 camera_offset = camera->getOffset(); sound->updateListener(camera->getCameraNode()->getPosition() + intToFloat(camera_offset, BS), - v3f(0, 0, 0), // velocity - camera->getDirection(), - camera->getCameraNode()->getUpVector()); + v3f(0, 0, 0), // velocity + camera->getDirection(), + camera->getCameraNode()->getUpVector()); sound->setListenerGain(g_settings->getFloat("sound_volume")); - // Update sound maker + // Update sound maker soundmaker->step(dtime); LocalPlayer *player = client->getEnv().getLocalPlayer(); @@ -3526,7 +3519,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, camera_position + camera_direction * BS * (d + 1)); } else { - // prevent player pointing anything in front-view + // prevent player pointing anything in front-view if (camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT) shootline = core::line3d(0, 0, 0, 0, 0, 0); } @@ -3572,7 +3565,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, if (runData->digging) { if (input->getLeftReleased()) { infostream << "Left button released" - << " (stopped digging)" << std::endl; + << " (stopped digging)" << std::endl; runData->digging = false; } else if (pointed != runData->pointed_old) { if (pointed.type == POINTEDTHING_NODE @@ -3583,7 +3576,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, // Don't reset. } else { infostream << "Pointing away from node" - << " (stopped digging)" << std::endl; + << " (stopped digging)" << std::endl; runData->digging = false; } } @@ -3710,7 +3703,7 @@ void Game::handlePointingAtNode(GameRunData *runData, TextDest *txt_dst = new TextDestNodeMetadata(nodepos, client); create_formspec_menu(¤t_formspec, client, gamedef, - texture_src, device, fs_src, txt_dst, client); + texture_src, device, fs_src, txt_dst, client); current_formspec->setFormSpec(meta->getString("formspec"), inventoryloc); } else { @@ -3959,7 +3952,7 @@ void Game::updateFrame(std::vector &highlight_boxes, direct_brightness = client->getEnv().getClientMap() .getBackgroundBrightness(MYMIN(runData->fog_range * 1.2, 60 * BS), daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen) - / 255.0; + / 255.0; } float time_of_day = runData->time_of_day; @@ -3998,7 +3991,7 @@ void Game::updateFrame(std::vector &highlight_boxes, clouds->setVisible(true); clouds->step(dtime); clouds->update(v2f(player_position.X, player_position.Z), - sky->getCloudColor()); + sky->getCloudColor()); } else { clouds->setVisible(false); } @@ -4210,7 +4203,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, std::ostringstream os(std::ios_base::binary); os << std::fixed - << "MultiCraft " << g_version_hash + << PROJECT_NAME_C " " << g_version_hash << " FPS = " << fps << " (R: range_all=" << draw_control->range_all << ")" << std::setprecision(0) @@ -4226,13 +4219,21 @@ void Game::updateGui(float *statustext_time, const RunStats &stats, guitext->setVisible(true); } else if (flags.show_hud || flags.show_chat) { #ifdef ANDROID - guitext->setVisible(false); + u16 fps = 1.0 / stats.dtime_jitter.avg; + std::ostringstream os(std::ios_base::binary); + os << std::setprecision(1) << std::fixed + << "FPS = " << fps + << " (" << (player_position.X / BS) + << ", " << (player_position.Y / BS) + << ", " << (player_position.Z / BS) + << ")"; + guitext->setText(utf8_to_wide(os.str()).c_str()); + guitext->setVisible(true); #else std::ostringstream os(std::ios_base::binary); os << PROJECT_NAME_C " " << g_version_hash; guitext->setText(utf8_to_wide(os.str()).c_str()); guitext->setVisible(true); -#endif } else { guitext->setVisible(false); } @@ -4420,20 +4421,20 @@ void Game::extendedResourceCleanup() // Extended resource accounting infostream << "Irrlicht resources after cleanup:" << std::endl; infostream << "\tRemaining meshes : " - << device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl; + << device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl; infostream << "\tRemaining textures : " - << driver->getTextureCount() << std::endl; + << driver->getTextureCount() << std::endl; for (unsigned int i = 0; i < driver->getTextureCount(); i++) { irr::video::ITexture *texture = driver->getTextureByIndex(i); infostream << "\t\t" << i << ":" << texture->getName().getPath().c_str() - << std::endl; + << std::endl; } clearTextureNameCache(); infostream << "\tRemaining materials: " - << driver-> getMaterialRendererCount() - << " (note: irrlicht doesn't support removing renderers)" << std::endl; + << driver-> getMaterialRendererCount() + << " (note: irrlicht doesn't support removing renderers)" << std::endl; } @@ -4481,7 +4482,7 @@ void the_game(bool *kill, } catch (SerializationError &e) { error_message = std::string("A serialization error occurred:\n") + e.what() + "\n\nThe server is probably " - " running a different version of MultiCraft."; + " running a different version of " PROJECT_NAME_C "."; errorstream << error_message << std::endl; } catch (ServerError &e) { error_message = e.what(); @@ -4490,4 +4491,4 @@ void the_game(bool *kill, error_message = e.what() + strgettext("\nCheck debug.txt for details."); errorstream << "ModError: " << error_message << std::endl; } -} \ No newline at end of file +} diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index 76a8ecf6..03ae8ebd 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -172,7 +172,6 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev, m_sound_manager = &dummySoundManager; //create topleft header - std::wstring t = narrow_to_wide(std::string("")); //std::wstring t = utf8_to_wide(std::string(PROJECT_NAME_C " ") + //g_version_hash); diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index cf283d5c..6be1b1d9 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -2963,7 +2963,7 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event) else if (event.TouchInput.touchedCount == 2) { dont_send_event = true; } - else if (event.TouchInput.touchedCount > 2) { + else if (event.TouchInput.touchedCount > 4) { errorstream << "GUIFormSpecMenu::preprocessEvent to many multitouch events " << event.TouchInput.touchedCount << " ignoring them" << std::endl; diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h index 9461a18d..a7086ea2 100644 --- a/src/mainmenumanager.h +++ b/src/mainmenumanager.h @@ -137,6 +137,9 @@ public: virtual void exitToOS() { shutdown_requested = true; +#ifndef __ANDROID__ + device->closeDevice(); +#endif } virtual void disconnect() diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h index 92d2d7c7..08cb3902 100644 --- a/src/mapgen_v7.h +++ b/src/mapgen_v7.h @@ -23,8 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapgen.h" -#define BIOMEGEN_BASE_V7 -192 - /////////////////// Mapgen V7 flags #define MGV7_MOUNTAINS 0x01 #define MGV7_RIDGES 0x02 diff --git a/src/minimap.h b/src/minimap.h index ba4417d6..4e59015a 100644 --- a/src/minimap.h +++ b/src/minimap.h @@ -4,11 +4,7 @@ Copyright (C) 2010-2015 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by -<<<<<<< HEAD the Free Software Foundation; either version 3.0 of the License, or -======= -the Free Software Foundation; either version 2.1 of the License, or ->>>>>>> 900db310638531a8b9fb1a587f75a02a15ae0c24 (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index 1e1dde92..d371f62a 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -230,3 +230,4 @@ std::string NodeMetadata::resolveString(const std::string &str, } return str; } + diff --git a/src/nodemetadata.h b/src/nodemetadata.h index 594f235c..80ce1e2e 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -98,3 +98,4 @@ private: }; #endif + diff --git a/src/pathfinder.cpp b/src/pathfinder.cpp index 73931bff..3ce1d1c8 100644 --- a/src/pathfinder.cpp +++ b/src/pathfinder.cpp @@ -339,7 +339,7 @@ std::vector pathfinder::get_Path(ServerEnvironment* env, #ifdef PATHFINDER_DEBUG print_pathlen(); #endif - //ERROR_TARGET << "failed to update cost map"<< std::endl; + ERROR_TARGET << "failed to update cost map"<< std::endl; } diff --git a/src/porting_android.cpp b/src/porting_android.cpp index 347f59a4..4597a8ea 100644 --- a/src/porting_android.cpp +++ b/src/porting_android.cpp @@ -86,17 +86,6 @@ android_app* app_global; JNIEnv* jnienv; jclass nativeActivity; -void handleAndroidActivityEvents() -{ - int ident; - int events; - struct android_poll_source *source; - - while ( (ident = ALooper_pollOnce(0, NULL, &events, (void**)&source)) >= 0) - if (source) - source->process(porting::app_global, source); -} - jclass findClass(std::string classname) { if (jnienv == 0) { @@ -172,48 +161,7 @@ void cleanupAndroid() #endif JavaVM *jvm = app_global->activity->vm; - if (jvm) - jvm->DetachCurrentThread(); - ANativeActivity_finish(app_global->activity); -} - -static std::string javaStringToUTF8(jstring js) -{ - std::string str; - // Get string as a UTF-8 c-string - const char *c_str = jnienv->GetStringUTFChars(js, NULL); - // Save it - str = c_str; - // And free the c-string - jnienv->ReleaseStringUTFChars(js, c_str); - return str; -} - -// Calls static method if obj is NULL -static std::string getAndroidPath(jclass cls, jobject obj, jclass cls_File, - jmethodID mt_getAbsPath, const char *getter) -{ - // Get getter method - jmethodID mt_getter; - if (obj) - mt_getter = jnienv->GetMethodID(cls, getter, - "()Ljava/io/File;"); - else - mt_getter = jnienv->GetStaticMethodID(cls, getter, - "()Ljava/io/File;"); - - // Call getter - jobject ob_file; - if (obj) - ob_file = jnienv->CallObjectMethod(obj, mt_getter); - else - ob_file = jnienv->CallStaticObjectMethod(cls, mt_getter); - - // Call getAbsolutePath - jstring js_path = (jstring) jnienv->CallObjectMethod(ob_file, - mt_getAbsPath); - - return javaStringToUTF8(js_path); + jvm->DetachCurrentThread(); } static std::string javaStringToUTF8(jstring js) diff --git a/src/porting_android.h b/src/porting_android.h index 2da8a0c2..bfc5dbec 100644 --- a/src/porting_android.h +++ b/src/porting_android.h @@ -76,7 +76,6 @@ int getInputDialogState(); */ std::string getInputDialogValue(); -void handleAndroidActivityEvents(); } #endif diff --git a/src/server.cpp b/src/server.cpp index 1bc04265..38b02895 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1246,11 +1246,6 @@ void Server::setTimeOfDay(u32 time) m_time_of_day_send_timer = 0; } -u32 Server::getTimeOfDay() -{ - return m_env->getTimeOfDay(); -} - void Server::onMapEditEvent(MapEditEvent *event) { if(m_ignore_map_edit_events) diff --git a/src/server.h b/src/server.h index 427c689f..b5f6684c 100644 --- a/src/server.h +++ b/src/server.h @@ -225,7 +225,6 @@ public: // Both setter and getter need no envlock, // can be called freely from threads void setTimeOfDay(u32 time); - inline u32 getTimeOfDay(); /* Shall be called with the environment locked. diff --git a/src/subgame.h b/src/subgame.h index 84283a08..c7399295 100644 --- a/src/subgame.h +++ b/src/subgame.h @@ -57,7 +57,7 @@ struct SubgameSpec } }; -// main config +// multicraft.conf bool getGameMinetestConfig(const std::string &game_path, Settings &conf); // game.conf bool getGameConfig(const std::string &game_path, Settings &conf); diff --git a/src/threading/event.cpp b/src/threading/event.cpp index 1c458bf1..c3c2ca02 100644 --- a/src/threading/event.cpp +++ b/src/threading/event.cpp @@ -25,14 +25,6 @@ DEALINGS IN THE SOFTWARE. #include "threading/event.h" -#if defined(_WIN32) - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #include -#endif - - #if __cplusplus < 201103L Event::Event() { @@ -92,4 +84,3 @@ void Event::signal() pthread_mutex_unlock(&mutex); #endif } - diff --git a/src/threading/event.h b/src/threading/event.h index ea087e53..dba3ddb4 100644 --- a/src/threading/event.h +++ b/src/threading/event.h @@ -30,7 +30,10 @@ DEALINGS IN THE SOFTWARE. #include #include "threading/mutex.h" #elif defined(_WIN32) - #include + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include #else #include #endif @@ -66,4 +69,3 @@ private: }; #endif - diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp index 7ef79968..3a5105ee 100644 --- a/src/touchscreengui.cpp +++ b/src/touchscreengui.cpp @@ -52,7 +52,7 @@ const char *touchgui_button_imagenames[] = { "fly_btn.png", "noclip_btn.png", #endif - "minimap_btn.png", +// "minimap_btn.png", "debug_btn.png", "chat_btn.png", // "camera_btn.png", @@ -98,9 +98,9 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id) key = "fast"; break; #endif - case minimap_id: +/* case minimap_id: key = "minimap"; - break; + break;*/ case debug_id: key = "toggle_debug"; break; @@ -298,13 +298,13 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density) m_screensize.Y - (button_size*3.25)), L"fast", false, SLOW_BUTTON_REPEAT); #endif - /* init minimap button */ + /* init minimap button initButton(minimap_id, rect(m_screensize.X - (0.75*button_size), m_screensize.Y - (4*button_size), m_screensize.X, m_screensize.Y - (button_size*3.25)), - L"minimap", false, SLOW_BUTTON_REPEAT); + L"minimap", false, SLOW_BUTTON_REPEAT);*/ #ifndef NDEBUG /* init debug button */ initButton(debug_id, @@ -327,10 +327,11 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density) /* init rangeselect button */ initButton(range_id, - rect(0, 0, - 0.75*button_size, 0.75*button_size),*/ - /*rect(0.78 * button_size, 0, - 1.5 * button_size, 0.75*button_size+0.03),*/ + /*rect(m_screensize.X - (0.75*button_size), 0, + m_screensize.X, 0.75*button_size),*/ + + rect(m_screensize.X - (1.5*button_size), 0, + m_screensize.X - (0.75*button_size), 0.75*button_size), L"far", false, SLOW_BUTTON_REPEAT); } diff --git a/src/touchscreengui.h b/src/touchscreengui.h index 67f274eb..21ef6029 100644 --- a/src/touchscreengui.h +++ b/src/touchscreengui.h @@ -49,7 +49,7 @@ typedef enum { noclip_id, fast_id, #endif - minimap_id, +// minimap_id, debug_id, chat_id, // camera_id, @@ -94,7 +94,6 @@ private: std::map > m_hud_rects; std::map m_hud_ids; bool m_visible; // is the gui visible - rect controlpadarea; /* value in degree */