Merge remote branch 'origin/master'

This commit is contained in:
Weblate 2013-03-31 12:27:05 +02:00
commit 319662c0ed
8 changed files with 833 additions and 26 deletions

@ -85,7 +85,7 @@ elseif(UNIX) # Linux, BSD etc
set(EXAMPLE_CONF_DIR ${DOCDIR}) set(EXAMPLE_CONF_DIR ${DOCDIR})
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") 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()
endif() endif()

@ -116,6 +116,9 @@ minetest.register_chatcommand("grant", {
if not grantname or not grantprivstr then if not grantname or not grantprivstr then
minetest.chat_send_player(name, "Invalid parameters (see /help grant)") minetest.chat_send_player(name, "Invalid parameters (see /help grant)")
return return
elseif not minetest.auth_table[grantname] then
minetest.chat_send_player(name, "Player "..grantname.." does not exist.")
return
end end
local grantprivs = minetest.string_to_privs(grantprivstr) local grantprivs = minetest.string_to_privs(grantprivstr)
if grantprivstr == "all" then if grantprivstr == "all" then
@ -159,6 +162,9 @@ minetest.register_chatcommand("revoke", {
if not revokename or not revokeprivstr then if not revokename or not revokeprivstr then
minetest.chat_send_player(name, "Invalid parameters (see /help revoke)") minetest.chat_send_player(name, "Invalid parameters (see /help revoke)")
return return
elseif not minetest.auth_table[revokename] then
minetest.chat_send_player(name, "Player "..revokename.." does not exist.")
return
end end
local revokeprivs = minetest.string_to_privs(revokeprivstr) local revokeprivs = minetest.string_to_privs(revokeprivstr)
local privs = minetest.get_player_privs(revokename) local privs = minetest.get_player_privs(revokename)

757
po/ky/minetest.po Normal file

@ -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 ""

@ -618,7 +618,7 @@ void drawMenuBackground(video::IVideoDriver* driver) {
std::string path = getTexturePath("menubg.png"); std::string path = getTexturePath("menubg.png");
if (path[0]) { if (path[0]) {
video::ITexture *bgtexture = static const video::ITexture *bgtexture =
driver->getTexture(path.c_str()); driver->getTexture(path.c_str());
if (bgtexture) { if (bgtexture) {
@ -646,7 +646,7 @@ void drawMenuFooter(video::IVideoDriver* driver, bool clouds) {
std::string path = getTexturePath(clouds ? std::string path = getTexturePath(clouds ?
"menufooter_clouds.png" : "menufooter.png"); "menufooter_clouds.png" : "menufooter.png");
if (path[0]) { if (path[0]) {
video::ITexture *footertexture = static const video::ITexture *footertexture =
driver->getTexture(path.c_str()); driver->getTexture(path.c_str());
if (footertexture) { if (footertexture) {
@ -678,13 +678,10 @@ void drawMenuHeader(video::IVideoDriver* driver) {
std::string path = getTexturePath("menuheader.png"); std::string path = getTexturePath("menuheader.png");
if (path[0]) { if (path[0]) {
video::ITexture *splashtexture = static const video::ITexture *splashtexture =
driver->getTexture(path.c_str()); driver->getTexture(path.c_str());
if(splashtexture) { if(splashtexture) {
//v2s32 splashsize((splashtexture->getOriginalSize().Width*100)/
// splashtexture->getOriginalSize().Height, 80);
f32 mult = (((f32)screensize.Width / 2)) / f32 mult = (((f32)screensize.Width / 2)) /
((f32)splashtexture->getOriginalSize().Width); ((f32)splashtexture->getOriginalSize().Width);
@ -712,9 +709,10 @@ void drawMenuHeader(video::IVideoDriver* driver) {
// Draw the Splash over the clouds and under the main menu // Draw the Splash over the clouds and under the main menu
void drawMenuSplash(video::IVideoDriver* driver) { void drawMenuSplash(video::IVideoDriver* driver) {
core::dimension2d<u32> screensize = driver->getScreenSize(); core::dimension2d<u32> screensize = driver->getScreenSize();
if (getTexturePath("menusplash.png") != "") { std::string path = getTexturePath("menusplash.png");
video::ITexture *splashtexture = if (path[0]) {
driver->getTexture(getTexturePath("menusplash.png").c_str()); static const video::ITexture *splashtexture =
driver->getTexture(path.c_str());
if(splashtexture) { if(splashtexture) {
core::rect<s32> splashrect(0, 0, screensize.Width, screensize.Height); core::rect<s32> splashrect(0, 0, screensize.Width, screensize.Height);

@ -928,20 +928,20 @@ void MapgenV6::growGrass() {
void MapgenV6::defineCave(Cave &cave, PseudoRandom ps, void MapgenV6::defineCave(Cave &cave, PseudoRandom ps,
v3s16 node_min, bool large_cave) { v3s16 node_min, bool large_cave) {
cave.min_tunnel_diameter = 2; cave.min_tunnel_diameter = 2;
cave.max_tunnel_diameter = ps.range(2,6); cave.max_tunnel_diameter = ps.range(2,6);
cave.dswitchint = ps.range(1,14); cave.dswitchint = ps.range(1,14);
cave.flooded = true; //large_cave && ps.range(0,4); cave.flooded = true; //large_cave && ps.range(0,4);
if(large_cave){ if (large_cave){
cave.part_max_length_rs = ps.range(2,4); cave.part_max_length_rs = ps.range(2,4);
cave.tunnel_routepoints = ps.range(5, ps.range(15,30)); cave.tunnel_routepoints = ps.range(5, ps.range(15,30));
cave.min_tunnel_diameter = 5; cave.min_tunnel_diameter = 5;
cave.max_tunnel_diameter = ps.range(7, ps.range(8,24)); cave.max_tunnel_diameter = ps.range(7, ps.range(8,24));
} else { } else {
cave.part_max_length_rs = ps.range(2,9); cave.part_max_length_rs = ps.range(2,9);
cave.tunnel_routepoints = ps.range(10, ps.range(15,30)); cave.tunnel_routepoints = ps.range(10, ps.range(15,30));
} }
cave.large_cave_is_flat = (ps.range(0,1) == 0); 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; rp.Z = ar.Z-1;
vec = rp - orp; 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; v3f fp = orp + vec * f;
fp.X += 0.1*ps.range(-10,10); fp.X += 0.1*ps.range(-10,10);

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h" #include "settings.h"
#include "nameidmapping.h" #include "nameidmapping.h"
#include "util/serialize.h" #include "util/serialize.h"
//#include "profiler.h" // For TimeTaker
/* /*
NodeBox NodeBox
@ -452,6 +453,7 @@ public:
virtual void getIds(const std::string &name, std::set<content_t> &result) virtual void getIds(const std::string &name, std::set<content_t> &result)
const const
{ {
//TimeTaker t("getIds", NULL, PRECISION_MICRO);
if(name.substr(0,6) != "group:"){ if(name.substr(0,6) != "group:"){
content_t id = CONTENT_IGNORE; content_t id = CONTENT_IGNORE;
if(getId(name, id)) if(getId(name, id))
@ -459,6 +461,20 @@ public:
return; return;
} }
std::string group = name.substr(6); 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++) for(u16 id=0; id<=MAX_CONTENT; id++)
{ {
const ContentFeatures &f = m_content_features[id]; const ContentFeatures &f = m_content_features[id];
@ -467,6 +483,8 @@ public:
if(itemgroup_get(f.groups, group) != 0) if(itemgroup_get(f.groups, group) != 0)
result.insert(id); result.insert(id);
} }
#endif
//printf("getIds: %dus\n", t.stop());
} }
virtual const ContentFeatures& get(const std::string &name) const virtual const ContentFeatures& get(const std::string &name) const
{ {
@ -498,6 +516,21 @@ public:
m_content_features[c] = def; m_content_features[c] = def;
if(def.name != "") if(def.name != "")
addNameIdMapping(c, 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, virtual content_t set(const std::string &name,
const ContentFeatures &def) const ContentFeatures &def)
@ -787,6 +820,10 @@ private:
// item aliases too. Updated by updateAliases() // item aliases too. Updated by updateAliases()
// Note: Not serialized. // Note: Not serialized.
std::map<std::string, content_t> m_name_id_mapping_with_aliases; 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() IWritableNodeDefManager* createNodeDefManager()

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <list>
#include "mapnode.h" #include "mapnode.h"
#ifndef SERVER #ifndef SERVER
#include "tile.h" #include "tile.h"
@ -36,6 +37,8 @@ class IItemDefManager;
class ITextureSource; class ITextureSource;
class IGameDef; class IGameDef;
typedef std::list<std::pair<content_t, int> > GroupItems;
enum ContentParamType enum ContentParamType
{ {
CPT_NONE, CPT_NONE,

@ -727,7 +727,7 @@ static int l_register_ore(lua_State *L)
if (ore->clust_scarcity <= 0 || ore->clust_num_ores <= 0) { if (ore->clust_scarcity <= 0 || ore->clust_num_ores <= 0) {
errorstream << "register_ore: clust_scarcity and clust_num_ores" errorstream << "register_ore: clust_scarcity and clust_num_ores"
"must be greater than 0"; " must be greater than 0" << std::endl;
delete ore; delete ore;
return 0; return 0;
} }