diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | builtin/chatcommands.lua | 6 | ||||
-rw-r--r-- | po/ky/minetest.po | 757 | ||||
-rw-r--r-- | src/main.cpp | 16 | ||||
-rw-r--r-- | src/mapgen_v6.cpp | 36 | ||||
-rw-r--r-- | src/nodedef.cpp | 37 | ||||
-rw-r--r-- | src/nodedef.h | 3 | ||||
-rw-r--r-- | src/scriptapi.cpp | 2 |
8 files changed, 833 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 437d31cf5..6bbe6454a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ elseif(UNIX) # Linux, BSD etc set(EXAMPLE_CONF_DIR ${DOCDIR}) set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") - set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale") endif() endif() diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua index f41f9afe4..4b09f7b2b 100644 --- a/builtin/chatcommands.lua +++ b/builtin/chatcommands.lua @@ -116,6 +116,9 @@ minetest.register_chatcommand("grant", { if not grantname or not grantprivstr then minetest.chat_send_player(name, "Invalid parameters (see /help grant)") return + elseif not minetest.auth_table[grantname] then + minetest.chat_send_player(name, "Player "..grantname.." does not exist.") + return end local grantprivs = minetest.string_to_privs(grantprivstr) if grantprivstr == "all" then @@ -159,6 +162,9 @@ minetest.register_chatcommand("revoke", { if not revokename or not revokeprivstr then minetest.chat_send_player(name, "Invalid parameters (see /help revoke)") return + elseif not minetest.auth_table[revokename] then + minetest.chat_send_player(name, "Player "..revokename.." does not exist.") + return end local revokeprivs = minetest.string_to_privs(revokeprivstr) local privs = minetest.get_player_privs(revokename) diff --git a/po/ky/minetest.po b/po/ky/minetest.po new file mode 100644 index 000000000..58d0d95c9 --- /dev/null +++ b/po/ky/minetest.po @@ -0,0 +1,757 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: minetest\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-03-30 19:56+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/guiConfigureWorld.cpp:125 +msgid "" +"Warning: Some mods are not configured yet.\n" +"They will be enabled by default when you save the configuration. " +msgstr "" + +#: src/guiConfigureWorld.cpp:144 +msgid "" +"Warning: Some configured mods are missing.\n" +"Their setting will be removed when you save the configuration. " +msgstr "" + +#: src/guiConfigureWorld.cpp:208 +msgid "enabled" +msgstr "" + +#: src/guiConfigureWorld.cpp:215 +msgid "Enable All" +msgstr "" + +#: src/guiConfigureWorld.cpp:222 +msgid "Disable All" +msgstr "" + +#: src/guiConfigureWorld.cpp:228 +msgid "depends on:" +msgstr "" + +#: src/guiConfigureWorld.cpp:240 +msgid "is required by:" +msgstr "" + +#: src/guiConfigureWorld.cpp:262 src/guiCreateWorld.cpp:165 +#: src/guiKeyChangeMenu.cpp:179 src/keycode.cpp:223 +msgid "Cancel" +msgstr "" + +#: src/guiConfigureWorld.cpp:268 src/guiKeyChangeMenu.cpp:173 +msgid "Save" +msgstr "" + +#: src/guiConfigureWorld.cpp:394 +msgid "Configuration saved. " +msgstr "" + +#: src/guiConfigureWorld.cpp:402 +msgid "Warning: Configuration not consistent. " +msgstr "" + +#: src/guiConfirmMenu.cpp:120 +msgid "Yes" +msgstr "" + +#: src/guiConfirmMenu.cpp:126 +msgid "No" +msgstr "" + +#: src/guiCreateWorld.cpp:116 +msgid "World name" +msgstr "" + +#: src/guiCreateWorld.cpp:135 +msgid "Game" +msgstr "" + +#: src/guiCreateWorld.cpp:159 +msgid "Create" +msgstr "" + +#: src/guiDeathScreen.cpp:96 +msgid "You died." +msgstr "" + +#: src/guiDeathScreen.cpp:104 +msgid "Respawn" +msgstr "" + +#: src/guiFormSpecMenu.cpp:582 +msgid "Left click: Move all items, Right click: Move single item" +msgstr "" + +#: src/guiFormSpecMenu.cpp:607 src/guiMessageMenu.cpp:109 +#: src/guiTextInputMenu.cpp:131 +msgid "Proceed" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:114 +msgid "Keybindings. (If this menu screws up, remove stuff from minetest.conf)" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:151 +msgid "\"Use\" = climb down" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:164 +msgid "Double tap \"jump\" to toggle fly" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:269 +msgid "Key already in use" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:347 +msgid "press key" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:372 +msgid "Forward" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:373 +msgid "Backward" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:374 src/keycode.cpp:228 +msgid "Left" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:375 src/keycode.cpp:228 +msgid "Right" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:376 +msgid "Use" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:377 +msgid "Jump" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:378 +msgid "Sneak" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:379 +msgid "Drop" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:380 +msgid "Inventory" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:381 +msgid "Chat" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:382 +msgid "Command" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:383 +msgid "Console" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:384 +msgid "Toggle fly" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:385 +msgid "Toggle fast" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:386 +msgid "Toggle noclip" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:387 +msgid "Range select" +msgstr "" + +#: src/guiKeyChangeMenu.cpp:388 +msgid "Print stacks" +msgstr "" + +#: src/guiMainMenu.cpp:92 +msgid "Cannot create world: Name contains invalid characters" +msgstr "" + +#: src/guiMainMenu.cpp:101 +msgid "Cannot create world: A world by this name already exists" +msgstr "" + +#: src/guiMainMenu.cpp:283 +msgid "Singleplayer" +msgstr "" + +#: src/guiMainMenu.cpp:284 +msgid "Multiplayer" +msgstr "" + +#: src/guiMainMenu.cpp:285 +msgid "Advanced" +msgstr "" + +#: src/guiMainMenu.cpp:286 +msgid "Settings" +msgstr "" + +#: src/guiMainMenu.cpp:287 +msgid "Credits" +msgstr "" + +#: src/guiMainMenu.cpp:317 +msgid "Select World:" +msgstr "" + +#: src/guiMainMenu.cpp:339 src/guiMainMenu.cpp:511 src/keycode.cpp:229 +msgid "Delete" +msgstr "" + +#: src/guiMainMenu.cpp:346 +msgid "New" +msgstr "" + +#: src/guiMainMenu.cpp:354 +msgid "Configure" +msgstr "" + +#: src/guiMainMenu.cpp:369 src/keycode.cpp:248 +msgid "Play" +msgstr "" + +#: src/guiMainMenu.cpp:380 src/guiMainMenu.cpp:619 +msgid "Creative Mode" +msgstr "" + +#: src/guiMainMenu.cpp:386 src/guiMainMenu.cpp:625 +msgid "Enable Damage" +msgstr "" + +#: src/guiMainMenu.cpp:406 src/guiMainMenu.cpp:541 +msgid "Name/Password" +msgstr "" + +#: src/guiMainMenu.cpp:442 src/guiMainMenu.cpp:459 src/guiMainMenu.cpp:1184 +msgid "Favorites:" +msgstr "" + +#: src/guiMainMenu.cpp:450 src/guiMainMenu.cpp:1194 +msgid "Public Server List:" +msgstr "" + +#: src/guiMainMenu.cpp:470 src/guiMainMenu.cpp:568 +msgid "Address/Port" +msgstr "" + +#: src/guiMainMenu.cpp:497 src/guiMainMenu.cpp:1183 +msgid "Show Public" +msgstr "" + +#: src/guiMainMenu.cpp:501 src/guiMainMenu.cpp:1193 +msgid "Show Favorites" +msgstr "" + +#: src/guiMainMenu.cpp:521 +msgid "Connect" +msgstr "" + +#: src/guiMainMenu.cpp:591 +msgid "Leave address blank to start a local server." +msgstr "" + +#: src/guiMainMenu.cpp:600 +msgid "Start Game / Connect" +msgstr "" + +#: src/guiMainMenu.cpp:632 +msgid "Public" +msgstr "" + +#: src/guiMainMenu.cpp:640 src/guiMainMenu.cpp:1113 +msgid "Delete world" +msgstr "" + +#: src/guiMainMenu.cpp:647 +msgid "Create world" +msgstr "" + +#: src/guiMainMenu.cpp:681 +msgid "Fancy trees" +msgstr "" + +#: src/guiMainMenu.cpp:687 +msgid "Smooth Lighting" +msgstr "" + +#: src/guiMainMenu.cpp:693 +msgid "3D Clouds" +msgstr "" + +#: src/guiMainMenu.cpp:699 +msgid "Opaque water" +msgstr "" + +#: src/guiMainMenu.cpp:709 +msgid "Mip-Mapping" +msgstr "" + +#: src/guiMainMenu.cpp:716 +msgid "Anisotropic Filtering" +msgstr "" + +#: src/guiMainMenu.cpp:723 +msgid "Bi-Linear Filtering" +msgstr "" + +#: src/guiMainMenu.cpp:730 +msgid "Tri-Linear Filtering" +msgstr "" + +#: src/guiMainMenu.cpp:738 +msgid "Shaders" +msgstr "" + +#: src/guiMainMenu.cpp:745 +msgid "Preload item visuals" +msgstr "" + +#: src/guiMainMenu.cpp:752 +msgid "Enable Particles" +msgstr "" + +#: src/guiMainMenu.cpp:759 +msgid "Finite liquid" +msgstr "" + +#: src/guiMainMenu.cpp:769 +msgid "Change keys" +msgstr "" + +#: src/guiMainMenu.cpp:1084 +msgid "Address required." +msgstr "" + +#: src/guiMainMenu.cpp:1102 +msgid "Cannot delete world: Nothing selected" +msgstr "" + +#: src/guiMainMenu.cpp:1117 +msgid "Files to be deleted" +msgstr "" + +#: src/guiMainMenu.cpp:1133 +msgid "Cannot create world: No games found" +msgstr "" + +#: src/guiMainMenu.cpp:1149 +msgid "Cannot configure world: Nothing selected" +msgstr "" + +#: src/guiMainMenu.cpp:1256 +msgid "Failed to delete all world files" +msgstr "" + +#: src/guiPasswordChange.cpp:108 +msgid "Old Password" +msgstr "" + +#: src/guiPasswordChange.cpp:125 +msgid "New Password" +msgstr "" + +#: src/guiPasswordChange.cpp:141 +msgid "Confirm Password" +msgstr "" + +#: src/guiPasswordChange.cpp:158 +msgid "Change" +msgstr "" + +#: src/guiPasswordChange.cpp:167 +msgid "Passwords do not match!" +msgstr "" + +#: src/guiPauseMenu.cpp:123 +msgid "Continue" +msgstr "" + +#: src/guiPauseMenu.cpp:132 +msgid "Change Password" +msgstr "" + +#: src/guiPauseMenu.cpp:140 +msgid "Sound Volume" +msgstr "" + +#: src/guiPauseMenu.cpp:147 +msgid "Exit to Menu" +msgstr "" + +#: src/guiPauseMenu.cpp:154 +msgid "Exit to OS" +msgstr "" + +#: src/guiPauseMenu.cpp:161 +msgid "" +"Default Controls:\n" +"- WASD: Walk\n" +"- Mouse left: dig/hit\n" +"- Mouse right: place/use\n" +"- Mouse wheel: select item\n" +"- 0...9: select item\n" +"- Shift: sneak\n" +"- R: Toggle viewing all loaded chunks\n" +"- I: Inventory menu\n" +"- ESC: This menu\n" +"- T: Chat\n" +msgstr "" + +#: src/guiVolumeChange.cpp:108 +msgid "Sound Volume: " +msgstr "" + +#: src/guiVolumeChange.cpp:121 +msgid "Exit" +msgstr "" + +#: src/keycode.cpp:223 +msgid "Left Button" +msgstr "" + +#: src/keycode.cpp:223 +msgid "Middle Button" +msgstr "" + +#: src/keycode.cpp:223 +msgid "Right Button" +msgstr "" + +#: src/keycode.cpp:223 +msgid "X Button 1" +msgstr "" + +#: src/keycode.cpp:224 +msgid "Back" +msgstr "" + +#: src/keycode.cpp:224 +msgid "Clear" +msgstr "" + +#: src/keycode.cpp:224 +msgid "Return" +msgstr "" + +#: src/keycode.cpp:224 +msgid "Tab" +msgstr "" + +#: src/keycode.cpp:224 +msgid "X Button 2" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Capital" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Control" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Kana" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Menu" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Pause" +msgstr "" + +#: src/keycode.cpp:225 +msgid "Shift" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Convert" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Escape" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Final" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Junja" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Kanji" +msgstr "" + +#: src/keycode.cpp:226 +msgid "Nonconvert" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Accept" +msgstr "" + +#: src/keycode.cpp:227 +msgid "End" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Home" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Mode Change" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Next" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Prior" +msgstr "" + +#: src/keycode.cpp:227 +msgid "Space" +msgstr "" + +#: src/keycode.cpp:228 +msgid "Down" +msgstr "" + +#: src/keycode.cpp:228 +msgid "Execute" +msgstr "" + +#: src/keycode.cpp:228 +msgid "Print" +msgstr "" + +#: src/keycode.cpp:228 +msgid "Select" +msgstr "" + +#: src/keycode.cpp:228 +msgid "Up" +msgstr "" + +#: src/keycode.cpp:229 +msgid "Help" +msgstr "" + +#: src/keycode.cpp:229 +msgid "Insert" +msgstr "" + +#: src/keycode.cpp:229 +msgid "Snapshot" +msgstr "" + +#: src/keycode.cpp:232 +msgid "Left Windows" +msgstr "" + +#: src/keycode.cpp:233 +msgid "Apps" +msgstr "" + +#: src/keycode.cpp:233 +msgid "Numpad 0" +msgstr "" + +#: src/keycode.cpp:233 +msgid "Numpad 1" +msgstr "" + +#: src/keycode.cpp:233 +msgid "Right Windows" +msgstr "" + +#: src/keycode.cpp:233 +msgid "Sleep" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 2" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 3" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 4" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 5" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 6" +msgstr "" + +#: src/keycode.cpp:234 +msgid "Numpad 7" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad *" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad +" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad -" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad /" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad 8" +msgstr "" + +#: src/keycode.cpp:235 +msgid "Numpad 9" +msgstr "" + +#: src/keycode.cpp:239 +msgid "Num Lock" +msgstr "" + +#: src/keycode.cpp:239 +msgid "Scroll Lock" +msgstr "" + +#: src/keycode.cpp:240 +msgid "Left Shift" +msgstr "" + +#: src/keycode.cpp:240 +msgid "Right Shift" +msgstr "" + +#: src/keycode.cpp:241 +msgid "Left Control" +msgstr "" + +#: src/keycode.cpp:241 +msgid "Left Menu" +msgstr "" + +#: src/keycode.cpp:241 +msgid "Right Control" +msgstr "" + +#: src/keycode.cpp:241 +msgid "Right Menu" +msgstr "" + +#: src/keycode.cpp:243 +msgid "Comma" +msgstr "" + +#: src/keycode.cpp:243 +msgid "Minus" +msgstr "" + +#: src/keycode.cpp:243 +msgid "Period" +msgstr "" + +#: src/keycode.cpp:243 +msgid "Plus" +msgstr "" + +#: src/keycode.cpp:247 +msgid "Attn" +msgstr "" + +#: src/keycode.cpp:247 +msgid "CrSel" +msgstr "" + +#: src/keycode.cpp:248 +msgid "Erase OEF" +msgstr "" + +#: src/keycode.cpp:248 +msgid "ExSel" +msgstr "" + +#: src/keycode.cpp:248 +msgid "OEM Clear" +msgstr "" + +#: src/keycode.cpp:248 +msgid "PA1" +msgstr "" + +#: src/keycode.cpp:248 +msgid "Zoom" +msgstr "" + +#: src/main.cpp:1506 +msgid "Main Menu" +msgstr "" + +#: src/main.cpp:1830 +msgid "Failed to initialize world" +msgstr "" + +#: src/main.cpp:1842 +msgid "No world selected and no address provided. Nothing to do." +msgstr "" + +#: src/main.cpp:1850 +msgid "Could not find or load game \"" +msgstr "" + +#: src/main.cpp:1864 +msgid "Invalid gamespec." +msgstr "" + +#: src/main.cpp:1904 +msgid "Connection error (timed out?)" +msgstr "" + +#: src/main.cpp:1915 +msgid "" +"\n" +"Check debug.txt for details." +msgstr "" diff --git a/src/main.cpp b/src/main.cpp index 2e57a8c20..08af6a37d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -618,7 +618,7 @@ void drawMenuBackground(video::IVideoDriver* driver) { std::string path = getTexturePath("menubg.png"); if (path[0]) { - video::ITexture *bgtexture = + static const video::ITexture *bgtexture = driver->getTexture(path.c_str()); if (bgtexture) { @@ -646,7 +646,7 @@ void drawMenuFooter(video::IVideoDriver* driver, bool clouds) { std::string path = getTexturePath(clouds ? "menufooter_clouds.png" : "menufooter.png"); if (path[0]) { - video::ITexture *footertexture = + static const video::ITexture *footertexture = driver->getTexture(path.c_str()); if (footertexture) { @@ -678,13 +678,10 @@ void drawMenuHeader(video::IVideoDriver* driver) { std::string path = getTexturePath("menuheader.png"); if (path[0]) { - video::ITexture *splashtexture = + static const video::ITexture *splashtexture = driver->getTexture(path.c_str()); if(splashtexture) { - //v2s32 splashsize((splashtexture->getOriginalSize().Width*100)/ - // splashtexture->getOriginalSize().Height, 80); - f32 mult = (((f32)screensize.Width / 2)) / ((f32)splashtexture->getOriginalSize().Width); @@ -712,9 +709,10 @@ void drawMenuHeader(video::IVideoDriver* driver) { // Draw the Splash over the clouds and under the main menu void drawMenuSplash(video::IVideoDriver* driver) { core::dimension2d<u32> screensize = driver->getScreenSize(); - if (getTexturePath("menusplash.png") != "") { - video::ITexture *splashtexture = - driver->getTexture(getTexturePath("menusplash.png").c_str()); + std::string path = getTexturePath("menusplash.png"); + if (path[0]) { + static const video::ITexture *splashtexture = + driver->getTexture(path.c_str()); if(splashtexture) { core::rect<s32> splashrect(0, 0, screensize.Width, screensize.Height); diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 0b419617d..275d4b78f 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -928,20 +928,20 @@ void MapgenV6::growGrass() { void MapgenV6::defineCave(Cave &cave, PseudoRandom ps, v3s16 node_min, bool large_cave) { - cave.min_tunnel_diameter = 2; - cave.max_tunnel_diameter = ps.range(2,6); - cave.dswitchint = ps.range(1,14); - cave.flooded = true; //large_cave && ps.range(0,4); - if(large_cave){ - cave.part_max_length_rs = ps.range(2,4); - cave.tunnel_routepoints = ps.range(5, ps.range(15,30)); - cave.min_tunnel_diameter = 5; - cave.max_tunnel_diameter = ps.range(7, ps.range(8,24)); - } else { - cave.part_max_length_rs = ps.range(2,9); - cave.tunnel_routepoints = ps.range(10, ps.range(15,30)); - } - cave.large_cave_is_flat = (ps.range(0,1) == 0); + cave.min_tunnel_diameter = 2; + cave.max_tunnel_diameter = ps.range(2,6); + cave.dswitchint = ps.range(1,14); + cave.flooded = true; //large_cave && ps.range(0,4); + if (large_cave){ + cave.part_max_length_rs = ps.range(2,4); + cave.tunnel_routepoints = ps.range(5, ps.range(15,30)); + cave.min_tunnel_diameter = 5; + cave.max_tunnel_diameter = ps.range(7, ps.range(8,24)); + } else { + cave.part_max_length_rs = ps.range(2,9); + cave.tunnel_routepoints = ps.range(10, ps.range(15,30)); + } + cave.large_cave_is_flat = (ps.range(0,1) == 0); } @@ -1120,7 +1120,13 @@ void MapgenV6::generateCaves(int max_stone_y) { rp.Z = ar.Z-1; vec = rp - orp; - for(float f=0; f<1.0; f+=1.0/vec.getLength()) + float veclen = vec.getLength(); + // As odd as it sounds, veclen is *exactly* + // 0.0 sometimes, causing a FPE + if (veclen == 0.0) + veclen = 1.0; + + for(float f=0; f<1.0; f+=1.0/veclen) { v3f fp = orp + vec * f; fp.X += 0.1*ps.range(-10,10); diff --git a/src/nodedef.cpp b/src/nodedef.cpp index d41df5c3b..ca8898907 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "nameidmapping.h" #include "util/serialize.h" +//#include "profiler.h" // For TimeTaker /* NodeBox @@ -452,6 +453,7 @@ public: virtual void getIds(const std::string &name, std::set<content_t> &result) const { + //TimeTaker t("getIds", NULL, PRECISION_MICRO); if(name.substr(0,6) != "group:"){ content_t id = CONTENT_IGNORE; if(getId(name, id)) @@ -459,6 +461,20 @@ public: return; } std::string group = name.substr(6); + +#if 1 // Optimized version, takes less than 1 microsecond at -O1 + std::map<std::string, GroupItems>::const_iterator + i = m_group_to_items.find(group); + if (i == m_group_to_items.end()) + return; + + const GroupItems &items = i->second; + for (GroupItems::const_iterator j = items.begin(); + j != items.end(); ++j) { + if ((*j).second != 0) + result.insert((*j).first); + } +#else // Old version, takes about ~150-200us at -O1 for(u16 id=0; id<=MAX_CONTENT; id++) { const ContentFeatures &f = m_content_features[id]; @@ -467,6 +483,8 @@ public: if(itemgroup_get(f.groups, group) != 0) result.insert(id); } +#endif + //printf("getIds: %dus\n", t.stop()); } virtual const ContentFeatures& get(const std::string &name) const { @@ -498,6 +516,21 @@ public: m_content_features[c] = def; if(def.name != "") addNameIdMapping(c, def.name); + + // Add this content to the list of all groups it belongs to + for (ItemGroupList::const_iterator i = def.groups.begin(); + i != def.groups.end(); ++i) { + std::string group_name = i->first; + + std::map<std::string, GroupItems>::iterator + j = m_group_to_items.find(group_name); + if (j == m_group_to_items.end()) { + m_group_to_items[group_name].push_back(std::make_pair(c, i->second)); + } else { + GroupItems &items = j->second; + items.push_back(std::make_pair(c, i->second)); + } + } } virtual content_t set(const std::string &name, const ContentFeatures &def) @@ -787,6 +820,10 @@ private: // item aliases too. Updated by updateAliases() // Note: Not serialized. std::map<std::string, content_t> m_name_id_mapping_with_aliases; + // A mapping from groups to a list of content_ts (and their levels) + // that belong to it. Necessary for a direct lookup in getIds(). + // Note: Not serialized. + std::map<std::string, GroupItems> m_group_to_items; }; IWritableNodeDefManager* createNodeDefManager() diff --git a/src/nodedef.h b/src/nodedef.h index 4f07565d1..d846489ae 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> #include <iostream> #include <map> +#include <list> #include "mapnode.h" #ifndef SERVER #include "tile.h" @@ -36,6 +37,8 @@ class IItemDefManager; class ITextureSource; class IGameDef; +typedef std::list<std::pair<content_t, int> > GroupItems; + enum ContentParamType { CPT_NONE, diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index 80abffa2b..81fcc08d3 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -727,7 +727,7 @@ static int l_register_ore(lua_State *L) if (ore->clust_scarcity <= 0 || ore->clust_num_ores <= 0) { errorstream << "register_ore: clust_scarcity and clust_num_ores" - "must be greater than 0"; + " must be greater than 0" << std::endl; delete ore; return 0; } |