diff --git a/VERSION b/VERSION index f1547e6d1..815e68dd2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.7 +2.0.8 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f4b147e93..38e933718 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**2.0.8** +* Use Default Port In ``servers.txt`` If Not Specified + **2.0.7** * Fix Sign Text Not Updating In Multiplayer When Exiting Editing UI Using Escape Button * Fix Item Dropping Not Working diff --git a/docs/MULTIPLAYER.md b/docs/MULTIPLAYER.md index 467863032..0fd62efea 100644 --- a/docs/MULTIPLAYER.md +++ b/docs/MULTIPLAYER.md @@ -9,6 +9,8 @@ Unlike vanilla MCPI, MCPI-Reborn allows you to natively join a server outside of ### Example ``~/.minecraft-pi/servers.txt`` ``` -# Comment -example.com:19132 +# Default Port Is 19132 +example.com +# Custom Port +example.com:19133 ``` diff --git a/libreborn/include/libreborn/minecraft.h b/libreborn/include/libreborn/minecraft.h index f689de50b..8952e7e38 100644 --- a/libreborn/include/libreborn/minecraft.h +++ b/libreborn/include/libreborn/minecraft.h @@ -110,7 +110,7 @@ static Minecraft_grabMouse_t Minecraft_grabMouse = (Minecraft_grabMouse_t) 0x15d typedef void (*Minecraft_leaveGame_t)(unsigned char *minecraft, bool save_remote_level); static Minecraft_leaveGame_t Minecraft_leaveGame = (Minecraft_leaveGame_t) 0x15ea0; -typedef void (*Minecraft_handleBack_t)(unsigned char *minecraft, bool param_1); +typedef int (*Minecraft_handleBack_t)(unsigned char *minecraft, bool param_1); static uint32_t Minecraft_handleBack_vtable_offset = 0x34; static uint32_t Minecraft_screen_width_property_offset = 0x20; // int32_t diff --git a/mods/src/multiplayer/multiplayer.cpp b/mods/src/multiplayer/multiplayer.cpp index 0fdee5708..c2da83095 100644 --- a/mods/src/multiplayer/multiplayer.cpp +++ b/mods/src/multiplayer/multiplayer.cpp @@ -35,7 +35,7 @@ static void load_servers() { // Write Defaults std::ofstream server_list_file_output(file); server_list_file_output << "# External Servers File\n"; - server_list_file_output << "thebrokenrail.com:19132\n"; + server_list_file_output << "thebrokenrail.com\n"; server_list_file_output.close(); // Re-Open Stream server_list_file = std::ifstream(file); @@ -58,15 +58,18 @@ static void load_servers() { // Parse std::string address; std::string port_str; - // Loop + // Add Default Port If Needed size_t last_colon = line.find_last_of(':'); - if (last_colon != std::string::npos) { - for (std::string::size_type i = 0; i < line.length(); i++) { - if (i > last_colon) { - port_str.push_back(line[i]); - } else if (i < last_colon) { - address.push_back(line[i]); - } + if (last_colon == std::string::npos) { + line.append(":19132"); + last_colon = line.find_last_of(':'); + } + // Loop + for (std::string::size_type i = 0; i < line.length(); i++) { + if (i > last_colon) { + port_str.push_back(line[i]); + } else if (i < last_colon) { + address.push_back(line[i]); } } // Check Line