aboutsummaryrefslogtreecommitdiff
path: root/src/network
Commit message (Expand)AuthorAge
* Plantlike visual scale: Send sqrt(visual_scale) to old clientsparamat2017-01-30
* Wrap to positive degree values (#5106)raymoo2017-01-24
* Add hardware node coloring. Includes:Dániel Juhász2017-01-23
* Add particle animation, glowsfan52017-01-18
* Remove client-side chat prediction. (#5055)red-0012017-01-17
* Cleanup some header inclusions to improve compilation timesLoic Blot2017-01-11
* Move TileAnimation code to seperate filesfan52017-01-02
* Fix non reverted change on TOSERVER_BREATH compatLoic Blot2017-01-01
* Breath cheat fix: server sideLoic Blot2017-01-01
* Fix interact range check (thanks to @lhofhansl)sfan52016-12-29
* Use the outgoing split sequence number for every outgoing packet (#4864)Rogier-52016-12-29
* Various anticheat improvementssfan52016-12-26
* Fix computation of viewing range (in blocks) sent to server (#4882)Rogier-52016-12-11
* Optimize block sent: Fix rendering issueLars Hofhansl2016-12-03
* Optimize/adjust blocks/ActiveObjects sent at the server based on client setti...lhofhansl2016-11-30
* Wieldhand: Allow overriding the handTeTpaAka2016-11-26
* Revert "Adding particle blend, glow and animation (#4705)"sfan52016-11-14
* Adding particle blend, glow and animation (#4705)Foghrye42016-11-15
* Add control information to player interacts (#4685)raymoo2016-11-12
* Fix overloading problems mentioned by clangLoic Blot2016-10-30
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
* Attached particle spawnersraymoo2016-10-13
* More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)Loic Blot2016-10-08
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot2016-10-08
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)Loic Blot2016-10-08
* use unordered containers where possible (patch 4 on X)Loic Blot2016-10-06
* Use more unordered_maps to improve performance in c++11 buildsLoic Blot2016-10-06
* Chat: new settings to prevent spamLoic Blot2016-10-05
* Make plantlike drawtype more funAuke Kok2016-08-26
* Sapier's fix for the RESEND RELIABLE problem (#4170)Robert Kiraly2016-06-03
* Particles: Add option to remove particles on collisionAuke Kok2016-05-28
* Tolerate packet reordering in the early init processest312016-05-22
* Fix small formatting issue in SRP debug outputsfan52016-03-29
* Clean up StrfndShadowNinja2016-03-19
* Add option to not send pre v25 init packetest312016-03-15
* Much better API for auth.{cpp, h}est312016-03-15
* Fix player teleportation bug whilst sneakingHybridDog2016-03-14
* Nodebox: Allow nodeboxes to "connect"Auke Kok2016-03-12
* GOTBLOCKS & DELETEBLOCKS: test packet size only oncenerzhul2016-02-23
* Backface culling: Ignore setting in tiledef from old servers.Auke Kok2016-01-23
* Cache disable_anticheat and check it for "interacted_too_far"ASL972016-01-09
* Fix for commit 87dcee6 It uses the wrong variable and only covers some use ca...gregorycu2016-01-04
* Prevent technically unsafe access with empty vectorgregorycu2016-01-03
* Add on_secondary_use when right clicking an item in the airAlex Ford2015-12-02
* Only allow players with shout to chatest312015-11-13
* Add server side ncurses terminalest312015-11-06
* Always use errorstream for DEBUG_EXCEPTION_HANDLERShadowNinja2015-10-14
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
* Fix how address is logged when a wrong password is suppliedKahrl2015-10-12
* Remove redundant code in player interact handlerkwolekr2015-10-04
;\n" "np_terrain = 5, 40, (250, 250, 250), 12341, 5, 0.7, 2.4\n" "zoop = true"; const std::string TestSettings::config_text_after = "leet = 1337\n" "leetleet = 13371337\n" "leetleet_neg = -13371337\n" "floaty_thing = 1.1\n" "stringy_thing = asd /( ¤%&(/\" BLÖÄRP\n" "coord = (1, 2, 4.5)\n" " # this is just a comment\n" "this is an invalid line\n" "asdf = {\n" " a = 5\n" " bb = 2.5\n" " ccc = \"\"\"\n" "testy\n" " testa \n" "\"\"\"\n" "\n" "}\n" "blarg = \"\"\" \n" "some multiline text\n" " with leading whitespace!\n" "\"\"\"\n" "np_terrain = {\n" " flags = defaults\n" " lacunarity = 2.4\n" " octaves = 6\n" " offset = 3.5\n" " persistence = 0.7\n" " scale = 40\n" " seed = 12341\n" " spread = (250,250,250)\n" "}\n" "zoop = true\n" "coord2 = (1,2,3.3)\n" "floaty_thing_2 = 1.2\n" "groupy_thing = {\n" " animals = cute\n" " num_apples = 4\n" " num_oranges = 53\n" "}\n"; void TestSettings::testAllSettings() { try { Settings s; // Test reading of settings std::istringstream is(config_text_before); s.parseConfigLines(is); UASSERT(s.getS32("leet") == 1337); UASSERT(s.getS16("leetleet") == 32767); UASSERT(s.getS16("leetleet_neg") == -32768); // Not sure if 1.1 is an exact value as a float, but doesn't matter UASSERT(fabs(s.getFloat("floaty_thing") - 1.1) < 0.001); UASSERT(s.get("stringy_thing") == "asd /( ¤%&(/\" BLÖÄRP"); UASSERT(fabs(s.getV3F("coord").X - 1.0) < 0.001); UASSERT(fabs(s.getV3F("coord").Y - 2.0) < 0.001); UASSERT(fabs(s.getV3F("coord").Z - 4.5) < 0.001); // Test the setting of settings too s.setFloat("floaty_thing_2", 1.2); s.setV3F("coord2", v3f(1, 2, 3.3)); UASSERT(s.get("floaty_thing_2").substr(0,3) == "1.2"); UASSERT(fabs(s.getFloat("floaty_thing_2") - 1.2) < 0.001); UASSERT(fabs(s.getV3F("coord2").X - 1.0) < 0.001); UASSERT(fabs(s.getV3F("coord2").Y - 2.0) < 0.001); UASSERT(fabs(s.getV3F("coord2").Z - 3.3) < 0.001); // Test settings groups Settings *group = s.getGroup("asdf"); UASSERT(group != NULL); UASSERT(s.getGroupNoEx("zoop", group) == false); UASSERT(group->getS16("a") == 5); UASSERT(fabs(group->getFloat("bb") - 2.5) < 0.001); Settings *group3 = new Settings; group3->set("cat", "meow"); group3->set("dog", "woof"); Settings *group2 = new Settings; group2->setS16("num_apples", 4); group2->setS16("num_oranges", 53); group2->setGroup("animals", group3); group2->set("animals", "cute"); //destroys group 3 s.setGroup("groupy_thing", group2); // Test set failure conditions UASSERT(s.set("Zoop = Poop\nsome_other_setting", "false") == false); UASSERT(s.set("sneaky", "\"\"\"\njabberwocky = false") == false); UASSERT(s.set("hehe", "asdfasdf\n\"\"\"\nsomething = false") == false); // Test multiline settings UASSERT(group->get("ccc") == "testy\n testa "); UASSERT(s.get("blarg") == "some multiline text\n" " with leading whitespace!"); // Test NoiseParams UASSERT(s.getEntry("np_terrain").is_group == false); NoiseParams np; UASSERT(s.getNoiseParams("np_terrain", np) == true); UASSERT(std::fabs(np.offset - 5) < 0.001f); UASSERT(std::fabs(np.scale - 40) < 0.001f); UASSERT(std::fabs(np.spread.X - 250) < 0.001f); UASSERT(std::fabs(np.spread.Y - 250) < 0.001f); UASSERT(std::fabs(np.spread.Z - 250) < 0.001f); UASSERT(np.seed == 12341); UASSERT(np.octaves == 5); UASSERT(std::fabs(np.persist - 0.7) < 0.001f); np.offset = 3.5; np.octaves = 6; s.setNoiseParams("np_terrain", np); UASSERT(s.getEntry("np_terrain").is_group == true); // Test writing std::ostringstream os(std::ios_base::binary); is.clear(); is.seekg(0); UASSERT(s.updateConfigObject(is, os, "", 0) == true); //printf(">>>> expected config:\n%s\n", TEST_CONFIG_TEXT_AFTER); //printf(">>>> actual config:\n%s\n", os.str().c_str()); #if __cplusplus < 201103L // This test only works in older C++ versions than C++11 because we use unordered_map UASSERT(os.str() == config_text_after); #endif } catch (SettingNotFoundException &e) { UASSERT(!"Setting not found!"); } } void TestSettings::testFlagDesc() { Settings s; FlagDesc flagdesc[] = { { "biomes", 0x01 }, { "trees", 0x02 }, { "jungles", 0x04 }, { "oranges", 0x08 }, { "tables", 0x10 }, { nullptr, 0 } }; // Enabled: biomes, jungles, oranges (default) s.setDefault("test_desc", flagdesc, readFlagString( "biomes,notrees,jungles,oranges", flagdesc, nullptr)); UASSERT(s.getFlagStr("test_desc", flagdesc, nullptr) == (0x01 | 0x04 | 0x08)); // Enabled: jungles, oranges, tables s.set("test_desc", "nobiomes,tables"); UASSERT(s.getFlagStr("test_desc", flagdesc, nullptr) == (0x04 | 0x08 | 0x10)); // Enabled: (nothing) s.set("test_desc", "nobiomes,nojungles,nooranges,notables"); UASSERT(s.getFlagStr("test_desc", flagdesc, nullptr) == 0x00); // Numeric flag tests (override) // Enabled: trees, tables s.setDefault("test_flags", flagdesc, 0x02 | 0x10); UASSERT(s.getFlagStr("test_flags", flagdesc, nullptr) == (0x02 | 0x10)); // Enabled: tables s.set("test_flags", "16"); UASSERT(s.getFlagStr("test_flags", flagdesc, nullptr) == 0x10); }