I6: Two short swords (currently equipped)

Long story short, I’ve got some weapons, right? I have it set up so that the player can equip/unequip them, and only have one equipped at a time. This all worked well, and I ironed out all the bugs in only a few hours, until yesterday I decided to implement two indistinguishable swords. Now this happens:

Obviously, only one of the swords is actually equipped. I just don’t know how to make the game break the two swords up into two seperate objects, one (currently equipped) and one not. The code relevent to the weapon class is below:

Class	Weapon
  with	name
	  'weapon',
	list_together WEAPON_GROUP,
	invent [;
	  if (inventory_stage == 2) {
	    if (self has equipped) print " (currently equipped)";
	  }
	],
	each_turn [;
	  if (CurrentWeapon ~= self) give self ~equipped;
	  if (self has equipped) CurrentWeapon = self;
	  StartDaemon(self);
	],
	before [;
	  Equip:      
	  if (self hasnt equipped) {
	    if ((CurrentWeapon ~= 0) && (CurrentWeapon ~= self)) {
	      print "(first unequipping "; print (the) CurrentWeapon; print ")^";
	      give self equipped;
	      CurrentWeapon = self;
	    }
	    else {
	      give self equipped;
	      CurrentWeapon = self;
	    }
	    print
	    "I equip "; print (the) self; print ".^"; return true;
	  }
	  else {
	    print
	    (The) self; print " is already equipped.^"; return true;
	  }
	],
	after [;
	  Drop:
	  if (self has equipped) {
	    give self ~equipped;
	    CurrentWeapon = 0;
	    print
	    "(first unequipping "; print (the) self; print ")^";
	  }
	];

(Note: the rules for unequipping are in the Unequip subroutine, but I didn’t think it’d be necessary to include those.) And here’s the class definition for the swords:

Class	ShortSword
  class Weapon,
  with  name
	  'short' 'sword' 'swords//p',
	short_name "short sword",
	plural "short swords",
	description
	  "A pretty average short-sword, showing a few signs of wear and tear. They roll thousands of these things out every year for use by royal guards, soldiers,
	  mercenaries, and the like.",
   has  sharp_weapon;

So yeah, help with this would be quite appreciated.

It’s because of the list_together.

If the swords were worn or lit, the list-writer would not consider them indistinguishable. The routine that checks for this is ListEqual (in the verblibm.h library); it looks as if you could easily make it check for the equipped property as well.

[ ListEqual o1 o2;
    if (child(o1) ~= 0 && WillRecurs(o1) ~= 0) rfalse;
    if (child(o2) ~= 0 && WillRecurs(o2) ~= 0) rfalse;
    if (c_style & (FULLINV_BIT + PARTINV_BIT) ~= 0) {
        if ((o1 hasnt worn && o2 has worn) || (o2 hasnt worn && o1 has worn)) rfalse;
        if ((o1 hasnt light && o2 has light) || (o2 hasnt light && o1 has light)) rfalse;
!#        if ((o1 hasnt equipped && o2 has equipped) || (o2 hasnt equipped && o1 has equipped)) rfalse; !#
        if (o1 has container) {
            if (o2 hasnt container) rfalse;
            if ((o1 has open && o2 hasnt open) || (o2 has open && o1 hasnt open))
                rfalse;
        }
        else if (o2 has container)
            rfalse;
    }
    return Identical(o1, o2);
];

Ahh, worked like a charm! Thank you!