aboutsummaryrefslogtreecommitdiff
path: root/src
ModeNameSize
-rw-r--r--CMakeLists.txt9450logplain
-rw-r--r--MyBillboardSceneNode.cpp5003logplain
-rw-r--r--MyBillboardSceneNode.h2324logplain
-rw-r--r--activeobject.h1481logplain
-rw-r--r--auth.cpp5903logplain
-rw-r--r--auth.h3306logplain
-rw-r--r--ban.cpp3909logplain
-rw-r--r--ban.h1499logplain
-rw-r--r--base64.cpp3767logplain
-rw-r--r--base64.h136logplain
-rw-r--r--camera.cpp25688logplain
-rw-r--r--camera.h6240logplain
-rw-r--r--client.cpp49814logplain
-rw-r--r--client.h8200logplain
-rw-r--r--clientobject.cpp1594logplain
-rw-r--r--clientobject.h2838logplain
-rw-r--r--clientserver.h6343logplain
-rw-r--r--clouds.cpp6510logplain
-rw-r--r--clouds.h1615logplain
-rw-r--r--cmake_config.h.in493logplain
-rw-r--r--collision.cpp6190logplain
-rw-r--r--collision.h1479logplain
-rw-r--r--common_irrlicht.h1844logplain
-rw-r--r--config.h746logplain
-rw-r--r--connection.cpp34050logplain
-rw-r--r--connection.h11754logplain
-rw-r--r--constants.h3066logplain
-rw-r--r--content_cao.cpp28960logplain
-rw-r--r--content_cao.h7725logplain
-rw-r--r--content_craft.cpp16674logplain
-rw-r--r--content_craft.h1168logplain
-rw-r--r--content_inventory.cpp3883logplain
-rw-r--r--content_inventory.h1714logplain
-rw-r--r--content_mapblock.cpp39016logplain
-rw-r--r--content_mapblock.h1002logplain
-rw-r--r--content_mapnode.cpp25026logplain
-rw-r--r--content_mapnode.h2699logplain
-rw-r--r--content_nodemeta.cpp11227logplain
-rw-r--r--content_nodemeta.h3081logplain
-rw-r--r--content_object.h1045logplain
-rw-r--r--content_sao.cpp33993logplain
-rw-r--r--content_sao.h5347logplain
-rw-r--r--debug.cpp4959logplain
-rw-r--r--debug.h5870logplain
-rw-r--r--defaultsettings.cpp4836logplain
-rw-r--r--defaultsettings.h902logplain
-rw-r--r--environment.cpp54032logplain
-rw-r--r--environment.h9833logplain
-rw-r--r--exceptions.h3278logplain
-rw-r--r--farmesh.cpp11448logplain
-rw-r--r--farmesh.h1797logplain
-rw-r--r--filesys.cpp6931logplain
-rw-r--r--filesys.h1620logplain
-rw-r--r--game.cpp55359logplain
-rw-r--r--game.h2874logplain
-rw-r--r--gettext.h1027logplain
-rw-r--r--gettime.h1414logplain
-rw-r--r--guiDeathScreen.cpp4042logplain
-rw-r--r--guiDeathScreen.h1461logplain
-rw-r--r--guiInventoryMenu.cpp13235logplain
-rw-r--r--guiInventoryMenu.h3305logplain
-rw-r--r--guiKeyChangeMenu.cpp18253logplain
-rw-r--r--guiKeyChangeMenu.h2668logplain
-rw-r--r--guiMainMenu.cpp11632logplain
-rw-r--r--guiMainMenu.h2430logplain
-rw-r--r--guiMessageMenu.cpp3579logplain
-rw-r--r--guiMessageMenu.h1435logplain
-rw-r--r--guiPasswordChange.cpp6222logplain
-rw-r--r--guiPasswordChange.h1471logplain
-rw-r--r--guiPauseMenu.cpp6307logplain
-rw-r--r--guiPauseMenu.h1498logplain
-rw-r--r--guiTextInputMenu.cpp4373logplain
-rw-r--r--guiTextInputMenu.h1491logplain
-rw-r--r--inventory.cpp19605logplain
-rw-r--r--inventory.h14176logplain
d---------jthread264logplain
-rw-r--r--keycode.cpp10756logplain
-rw-r--r--keycode.h1629logplain
-rw-r--r--light.cpp2812logplain
-rw-r--r--light.h2115logplain
-rw-r--r--log.cpp3221logplain
-rw-r--r--log.h2101logplain
-rw-r--r--main.cpp42669logplain
-rw-r--r--main.h1517logplain
-rw-r--r--mainmenumanager.h2675logplain
-rw-r--r--map.cpp104838logplain
-rw-r--r--map.h15601logplain
-rw-r--r--mapblock.cpp21043logplain
-rw-r--r--mapblock.h14939logplain
-rw-r--r--mapblock_mesh.cpp19452logplain
-rw-r--r--mapblock_mesh.h3427logplain
-rw-r--r--mapblock_nodemod.h2348logplain
-rw-r--r--mapchunk.h1812logplain
-rw-r--r--mapgen.cpp59841logplain
-rw-r--r--mapgen.h1803logplain
-rw-r--r--mapnode.cpp9425logplain
-rw-r--r--mapnode.h16024logplain
-rw-r--r--mapsector.cpp4841logplain
-rw-r--r--mapsector.h2663logplain
-rw-r--r--materials.cpp432logplain
-rw-r--r--materials.h2395logplain
-rw-r--r--mineral.cpp1230logplain
-rw-r--r--mineral.h1346logplain
-rw-r--r--modalMenu.h3380logplain
-rw-r--r--nodemetadata.cpp4784logplain
-rw-r--r--nodemetadata.h2749logplain
-rw-r--r--noise.cpp11301logplain
-rw-r--r--noise.h3672logplain
-rw-r--r--player.cpp21580logplain
-rw-r--r--player.h6628logplain
-rw-r--r--porting.cpp5850logplain
-rw-r--r--porting.h2569logplain
-rw-r--r--profiler.h4093logplain
-rw-r--r--serialization.cpp6205logplain
-rw-r--r--serialization.h2813logplain
-rw-r--r--server.cpp106794logplain
-rw-r--r--server.h15955logplain
-rw-r--r--servercommand.cpp8206logplain
-rw-r--r--servercommand.h1968logplain
-rw-r--r--servermain.cpp8533logplain
-rw-r--r--serverobject.cpp1810logplain
-rw-r--r--serverobject.h4866logplain
-rw-r--r--settings.h12538logplain
-rw-r--r--sha1.cpp5679logplain
-rw-r--r--sha1.h1623logplain
-rw-r--r--socket.cpp7920logplain
-rw-r--r--socket.h2989logplain
d---------sqlite116logplain
-rw-r--r--staticobject.h3422logplain
-rw-r--r--strfnd.h4792logplain
-rw-r--r--test.cpp27664logplain
-rw-r--r--test.h834logplain
-rw-r--r--threads.h1285logplain
-rw-r--r--tile.cpp34958logplain
-rw-r--r--tile.h8962logplain
-rw-r--r--utility.cpp6804logplain
-rw-r--r--utility.h29500logplain
-rw-r--r--voxel.cpp15286logplain
-rw-r--r--voxel.h12455logplain
-rw-r--r--winresource.rc199logplain
){ list_to->deleteItem(to_i); list_to->addItem(to_i, to_stack_was); list_from->deleteItem(from_i); list_from->addItem(from_i, from_stack_was); list_from->takeItem(from_i, count); } infostream<<"IMoveAction::apply(): moved" <<" count="<<count <<" from inv=\""<<from_inv.dump()<<"\"" <<" list=\""<<from_list<<"\"" <<" i="<<from_i <<" to inv=\""<<to_inv.dump()<<"\"" <<" list=\""<<to_list<<"\"" <<" i="<<to_i <<std::endl; /* Record rollback information */ if(!ignore_rollback && gamedef->rollback()) { IRollbackReportSink *rollback = gamedef->rollback(); // If source is not infinite, record item take if(src_can_take_count != -1){ RollbackAction action; std::string loc; { std::ostringstream os(std::ios::binary); from_inv.serialize(os); loc = os.str(); } action.setModifyInventoryStack(loc, from_list, from_i, false, src_item.getItemString()); rollback->reportAction(action); } // If destination is not infinite, record item put if(dst_can_put_count != -1){ RollbackAction action; std::string loc; { std::ostringstream os(std::ios::binary); to_inv.serialize(os); loc = os.str(); } action.setModifyInventoryStack(loc, to_list, to_i, true, src_item.getItemString()); rollback->reportAction(action); } } /* Report move to endpoints */ /* Detached inventories */ // Both endpoints are same detached if(from_inv.type == InventoryLocation::DETACHED && to_inv.type == InventoryLocation::DETACHED && from_inv.name == to_inv.name) { PLAYER_TO_SA(player)->detached_inventory_OnMove( from_inv.name, from_list, from_i, to_list, to_i, count, player); } else { // Destination is detached if(to_inv.type == InventoryLocation::DETACHED) { PLAYER_TO_SA(player)->detached_inventory_OnPut( to_inv.name, to_list, to_i, src_item, player); } // Source is detached if(from_inv.type == InventoryLocation::DETACHED) { PLAYER_TO_SA(player)->detached_inventory_OnTake( from_inv.name, from_list, from_i, src_item, player); } } /* Node metadata inventories */ // Both endpoints are same nodemeta if(from_inv.type == InventoryLocation::NODEMETA && to_inv.type == InventoryLocation::NODEMETA && from_inv.p == to_inv.p) { PLAYER_TO_SA(player)->nodemeta_inventory_OnMove( from_inv.p, from_list, from_i, to_list, to_i, count, player); } else{ // Destination is nodemeta if(to_inv.type == InventoryLocation::NODEMETA) { PLAYER_TO_SA(player)->nodemeta_inventory_OnPut( to_inv.p, to_list, to_i, src_item, player); } // Source is nodemeta else if(from_inv.type == InventoryLocation::NODEMETA) { PLAYER_TO_SA(player)->nodemeta_inventory_OnTake( from_inv.p, from_list, from_i, src_item, player); } } mgr->setInventoryModified(from_inv); if(inv_from != inv_to) mgr->setInventoryModified(to_inv); } void IMoveAction::clientApply(InventoryManager *mgr, IGameDef *gamedef) { // Optional InventoryAction operation that is run on the client // to make lag less apparent. Inventory *inv_from = mgr->getInventory(from_inv); Inventory *inv_to = mgr->getInventory(to_inv); if(!inv_from || !inv_to) return; InventoryLocation current_player; current_player.setCurrentPlayer(); Inventory *inv_player = mgr->getInventory(current_player); if(inv_from != inv_player || inv_to != inv_player) return; InventoryList *list_from = inv_from->getList(from_list); InventoryList *list_to = inv_to->getList(to_list); if(!list_from || !list_to) return; list_from->moveItem(from_i, list_to, to_i, count); mgr->setInventoryModified(from_inv); if(inv_from != inv_to) mgr->setInventoryModified(to_inv); } /* IDropAction */ IDropAction::IDropAction(std::istream &is) { std::string ts; std::getline(is, ts, ' '); count = stoi(ts); std::getline(is, ts, ' '); from_inv.deSerialize(ts); std::getline(is, from_list, ' '); std::getline(is, ts, ' '); from_i = stoi(ts); } void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGameDef *gamedef) { Inventory *inv_from = mgr->getInventory(from_inv); if(!inv_from){ infostream<<"IDropAction::apply(): FAIL: source inventory not found: " <<"from_inv=\""<<from_inv.dump()<<"\""<<std::endl; return; } InventoryList *list_from = inv_from->getList(from_list); /* If a list doesn't exist or the source item doesn't exist */ if(!list_from){ infostream<<"IDropAction::apply(): FAIL: source list not found: " <<"from_inv=\""<<from_inv.dump()<<"\""<<std::endl; return; } if(list_from->getItem(from_i).empty()) { infostream<<"IDropAction::apply(): FAIL: source item not found: " <<"from_inv=\""<<from_inv.dump()<<"\"" <<", from_list=\""<<from_list<<"\"" <<" from_i="<<from_i<<std::endl; return; } /* Do not handle rollback if inventory is player's */ bool ignore_src_rollback = (from_inv.type == InventoryLocation::PLAYER); /* Collect information of endpoints */ int take_count = list_from->getItem(from_i).count; if(count != 0 && count < take_count) take_count = count; int src_can_take_count = take_count; // Source is detached if(from_inv.type == InventoryLocation::DETACHED) { ItemStack src_item = list_from->getItem(from_i); src_item.count = take_count; src_can_take_count = PLAYER_TO_SA(player)->detached_inventory_AllowTake( from_inv.name, from_list, from_i, src_item, player); } // Source is nodemeta if(from_inv.type == InventoryLocation::NODEMETA) { ItemStack src_item = list_from->getItem(from_i); src_item.count = take_count; src_can_take_count = PLAYER_TO_SA(player)->nodemeta_inventory_AllowTake( from_inv.p, from_list, from_i, src_item, player); } if(src_can_take_count != -1 && src_can_take_count < take_count) take_count = src_can_take_count; int actually_dropped_count = 0; ItemStack src_item = list_from->getItem(from_i); // Drop the item ItemStack item1 = list_from->getItem(from_i); item1.count = take_count; if(PLAYER_TO_SA(player)->item_OnDrop(item1, player, player->getBasePosition() + v3f(0,1,0))) { actually_dropped_count = take_count - item1.count; if(actually_dropped_count == 0){ infostream<<"Actually dropped no items"<<std::endl; return; } // If source isn't infinite if(src_can_take_count != -1){ // Take item from source list ItemStack item2 = list_from->takeItem(from_i, actually_dropped_count); if(item2.count != actually_dropped_count) errorstream<<"Could not take dropped count of items"<<std::endl; mgr->setInventoryModified(from_inv); } } infostream<<"IDropAction::apply(): dropped " <<" from inv=\""<<from_inv.dump()<<"\"" <<" list=\""<<from_list<<"\"" <<" i="<<from_i <<std::endl; src_item.count = actually_dropped_count; /* Report drop to endpoints */ // Source is detached if(from_inv.type == InventoryLocation::DETACHED) { PLAYER_TO_SA(player)->detached_inventory_OnTake( from_inv.name, from_list, from_i, src_item, player); } // Source is nodemeta if(from_inv.type == InventoryLocation::NODEMETA) { PLAYER_TO_SA(player)->nodemeta_inventory_OnTake( from_inv.p, from_list, from_i, src_item, player); } /* Record rollback information */ if(!ignore_src_rollback && gamedef->rollback()) { IRollbackReportSink *rollback = gamedef->rollback(); // If source is not infinite, record item take if(src_can_take_count != -1){ RollbackAction action; std::string loc; { std::ostringstream os(std::ios::binary); from_inv.serialize(os); loc = os.str(); } action.setModifyInventoryStack(loc, from_list, from_i, false, src_item.getItemString()); rollback->reportAction(action); } } } void IDropAction::clientApply(InventoryManager *mgr, IGameDef *gamedef) { // Optional InventoryAction operation that is run on the client // to make lag less apparent. Inventory *inv_from = mgr->getInventory(from_inv); if(!inv_from) return; InventoryLocation current_player; current_player.setCurrentPlayer(); Inventory *inv_player = mgr->getInventory(current_player); if(inv_from != inv_player) return; InventoryList *list_from = inv_from->getList(from_list); if(!list_from) return; if(count == 0) list_from->changeItem(from_i, ItemStack()); else list_from->takeItem(from_i, count); mgr->setInventoryModified(from_inv); } /* ICraftAction */ ICraftAction::ICraftAction(std::istream &is) { std::string ts; std::getline(is, ts, ' '); count = stoi(ts); std::getline(is, ts, ' '); craft_inv.deSerialize(ts); } void ICraftAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGameDef *gamedef) { Inventory *inv_craft = mgr->getInventory(craft_inv); if(!inv_craft){ infostream<<"ICraftAction::apply(): FAIL: inventory not found: " <<"craft_inv=\""<<craft_inv.dump()<<"\""<<std::endl; return; } InventoryList *list_craft = inv_craft->getList("craft"); InventoryList *list_craftresult = inv_craft->getList("craftresult"); /* If a list doesn't exist or the source item doesn't exist */ if(!list_craft){ infostream<<"ICraftAction::apply(): FAIL: craft list not found: " <<"craft_inv=\""<<craft_inv.dump()<<"\""<<std::endl; return; } if(!list_craftresult){ infostream<<"ICraftAction::apply(): FAIL: craftresult list not found: " <<"craft_inv=\""<<craft_inv.dump()<<"\""<<std::endl; return; } if(list_craftresult->getSize() < 1){ infostream<<"ICraftAction::apply(): FAIL: craftresult list too short: " <<"craft_inv=\""<<craft_inv.dump()<<"\""<<std::endl; return; } ItemStack crafted; ItemStack craftresultitem; int count_remaining = count; bool found = getCraftingResult(inv_craft, crafted, false, gamedef); PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv); found = !crafted.empty(); while(found && list_craftresult->itemFits(0, crafted)) { InventoryList saved_craft_list = *list_craft; // Decrement input and add crafting output getCraftingResult(inv_craft, crafted, true, gamedef); PLAYER_TO_SA(player)->item_OnCraft(crafted, player, &saved_craft_list, craft_inv); list_craftresult->addItem(0, crafted); mgr->setInventoryModified(craft_inv); actionstream<<player->getDescription() <<" crafts " <<crafted.getItemString() <<std::endl; // Decrement counter if(count_remaining == 1) break; else if(count_remaining > 1) count_remaining--; // Get next crafting result found = getCraftingResult(inv_craft, crafted, false, gamedef); PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv); found = !crafted.empty(); } infostream<<"ICraftAction::apply(): crafted " <<" craft_inv=\""<<craft_inv.dump()<<"\"" <<std::endl; } void ICraftAction::clientApply(InventoryManager *mgr, IGameDef *gamedef) { // Optional InventoryAction operation that is run on the client // to make lag less apparent. } // Crafting helper bool getCraftingResult(Inventory *inv, ItemStack& result, bool decrementInput, IGameDef *gamedef) { DSTACK(__FUNCTION_NAME); result.clear(); // Get the InventoryList in which we will operate InventoryList *clist = inv->getList("craft"); if(!clist) return false; // Mangle crafting grid to an another format CraftInput ci; ci.method = CRAFT_METHOD_NORMAL; ci.width = clist->getWidth() ? clist->getWidth() : 3; for(u16 i=0; i<clist->getSize(); i++) ci.items.push_back(clist->getItem(i)); // Find out what is crafted and add it to result item slot CraftOutput co; bool found = gamedef->getCraftDefManager()->getCraftResult( ci, co, decrementInput, gamedef); if(found) result.deSerialize(co.item, gamedef->getItemDefManager()); if(found && decrementInput) { // CraftInput has been changed, apply changes in clist for(u16 i=0; i<clist->getSize(); i++) { clist->changeItem(i, ci.items[i]); } } return found; }