aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.cpp
Commit message (Expand)AuthorAge
* Move files to subdirectories (#6599)Vitaliy2017-11-08
* Translations: prevent remote crash with invalid translationsEkdohibs2017-08-25
* Add clientside translations.Ekdohibs2017-08-24
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
* Clean up numeric.h and split FacePositionCache from itShadowNinja2017-05-06
* Add color names from web page referenced in luaapi docsapier2017-01-15
* Random misc. warning fixes and cleanupskwolekr2016-06-11
* Escape more strings: formspecs, item descriptions, infotexts...Ekdohibs2016-04-24
* Remove chat escape sequences from chat messages, for future colored chat.Ekdohibs2016-03-15
* Fix indianred and indigo of color-stringRui2015-08-19
* Android: bypass broken wide_to_utf8 with wide_to_narrow (again)est312015-08-19
* Android: fix horrible libiconv buildest312015-07-29
* Use UTF-8 instead of narrowest312015-07-08
* Fix *BSD build with GNU iconvkwolekr2015-06-29
* Fix string conversion error messageest312015-06-23
* Fail iconv call gracefullyest312015-06-17
* Android: bypass broken wide_to_utf8 with wide_to_narrowest312015-06-14
* Add utf-8 conversion utilities and re-add intlGUIEditBoxest312015-06-13
* Make early protocol auth mechanism generic, and add SRPest312015-05-11
* Refactor around translatePasswordest312015-04-17
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* Fix Android text bug (no text displaying)Craig Robbins2015-03-07
* Fix narrow_to_wide_c (ANDROID)Craig Robbins2015-03-02
* Fix minor memory leak (Android)Craig Robbins2015-02-27
* Move hex.h to util/Loic Blot2015-02-21
* Move sha1.hpp and base64.hpp to util/Loic Blot2015-02-21
* Fix gettext on MSVCBlockMen2015-02-12
* Fix Android build of narrow_to_wideShadowNinja2015-02-11
* Reduce gettext wide/narrow and string/char* conversionsShadowNinja2015-02-05
* Deduplicate code and use stdlib in string functionsShadowNinja2015-01-03
* Added names colours and refactored parseColorString()Craig Robbins2014-10-29
* Add [colorize modifierBlockMen2014-10-05
* Fix misc. style issueskwolekr2014-10-03
* Use const references for Settings methodsShadowNinja2014-09-21
* Add support for Android 2.3+sapier2014-06-29
* Add capability to read table flag fields from Lua APIkwolekr2014-02-09
* Make flag strings clear specified flag with 'no' prefixkwolekr2014-02-08
* Implement urlencode and urldecodeKahrl2013-12-13
* Fix win32/msvc i18n (quite UGLY version, blame Microsoft)sapier2013-11-11
* Accept hexadecimal and string values for seedskwolekr2013-11-04
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Add flag string settings, flat map optionkwolekr2013-02-06
* Slightly improved version of mystrtok_rkwolekr2013-01-23
* Fix compile under MingWkwolekr2013-01-23
* Added ability to fetch media from remote server (using cURL library)Ilya Zhuravlev2012-12-16
* Hopefully fix includes on mingwPerttu Ahola2012-06-17
* Initially split utility.h to multiple files in util/Perttu Ahola2012-06-17
>..(form_x+edge_x)..","..(form_z+edge_z).."]" local lbl={} for x,itx in pairs(itm_cache) do if x>=minx and x<=maxx then for z,y in pairs(itx) do if z>=minz and z<=maxz then local adn=advtrains.detector.get({x=x, y=y, z=z}) local color="gray" if adn then color="red" lbl[sid(adn)]={x=x, z=z} end form=form.."box["..(edge_x*(x-minx))..","..(form_z-(edge_z*(z-minz)))..";"..len_x..","..len_z..";"..color.."]" end end end end for t_id, xz in pairs(lbl) do form=form.."label["..(edge_x*(xz.x-minx))..","..(form_x-(edge_z*(xz.z-minz)))..";"..t_id.."]" end return form end local function cache_ndb() itm_cache={} local ndb_nodes=advtrains.ndb.get_nodes() for y, xzt in pairs(ndb_nodes) do for x, zt in pairs(xzt) do for z, _ in pairs(zt) do if not itm_cache[x] then itm_cache[x]={} end itm_cache[x][z]=y end end end end minetest.register_chatcommand("itm", { params="[x1 z1 x2 z2] or [mdef]", description="Display advtrains train map of given area.\nFirst form:[x1 z1 x2 z2] - specify area directly.\nSecond form:[mdef] - Use a predefined map background(see init.lua)\nThird form: No parameters - use WorldEdit position markers.", privs={itm=true}, func = function(name, param) local mdef=string.match(param, "^(%S+)$") if mdef then local d=map_def[mdef] if not d then return false, "Map definiton not found: "..mdef end itm_pdata[name]=map_def[mdef] minetest.show_formspec(name, "itrainmap", create_map_form(d)) return true, "Showing train map: "..mdef end local x1, z1, x2, z2=string.match(param, "^(%S+) (%S+) (%S+) (%S+)$") if not (x1 and z1 and x2 and z2) then if worldedit then local wep1, wep2=worldedit.pos1[name], worldedit.pos2[name] if wep1 and wep2 then x1, z1, x2, z2=wep1.x, wep1.z, wep2.x, wep2.z end end end if not (x1 and z1 and x2 and z2) then return false, "Invalid parameters and no WE positions set" end local d={p1x=x1, p1z=z1, p2x=x2, p2z=z2} itm_pdata[name]=d minetest.show_formspec(name, "itrainmap", create_map_form(d)) return true, "Showing ("..x1..","..z1..")-("..x2..","..z2..")" end, }) minetest.register_chatcommand("itm_cache_ndb", { params="", description="Cache advtrains node database again. Run when tracks changed.", privs={itm=true}, func = function(name, param) cache_ndb() return true, "Done caching node database." end, }) local timer=0 function advtrains_itm_mainloop(dtime) timer=timer-math.min(dtime, 0.1) if timer<=0 then for pname,d in pairs(itm_pdata) do minetest.show_formspec(pname, "itrainmap", create_map_form(d)) end timer=2 end end minetest.register_on_player_receive_fields(function(player, formname, fields) if formname=="itrainmap" and fields.quit then itm_pdata[player:get_player_name()]=nil end end) function advtrains_itm_init() --automatically run itm_cache_ndb minetest.after(2, cache_ndb) end