Author Topic: [BUG][PLAYER] Style Manager -> Update All -> Error: Division by 0  (Read 1907 times)

0 Members and 1 Guest are viewing this topic.

Online Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
NeoLemmix 12.4.4 in Wine 7.15 on x86_64 Arch Linux.

1. I had NL 12.4.4 already set up, it wasn't a fresh installation.
2. I put Armani's pack Lemmings Uncharted inside NL.
3. I played some levels from Lemmings Uncharted, having NL download missing tiles successfully per level.

Then:

4. Run NeoLemmix (or have it already running).
5. In the main menu, click Settings.
6. In the settings dialog, click Style Manager.
7. Optional: In the style manager, click one of the styles to select.
8. Click Update All.

We get an error box: "Division by zero."

9. Click OK (the only button) on that error box.

Now, Download Selected and Update All are greyed out in the style manager. I can only click Cancel. I have not received any new styles that I didn't have in the list before.

See attached video for a demo of this.



Expected instead: The goal of the whole operation was to avoid getting the prompt to download missing tiles before every level. NL should fetch all styles from namida's central style collection, or at least everything from that collection that I need for my installed packs.

I have no idea what exactly you want to happen on Update All.

Per-level style download works fine. When I preview a level with missing tiles, NL offers me to downloads missing tiles from the net. When I accept, NL downloads the tiles, then reloads the map. Now, I see the map with all intended tiles correctly.

Fresh installation: The bug doesn't reproduce (or is different?) on a fresh extract of NL 12.4.4 from the big download button on neolemmix.com: Here, when I attempt step 8 in the repro above, I can't click Update All because it's greyed out. All lines (one line per style) are already green in the style manager. But I don't seem to have every style yet in a fresh installation.

I don't see how I can download all styles on a fresh NL installation. What is the intended way to download all styles (from your central style collection) in one shot?

-- Simon
« Last Edit: October 04, 2022, 08:02:11 AM by Simon »

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] Style Manager -> Update All -> Error: Division by 0
« Reply #1 on: October 15, 2022, 09:08:36 AM »
"Update All" updates all styles that you have installed, but are out-of-date (ie: newer versions exist on the server).

There isn't directly an in-game way to download all styles at once, but the key word here is "directly". The style manager does allow downloading multiple styles at once (via the typical ctrl-click / shift-click methods), and thus you can select all styles you don't already have and hit "download". Adding a "download all" button is trivial enough to implement and useful enough that I'll likely implement one despite the "no new features" thing.

Would have to investigate the divide by zero to answer what's happening there.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Online Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Re: [BUG][PLAYER] Style Manager -> Update All -> Error: Division by 0
« Reply #2 on: October 15, 2022, 10:46:09 AM »
Right, downloading all styles from the server at once sounds useful.

I imagine that would also update outdated styles, which would be good. I imagine that would also download styles that I don't need for the currently installed packs; I'm more neutral on this, but it still sounds more hassle-free* than downloading only what's needed for the currently installed packs.

*hassle-free for all three of developer, player, and level author.

To debug the division by zero: I've zipped and uploaded the entire NL 12.4.4 installation (48 MB). I'll leave this on my webserver until January 2024 (in more than 1 year). Alternatively, we can meet on Quakenet #lix or Mumble, and remote-debug on my machine.

-- Simon

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] Style Manager -> Update All -> Error: Division by 0
« Reply #3 on: November 02, 2022, 09:52:51 PM »
I've made a couple of changes to address both of these matters in commit df666ca:

1. Fixed the "divide by zero" errors. The "last line of defence" here is that when the download routine begins, if there are no styles in the "to download" list, it will display a "Please select one or more styles" message. Some specific cases have more specific messages - eg. hitting "update all" when no updates are available. I can't be sure I've covered every possible specific case, but a generic error message with a clean recovery is better than a crash. (For the record, the reason this was happening is that when the user tries to run a download operation - be it downloading selected styles, or "Update All" - but there are no styles eligible to download, perhaps due to clicking Update All when no relevant updates are available; NeoLemmix tries to iterate through an empty list of styles to download. This mostly would work fine with a result of simply doing nothing other than disabling then re-enabling the download buttons, except that it divides by zero - the length of the list - when calculating how far along the progress bar should be.)

2. Added a "Download All" button. Clicking this button will install all styles that the user does not currently have installed, as well as update all styles that the user has installed via the style manager - it will NOT attempt to update manually-installed styles, nor redownload styles that are already up-to-date.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)