netrunner icon indicating copy to clipboard operation
netrunner copied to clipboard

Servers merging

Open nealterrell opened this issue 11 years ago • 3 comments

This is related to #156, but with reproducible steps and a theory on why.

  1. Install an asset/agenda into Server 0 (call this Asset0).
  2. Install an asset/agenda into Server 1 (call this Asset1).
  3. Install an ice into Server 1 (optional, helps visualize the bug).
  4. Install an asset/agenda into Server 0 (call this Asset2).

Expected: Asset2 replaces Asset0 in Server 0. Server 1 has Asset1 and ice.

Actual: Server 1 is no more. Asset1, ice, and Asset2 are now all in Server 0.

Why: I believe this happens because of the following logic flow:

  • Corp chooses to install Asset2 in Server 0.
  • corp-install checks to see if an asset/agenda is already in server 0, sees that there is, calls (trash) to get rid of it.
  • trash calls move. Asset0 gets moved to Archives. move checks to see if Asset0 was in a remote, and if that remote has no content and no ice. Because this is true, the remote is removed from [:corp :servers :remote].
  • Because remotes are numbered implicitly by their position in [:corp :servers :remote], Server 1 is now Server 0 by virtue of being first in the list.
  • corp-install resumes its command to install Asset2 in Server 0, unaware that the old Server 0 is gone and Server 1 is now Server 0. Asset2 is installed into Server 0 :content, blissfully unaware that something has gone horribly wrong.

nealterrell avatar Jul 18 '15 17:07 nealterrell

Interesting. If no one is already working on this, I'll try to fix it this evening.

queueseven avatar Jul 18 '15 17:07 queueseven

Go for it. The easiest solution might be to just wait to trash the old asset until after the new one moved to the server. That will technically trigger events in the wrong order though... it will trigger :corp-install before :trash when according to game rules it should go the other way. Not that I know of any interactions where that would matter... hmm...

nealterrell avatar Jul 18 '15 17:07 nealterrell

I had the same idea, and the same worry (don't want to move the bug to the future when a card comes out where it actually does matter).

Ideally Servers would not be numbered implicitly IMHO, but I guess that would requiere a lot of code changes (but I'll have to take a look first).

I'll have to look at the source first to decide what would be the best approach.

queueseven avatar Jul 18 '15 18:07 queueseven