Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/move_maps_minimap into lp:widelands-website
LGTM :) -- https://code.launchpad.net/~widelands-dev/widelands-website/move_maps_minimap/+merge/370039 Your team Widelands Developers is subscribed to branch lp:widelands-website. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/refactor_gamehost into lp:widelands
Klaus Halfmann has proposed merging lp:~widelands-dev/widelands/refactor_gamehost into lp:widelands. Commit message: Refactoring of gamehost.cc for better readability. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/refactor_gamehost/+merge/370320 Refactoring of gamehost.cc for better readability, should be completly compatible with trunk. Please contact me, so we can do some testing vs. trunk. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/refactor_gamehost into lp:widelands. === modified file 'src/network/gamehost.cc' --- src/network/gamehost.cc 2019-05-26 11:39:41 + +++ src/network/gamehost.cc 2019-07-18 14:48:27 + @@ -903,7 +903,8 @@ } /** - * If the host sends a chat message with formation /kick + * If the host sends a chat message with formation /kick . + * * This function will handle this command and try to kick the user. */ void GameHost::kick_user(uint32_t client, const std::string& reason) { @@ -980,18 +981,22 @@ return false; // if there is one client that is currently receiving a file, we can not launch. + + std::vector &users = d->settings.users; + for (std::vector::iterator j = d->clients.begin(); j != d->clients.end(); ++j) { - if (j->usernum == -1) { + int usernum = j->usernum; + if (usernum == -1) { return false; } - if (!d->settings.users[j->usernum].ready) { + if (users[j->usernum].ready) { return false; } } // all players must be connected to a controller (human/ai) or be closed. // but not all should be closed! - bool one_not_closed = false; + bool one_not_closed = false; // TODO(k.halfmann): check this logic for (PlayerSettings& setting : d->settings.players) { if (setting.state != PlayerSettings::State::kClosed) one_not_closed = true; @@ -1011,14 +1016,15 @@ std::vector::size_type oldplayers = d->settings.players.size(); - SendPacket packet; - // Care about the host if (static_cast(maxplayers) <= d->settings.playernum && d->settings.playernum != UserSettings::none()) { set_player_number(UserSettings::none()); } + SendPacket packet; + + // Drop players not matching map any longer while (oldplayers > maxplayers) { --oldplayers; for (uint16_t i = 1; i < d->settings.users.size(); ++i) @@ -1033,16 +1039,13 @@ d->clients.at(j).playernum = UserSettings::none(); // Broadcast change -packet.reset(); -packet.unsigned_8(NETCMD_SETTING_USER); -packet.unsigned_32(i); -write_setting_user(packet, i); -broadcast(packet); +broadcast_setting_user(packet, d->clients.at(j).usernum); } } d->settings.players.resize(maxplayers); + // Open slots for new players found on the map. while (oldplayers < maxplayers) { PlayerSettings& player = d->settings.players.at(oldplayers); player.state = PlayerSettings::State::kOpen; @@ -1110,9 +1113,12 @@ } } +// TODO(k.halfmann): refactor this void GameHost::set_player_state(uint8_t const number, PlayerSettings::State const state, bool const host) { + + // ignore player numbers out of range if (number >= d->settings.players.size()) return; @@ -1122,9 +1128,9 @@ return; if (player.state == PlayerSettings::State::kHuman) { - // 0 is host and has no client - if (d->settings.users.at(0).position == number) { - d->settings.users.at(0).position = UserSettings::none(); + // kHostPlayerNum has no client + if (d->settings.users.at(kHostPlayerNum).position == number) { + d->settings.users.at(kHostPlayerNum).position = UserSettings::none(); d->settings.playernum = UserSettings::none(); } for (uint8_t i = 1; i < d->settings.users.size(); ++i) { @@ -1184,11 +1190,7 @@ // Broadcast change to player SendPacket packet; - packet.reset(); - packet.unsigned_8(NETCMD_SETTING_PLAYER); - packet.unsigned_8(number); - write_setting_player(packet, number); - broadcast(packet); + broadcast_setting_player(packet, number); // Let clients know whether their slot has changed packet.reset(); @@ -1205,6 +1207,7 @@ PlayerSettings& player = d->settings.players.at(number); + // TODDO(k.halfmann): check this logic, will tribe "survive" een when random is selected? if (player.tribe == tribe && player.random_tribe == random_tribe) return; @@ -1225,11 +1228,8 @@ // broadcast changes SendPacket packet; - packet.unsigned_8(NETCMD_SETTING_PLAYER); - packet.unsigned_8(number); - write_setting_player(packet, number); - broadcast(packet); - return; + broadcast_setting_player(packet, number); + return; // TODO(k.halfmann): check this logic } } log("Player %u attempted to change to tribe %s; not a valid tribe\n", number, tribe.c_str()); @@ -1251,10 +1251,7 @@ // broadcast changes SendPacket packet; -packet.unsigned_8(NETCMD_SETTING_PLAYER);
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug_1836107_lGL into lp:widelands
kaputtnik has proposed merging lp:~widelands-dev/widelands/bug_1836107_lGL into lp:widelands. Commit message: Link GL libraries insted of setting flags Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1836107 in widelands: "Build order for -lGL does not work for openSUSE Tumbleweed" https://bugs.launchpad.net/widelands/+bug/1836107 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug_1836107_lGL/+merge/370334 See https://bugs.launchpad.net/widelands/+bug/1836107 One should may apply a better commit message ;) -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug_1836107_lGL into lp:widelands. === modified file 'CMakeLists.txt' --- CMakeLists.txt 2019-06-15 09:13:13 + +++ CMakeLists.txt 2019-07-18 17:54:01 + @@ -182,7 +182,7 @@ # This is set to avoid linker errors when using GLVND-libs on Linux if("${OpenGL_GL_PREFERENCE}" STREQUAL "GLVND") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lGL") + link_libraries("GL") add_compile_definitions(WL_USE_GLVND) message(STATUS "Adding linker flags for GLVND.") endif() ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/refactor_gamehost into lp:widelands
Continuous integration builds have changed state: Travis build 5271. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/560555689. Appveyor build 5047. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_refactor_gamehost-5047. -- https://code.launchpad.net/~widelands-dev/widelands/refactor_gamehost/+merge/370320 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/refactor_gamehost into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website
kaputtnik has proposed merging lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website. Commit message: Allow attachments in the forum Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #964452 in Widelands Website: "Suggestion: Allow uploads to the site" https://bugs.launchpad.net/widelands-website/+bug/964452 Bug #1833658 in Widelands Website: "Create a possibility to upload tournament replay" https://bugs.launchpad.net/widelands-website/+bug/1833658 For more details, see: https://code.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/+merge/370342 Made attachments python3 compatible: https://bazaar.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/revision/545 Set allowed file size to 5 Mb (as we have for nginx) Delete attachment when deleting a post: https://bazaar.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/revision/548 Added template for showing attachments. Style tweaks, example: https://bugs.launchpad.net/widelands-website/+bug/964452/+attachment/5277903/+files/attachments_1.png Autoreload css for the users if this got merged, so the users don't have to hit CTRL+F5 I'll do some explanations in the wiki and announce this change. Probably with the option to remove it again if we get too many problematic attachments. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website. === modified file 'mainpage/settings.py' --- mainpage/settings.py 2019-04-11 16:11:21 + +++ mainpage/settings.py 2019-07-18 20:25:31 + @@ -191,7 +191,8 @@ # Pybb Configuration # ## # See also pybb defaults in pybb.settings.py -PYBB_ATTACHMENT_ENABLE = False # disable gzip middleware when enabling attachments +PYBB_ATTACHMENT_ENABLE = True +PYBB_ATTACHMENT_SIZE_LIMIT = 1024*1024*5 #5MB PYBB_DEFAULT_MARKUP = 'markdown' INTERNAL_PERM='pybb.can_access_internal' # The permission string derived from pybb.models.category === modified file 'pybb/forms.py' --- pybb/forms.py 2019-03-20 21:32:32 + +++ pybb/forms.py 2019-07-18 20:25:31 + @@ -1,6 +1,6 @@ import re from datetime import datetime -import os.path +import os from django import forms from django.conf import settings @@ -69,9 +69,15 @@ name=memfile.name, post=post) dir = os.path.join(settings.MEDIA_ROOT, pybb_settings.ATTACHMENT_UPLOAD_TO) -fname = '%d.0' % post.id +if not os.path.exists(dir): +os.makedirs(dir) + +fname = '{}.0'.format(post.id) path = os.path.join(dir, fname) -file(path, 'w').write(memfile.read()) + +with open(path, 'wb') as f: +f.write(memfile.read()) + obj.path = fname obj.save() === modified file 'pybb/models.py' --- pybb/models.py 2019-04-11 15:20:33 + +++ pybb/models.py 2019-07-18 20:25:31 + @@ -345,6 +345,11 @@ def delete(self, *args, **kwargs): self_id = self.id head_post_id = self.topic.posts.order_by('created')[0].id + +if self.attachments.all(): +for attach in self.attachments.all(): +attach.delete() + super(Post, self).delete(*args, **kwargs) self.topic.save() @@ -398,7 +403,7 @@ super(Attachment, self).save(*args, **kwargs) if not self.hash: self.hash = hashlib.sha1( -str(self.id) + settings.SECRET_KEY).hexdigest() +str(self.id).encode('utf-8') + settings.SECRET_KEY.encode('utf-8')).hexdigest() super(Attachment, self).save(*args, **kwargs) def __str__(self): @@ -407,19 +412,13 @@ def get_absolute_url(self): return reverse('pybb_attachment', args=[self.hash]) -def size_display(self): -size = self.size -if size < 1024: -return '%b' % size -elif size < 1024 * 1024: -return '%dKb' % int(size / 1024) -else: -return '%.2fMb' % (size / float(1024 * 1024)) - def get_absolute_path(self): return os.path.join(settings.MEDIA_ROOT, pybb_settings.ATTACHMENT_UPLOAD_TO, self.path) +def delete(self, *args, **kwargs): +os.remove(self.get_absolute_path()) +super(Attachment, self).delete(*args, **kwargs) if notification is not None: signals.post_save.connect(notification.handle_observations, sender=Post) === modified file 'pybb/static/css/forum.css' --- pybb/static/css/forum.css 2019-02-28 16:09:16 + +++ pybb/static/css/forum.css 2019-07-18 20:25:31 + @@ -132,6 +132,10 @@ border: 1px solid #47; } +.attachment { + display: inline-block +} + /*/ /* Edit/add Post */ /* related */ === modified file 'pybb/templates/pybb/base.html' --- pybb/t
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug_1836107_lGL into lp:widelands
Continuous integration builds have changed state: Travis build 5272. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/560611605. Appveyor build 5048. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1836107_lGL-5048. -- https://code.launchpad.net/~widelands-dev/widelands/bug_1836107_lGL/+merge/370334 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug_1836107_lGL into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp