v1, getItemPlayerProps other stuff that looks like errors to me

This code really makes me doubt I understand C.

case 6: // glove1 case 16: // glove2 { CString playerProp = player->GetPlayerProp(PLPROP_GLOVEPOWER); char glovePower = playerProp.readGChar(); if (itemID == 17) glovePower = 3; else glovePower = (glovePower < 2 ? 2 : glovePower); return CString() >> (char)PLPROP_GLOVEPOWER >> (char)glovePower;That should be if (itemID == 16) I think

case 9: // shield case 15: // mirrorshield case 17: // lizardshield { CString playerProp = player->GetPlayerProp(PLPROP_SHIELDPOWER); char shieldPower = playerProp.readGChar(); if (itemID == 18) shieldPower = 3; else if (itemID == 16) shieldPower = (shieldPower < 2 ? 2 : shieldPower); else shieldPower = (shieldPower < 1 ? 1 : shieldPower); return CString() >> (char)PLPROP_SHIELDPOWER >> (char)shieldPower; } How could it be 16 or 18? We enter in this code only for 9.15, 17 I think.

case 10: // sword case 13: // battleaxe case 18: // lizardsword case 14: // goldensword { CString playerProp = player->GetPlayerProp(PLPROP_SWORDPOWER); char swordPower = playerProp.readGChar(); if (itemID == 15) swordPower = 4; else if (itemID == 19) swordPower = (swordPower < 3 ? 3 : swordPower); else if (itemID == 14) swordPower = (swordPower < 2 ? 2 : swordPower); else swordPower = (swordPower < 1 ? 1 : swordPower); return CString() >> (char)PLPROP_SWORDPOWER >> (char)swordPower; } Same problem when testing for ==15 or ==19

I think you’re onto something here, things is it doesn’t seem to have any kind of impact on the player anyway as far as i’m able to deduce from a few quick tests.

Yeah, I noticed this when I was looking through the source code earlier. I thought maybe I was just stupid and didn’t understand it.

Looking at what was posted it seems wrong, i’ll have to look at the svn to see what’s up with it. I’ll check tomorrow

Looking at TLevelItem.cpp, I think you can stack case: statements. I never thought that would work but it must since ruppes work fine lol

		case 0:		// greenrupee
		case 1:		// bluerupee
		case 2:		// redrupee
		case 19:	// goldrupee
		{
			CString playerProp = player->getProp(PLPROP_RUPEESCOUNT);
			int rupeeCount = playerProp.readGInt();
			if (itemID == 19) rupeeCount += 100;
			else if (itemID == 2) rupeeCount += 30;
			else if (itemID == 1) rupeeCount += 5;
			else rupeeCount += 1;
			rupeeCount = clip(rupeeCount, 0, 9999999);
			return CString() >> (char)PLPROP_RUPEESCOUNT >> (int)rupeeCount;
		}

yes if you don’t break or return in a case statement it will go on to the next one as well.

Duff device

http://en.wikipedia.org/wiki/Duff’s_device
BTW: As far as I know, my original post is still valid, this is indeed a bug, not an optimization in this case.

I forgot the question mark. Is this the code to create gs1?

Edit: no