diff --git a/VERSION b/VERSION index f1547e6..815e68d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.7 +2.0.8 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f4b147e..38e9337 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 4678630..0fd62ef 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 f689de5..8952e7e 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 0fdee57..c2da830 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