aboutsummaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAge
* Update our tooling (Clang 5 -> 7, GCC 7 -> 8)Loïc Blot2019-03-14
| | | | | | | | This change permits to use up-to-date compilers, clang-tidy and clang-format It also refactor the tidy/format step to drop the binary selection from scripts and perform it directly in travis
* Update a few dependency versions for buildbot (#8319)sfan52019-03-07
|
* Revert "Revert CSM particles commit to fix particle spawner bug for 5.0.0 ↵Loïc Blot2019-02-26
| | | | | | (#8288)" This reverts commit 01cd63bd3bca0192dab2834faf414b022706a77e.
* Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8288)Paramat2019-02-26
| | | | Reverts 5dab7426451842793b183fbd961ad2ae83c8acbd "[CSM] Add functions to create particles and particlespawners."
* Attend to LINT sillyness (#8276)Paramat2019-02-23
|
* Fix fake LINT check success (#8092)Jozef Behran2019-01-12
| | | | | | | | | The code 'if [ -z ${something} ]; then ... fi' means "if ${something} is an empty string, yell at the command line about 'binary operator expected' and ignore the body of the if statement, if ${something} is not an empty string, the condition is false so ignore the body of the if statement" which clearly isn't what the author wanted. Fix it by adding a few quotes around the offending ${something}.
* Fix dissector script to work with newer versions of Wireshark (#7957)meme2018-12-10
|
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
| | | | | Update Android.mk Remove 'src/client' from include_directories
* Make non-formspec modal menus respect gui scale (#7850)stujones112018-11-26
|
* Add release information to appdata file (#7771)Carles Pastor Badosa2018-10-16
|
* Revert 6587 - Optimize entity-entity collision (#7539)lhofhansl2018-07-08
|
* Fix release scriptLoïc Blot2018-06-14
| | | client_lua_api.md -> client_lua_api.txt
* Disable clang-tidy when no C/C++ files has been modified.Loic Blot2018-06-10
|
* [clang-tidy] Promote some performance-* as a coding error (#7194)Loïc Blot2018-04-04
| | | | | | | * Promote performance-type-promotion-in-math-fn as a coding error * Promote performance-faster-string-find too (which is not problematic currently) * Same for performance-implicit-cast-in-loop * Fix remaining tidy points
* Optimize entity-entity collision (#6587)Vitaliy2018-04-03
| | | | | | * Add IrrLicht type aliases * Add hash for IrrLicht vector * Add object map
* 'fix' LINT, use InventoryLocation==SmallJoker2018-04-02
|
* LINT: add clang-tidy step (#6295)Loïc Blot2018-04-01
| | | | | | | | | * Implement new travis clang-tidy build step * This step enable some rules and enforce one rule as error * This permits to have some C++ quality rules based on clang & clang contributor guidelines * Fix clang-tidy reported problems on push_back -> emplace_back
* Client eventmanager refactor (#7179)Loïc Blot2018-03-30
| | | | | | | | | | | | | | | | | | | | | * Drop EventManager from GameDef & do some client cleanups * EventManager is only used by Client. Don't expose it on Server & GameDef for nothing * Drop Client::event() in favor of direct calls to getEventManager * Cleanup some event put from new + put to put(new) * MtEvent: add Type(u8) enum * This will enhance event performance & ensure stricter type * Drop MtEvent::checkIs (unused) * clang-tidy reported fixes * Code style * Move event_manager.h to the client directory as it's only used by client Add EventManager unittests + switch to unordered_map as order is not important here Drop a unused function
* Cleanup sound manager class (#7158)Loïc Blot2018-03-24
| | | | | | | | | | * Cleanup sound manager client * Use some const refs * Use auto on iterators * Drop unused parameters * Move sound_openal.* to client folder * Move sound.cpp + OnDemandSoundFetcher to client/ folder + reorganize includes properly
* [CSM] Add functions to create particles and particlespawners. (#6072)red-0012018-01-20
|
* [CSM] Add basic HUD manipulation. (#6067)red-0012018-01-20
| | | | | | * [CSM] Add basic HUD manipulation. Workaround for on_connect not working right now.
* Add a build step to test non freetype builds (#6908)Loïc Blot2018-01-12
| | | * Add a build step to test non freetype builds
* Don't recalculate statustext initial color everytime & review fixesLoic Blot2018-01-05
|
* GameUI refactor (part 7/7): Finish to include profiler things to GameUILoic Blot2018-01-05
| | | | | | | | | Other changes: * Add GameUI clarification comment * Move force_fog_off & disable_camera_update flags from GameUI to Game, it's not UI related * Properly init GameUI::Flags * Move toggleChat toggleHud & toggleProfiler to GameUI * Add gameui.cpp to LINT whitelist
* Wireshark plugin: Complete all commands. (#6841)sofar2017-12-26
| | | | | This still leaves plenty of data undecoded, but just having the packet types all covered 100% for 0.4.16 will make looking at traces a lot simpler than seeing half the packets show up as unknown.
* Lua_api.txt: Remove MT version, fix spelling and clean upezhh2017-12-01
| | | | | Removes references to MT version in intro section. Update bump_version.sh to no longer manage version information.
* Move files to subdirectories (#6599)Vitaliy2017-11-08
| | | | * Move files around
* LINT: Add files to whitelist, fix detected indent errorsparamat2017-11-06
|
* Initial Haiku support (#6568)miqlas2017-10-30
| | | | * Iitial Haiku support
* Travis: Update clang from 4.0 to 5.0 (#6467)Loïc Blot2017-10-09
| | | | * Update clang from 4.0 to 5.0
* Formspec: textarea with scrollbar improvementsadrido2017-10-09
| | | | | | | | | | | | Increase scrollrate depending on fontsize Scroll on mousewheel Allow scrolling and marking text on non writable textareas Update lua api about readonly mode Show scrollbar if text overflows
* Make HUD status messages translatable (#5795)Wuzzy2017-09-05
| | | | | | * Make HUD status messages translatable * Make strings in showStatusTextSimple translatable
* Network cleanup (#6310)Loïc Blot2017-08-25
| | | | | | | | | | | | | | * Move Connection threads to dedicated files + various cleanups * ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types * Various code style fixes * Code style with clang-format * Various SharedBuffer copy removal * SharedBuffer cannot be copied anymore using Buffer * Fix many SharedBuffer copy (thanks to delete operator)
* Fix updatepo.sh and run it.Ekdohibs2017-08-24
| | | | It was broken due to the presence of "µ" utf-8 characters in builtin/profiler/reporter.lua.
* Add clientside translations.Ekdohibs2017-08-24
|
* Network cleanup (#6302)Loïc Blot2017-08-24
| | | | | | | | | | | | | | | | | | | | | | | * Cleanup network headers * Move peerhandler to a specific header to reduce compilation times * Move socket.cpp/h to network folder * More work * Network code cleanups * Move socket.{cpp,h} to network folder * Move Address object to network/address.{cpp,h} * Move network exceptions to network/networkexceptions.h * Client: use unique_ptr for Connection * Server/ClientIface: use shared_ptr for Connection * Format fixes * Remove socket.cpp socket.h from clang-format whitelist * Also fix NetworkPacket code style & make it under clang-format
* Travis-ci build: fix osx jpeg installation failure, git ambiguous argument ↵Juozas2017-08-20
| | | | | | | | | | | error (caused by merging commits) and add a workaround for travis commit range bug (#6227) * common.sh: fix travis-ci build bugs install_macosx_deps: check if jpeg is installed, if not - upgrade it. needs_compile: Check if $TRAVIS_COMMIT_RANGE is valid, if not, rewrite the range with the correct one, and fix git ambiguous argument error. * Changed detection method and removed commments
* New version scheme (#6292)Loïc Blot2017-08-20
| | | | | | | * Version changes: current dev version is now 0.5.0 * This change permit to have multi branches with various versions * Dev version is 0.5.0-dev and next release will be 0.5.0
* Mapgen: Add Carpathian mapgen (#6015)Vaughan Lapsley2017-07-06
|
* Isolate irrlicht references and use a singleton (#6041)Loïc Blot2017-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Device3D class which will contain IrrlichtDevice interface move getSupportedVideoDrivers to Device3D Add Device3D singleton & use it in various places Rename Device3D to Rendering engine & add helper functions to various device pointers More singleton work RenderingEngine owns draw_load_screen move draw functions to RenderingEngine Reduce IrrlichtDevice exposure and guienvironment RenderingEngine: Expose get_timer_time() to remove device from guiEngine Make irrlichtdevice & scene manager less exposed * Code style fixes * Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly * enum paralax => enum parallax
* Merge cguittfont lib in irrlicht change folder. (#6016)Loïc Blot2017-06-20
| | | | | | * Merge cguittfont lib in irrlicht change folder. This remove hack and static lib for FreeType
* Remove minetestmapper from this repository (#5901)Loïc Blot2017-06-11
| | | | | It's now located at https://github.com/minetest/minetestmapper Remove colors.txt and sectors2sqlite too
* Improve the path select GUI (#5852)red-0012017-06-11
| | | | | | | | | | | - Allow lua to chose whatever directories or files can be selected - Fix selecting directories - Rename dialog to `guiPathSelectMenu` from `guiFileSelectMenu` - Rename lua function for opening the menu from `show_file_open_dialog` to `show_path_select_dialog` - Remove duplicate code and fix code style. Related changes - fix `clang-format` whitelist. - Regenerate minetest.conf.example
* buildbot: exit 0 at the end of the scriptLoïc Blot2017-06-09
| | | | This permits script to return correct state when skipping packaging
* Implement GItlab CI daily builds for windows platform (32 & 64) (#5923)Loïc Blot2017-06-08
| | | | | | | | * Implement win32 & win64 builds in Gitlab CI + pkg improvements * windows buildbot: split build & deploy steps * move deb artifacts to root folder to have a nicer artifact * add windows build + packaging on xenial
* Fix bump_version.sh & client_lua_api.mdLoic Blot2017-06-06
| | | | This modification was forgotten at release
* Revert "Remove deprecated code segments (#5891)"Loïc Blot2017-06-06
| | | | This reverts commit 599e13e95e81aadb959c9f3715aec9b425ede084.
* Remove deprecated code segments (#5891)Thomas--S2017-06-04
|
* Minetest for C++11 (CMakeLists + Travis)Loic Blot2017-06-04
| | | | | | | | | | | * Move GCC to GCC 6 & GCC 7 * Move Clang to Clang 3.6 & Clang 4.0 * LINT moves from Clang 3.9 to Clang 4.0 * Move XCode 7.3 to 8.0 * Use more travis tricks to install compilers instead of adding complexity to our build script * Clang format fixes on checked files (compat Cpp11 instead of Cpp03) * Mingw GCC update from 4.8.4 to 5.3 (Ubuntu Xenial) * Drop mingw cmake generated files and add them to gitignore
* LINT fix & check all files with clang-formatLoic Blot2017-05-22
| | | | Seems the diff mode doesn't work well, PR are detected as working whereas in master it's shown it's problematic (and really problematic). Use same check everywhere
wb">bool isliquid, wasliquid; v3s16 em = vm->m_area.getExtent(); for (s16 z = nmin.Z; z <= nmax.Z; z++) { for (s16 x = nmin.X; x <= nmax.X; x++) { wasliquid = true; u32 i = vm->m_area.index(x, nmax.Y, z); for (s16 y = nmax.Y; y >= nmin.Y; y--) { isliquid = ndef->get(vm->m_data[i]).isLiquid(); // there was a change between liquid and nonliquid, add to queue. if (isliquid != wasliquid) trans_liquid->push_back(v3s16(x, y, z)); wasliquid = isliquid; vm->m_area.add_y(em, i, -1); } } } } void Mapgen::setLighting(u8 light, v3s16 nmin, v3s16 nmax) { ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG); VoxelArea a(nmin, nmax); for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) { for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) { u32 i = vm->m_area.index(a.MinEdge.X, y, z); for (int x = a.MinEdge.X; x <= a.MaxEdge.X; x++, i++) vm->m_data[i].param1 = light; } } } void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) { if (light <= 1 || !a.contains(p)) return; u32 vi = vm->m_area.index(p); MapNode &n = vm->m_data[vi]; // Decay light in each of the banks separately u8 light_day = light & 0x0F; if (light_day > 0) light_day -= 0x01; u8 light_night = light & 0xF0; if (light_night > 0) light_night -= 0x10; // Bail out only if we have no more light from either bank to propogate, or // we hit a solid block that light cannot pass through. if ((light_day <= (n.param1 & 0x0F) && light_night <= (n.param1 & 0xF0)) || !ndef->get(n).light_propagates) return; // Since this recursive function only terminates when there is no light from // either bank left, we need to take the max of both banks into account for // the case where spreading has stopped for one light bank but not the other. light = MYMAX(light_day, n.param1 & 0x0F) | MYMAX(light_night, n.param1 & 0xF0); n.param1 = light; lightSpread(a, p + v3s16(0, 0, 1), light); lightSpread(a, p + v3s16(0, 1, 0), light); lightSpread(a, p + v3s16(1, 0, 0), light); lightSpread(a, p - v3s16(0, 0, 1), light); lightSpread(a, p - v3s16(0, 1, 0), light); lightSpread(a, p - v3s16(1, 0, 0), light); } void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax, v3s16 full_nmin, v3s16 full_nmax, bool propagate_shadow) { ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG); //TimeTaker t("updateLighting"); propagateSunlight(nmin, nmax, propagate_shadow); spreadLight(full_nmin, full_nmax); //printf("updateLighting: %dms\n", t.stop()); } void Mapgen::propagateSunlight(v3s16 nmin, v3s16 nmax, bool propagate_shadow) { //TimeTaker t("propagateSunlight"); VoxelArea a(nmin, nmax); bool block_is_underground = (water_level >= nmax.Y); v3s16 em = vm->m_area.getExtent(); // NOTE: Direct access to the low 4 bits of param1 is okay here because, // by definition, sunlight will never be in the night lightbank. for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) { for (int x = a.MinEdge.X; x <= a.MaxEdge.X; x++) { // see if we can get a light value from the overtop u32 i = vm->m_area.index(x, a.MaxEdge.Y + 1, z); if (vm->m_data[i].getContent() == CONTENT_IGNORE) { if (block_is_underground) continue; } else if ((vm->m_data[i].param1 & 0x0F) != LIGHT_SUN && propagate_shadow) { continue; } vm->m_area.add_y(em, i, -1); for (int y = a.MaxEdge.Y; y >= a.MinEdge.Y; y--) { MapNode &n = vm->m_data[i]; if (!ndef->get(n).sunlight_propagates) break; n.param1 = LIGHT_SUN; vm->m_area.add_y(em, i, -1); } } } //printf("propagateSunlight: %dms\n", t.stop()); } void Mapgen::spreadLight(v3s16 nmin, v3s16 nmax) { //TimeTaker t("spreadLight"); VoxelArea a(nmin, nmax); for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) { for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) { u32 i = vm->m_area.index(a.MinEdge.X, y, z); for (int x = a.MinEdge.X; x <= a.MaxEdge.X; x++, i++) { MapNode &n = vm->m_data[i]; if (n.getContent() == CONTENT_IGNORE) continue; const ContentFeatures &cf = ndef->get(n); if (!cf.light_propagates) continue; // TODO(hmmmmm): Abstract away direct param1 accesses with a // wrapper, but something lighter than MapNode::get/setLight u8 light_produced = cf.light_source; if (light_produced) n.param1 = light_produced | (light_produced << 4); u8 light = n.param1; if (light) { lightSpread(a, v3s16(x, y, z + 1), light); lightSpread(a, v3s16(x, y + 1, z ), light); lightSpread(a, v3s16(x + 1, y, z ), light); lightSpread(a, v3s16(x, y, z - 1), light); lightSpread(a, v3s16(x, y - 1, z ), light); lightSpread(a, v3s16(x - 1, y, z ), light); } } } } //printf("spreadLight: %dms\n", t.stop()); } //// //// GenerateNotifier //// GenerateNotifier::GenerateNotifier() { m_notify_on = 0; } GenerateNotifier::GenerateNotifier(u32 notify_on, std::set<u32> *notify_on_deco_ids) { m_notify_on = notify_on; m_notify_on_deco_ids = notify_on_deco_ids; } void GenerateNotifier::setNotifyOn(u32 notify_on) { m_notify_on = notify_on; } void GenerateNotifier::setNotifyOnDecoIds(std::set<u32> *notify_on_deco_ids) { m_notify_on_deco_ids = notify_on_deco_ids; } bool GenerateNotifier::addEvent(GenNotifyType type, v3s16 pos, u32 id) { if (!(m_notify_on & (1 << type))) return false; if (type == GENNOTIFY_DECORATION && m_notify_on_deco_ids->find(id) == m_notify_on_deco_ids->end()) return false; GenNotifyEvent gne; gne.type = type; gne.pos = pos; gne.id = id; m_notify_events.push_back(gne); return true; } void GenerateNotifier::getEvents( std::map<std::string, std::vector<v3s16> > &event_map, bool peek_events) { std::list<GenNotifyEvent>::iterator it; for (it = m_notify_events.begin(); it != m_notify_events.end(); ++it) { GenNotifyEvent &gn = *it; std::string name = (gn.type == GENNOTIFY_DECORATION) ? "decoration#"+ itos(gn.id) : flagdesc_gennotify[gn.type].name; event_map[name].push_back(gn.pos); } if (!peek_events) m_notify_events.clear(); } //// //// MapgenParams //// void MapgenParams::load(const Settings &settings) { std::string seed_str; const char *seed_name = (&settings == g_settings) ? "fixed_map_seed" : "seed"; if (settings.getNoEx(seed_name, seed_str) && !seed_str.empty()) seed = read_seed(seed_str.c_str()); else myrand_bytes(&seed, sizeof(seed)); settings.getNoEx("mg_name", mg_name); settings.getS16NoEx("water_level", water_level); settings.getS16NoEx("chunksize", chunksize); settings.getFlagStrNoEx("mg_flags", flags, flagdesc_mapgen); settings.getNoiseParams("mg_biome_np_heat", np_biome_heat); settings.getNoiseParams("mg_biome_np_heat_blend", np_biome_heat_blend); settings.getNoiseParams("mg_biome_np_humidity", np_biome_humidity); settings.getNoiseParams("mg_biome_np_humidity_blend", np_biome_humidity_blend); delete sparams; MapgenFactory *mgfactory = EmergeManager::getMapgenFactory(mg_name); if (mgfactory) { sparams = mgfactory->createMapgenParams(); sparams->readParams(&settings); } } void MapgenParams::save(Settings &settings) const { settings.set("mg_name", mg_name); settings.setU64("seed", seed); settings.setS16("water_level", water_level); settings.setS16("chunksize", chunksize); settings.setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX); settings.setNoiseParams("mg_biome_np_heat", np_biome_heat); settings.setNoiseParams("mg_biome_np_heat_blend", np_biome_heat_blend); settings.setNoiseParams("mg_biome_np_humidity", np_biome_humidity); settings.setNoiseParams("mg_biome_np_humidity_blend", np_biome_humidity_blend); if (sparams) sparams->writeParams(&settings); }