Skip to content

Commit

Permalink
XEEN: Fixes for initializing blacksmith wares
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Nov 23, 2017
1 parent 6f3e8ed commit 48a1f37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
15 changes: 5 additions & 10 deletions engines/xeen/character.cpp
Expand Up @@ -1666,20 +1666,15 @@ int Character::makeItem(int p1, int itemIndex, int p3) {
rval = vm->getRandomNumber(1, 100);
if (rval <= 25) {
mult = 0;
}
else if (rval <= 45) {
} else if (rval <= 45) {
mult = 1;
}
else if (rval <= 60) {
} else if (rval <= 60) {
mult = 2;
}
else if (rval <= 75) {
} else if (rval <= 75) {
mult = 3;
}
else if (rval <= 95) {
} else if (rval <= 95) {
mult = 4;
}
else {
} else {
mult = 5;
}

Expand Down
18 changes: 9 additions & 9 deletions engines/xeen/party.cpp
Expand Up @@ -1436,35 +1436,35 @@ void Party::resetBlacksmithWares() {

for (int idx2 = 0; idx2 < 4; ++idx2) {
for (int idx3 = 0; idx3 < BLACKSMITH_DATA1[idx2][idx1]; ++idx3) {
int itemCat = c.makeItem(idx2, 0, 0);
int itemCat = c.makeItem(idx2 + 1, 0, 0);
if (catCount[itemCat] < 8) {
switch (itemCat) {
case 0: {
XeenItem &item = _blacksmithWeapons[0][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithWeapons[0][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 1: {
XeenItem &item = _blacksmithArmor[0][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithArmor[0][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 2: {
XeenItem &item = _blacksmithAccessories[0][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithAccessories[0][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 3: {
XeenItem &item = _blacksmithMisc[0][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithMisc[0][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
Expand All @@ -1490,31 +1490,31 @@ void Party::resetBlacksmithWares() {
if (catCount[itemCat] < 8) {
switch (itemCat) {
case 0: {
XeenItem &item = _blacksmithWeapons[1][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithWeapons[1][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 1: {
XeenItem &item = _blacksmithArmor[1][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithArmor[1][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 2: {
XeenItem &item = _blacksmithAccessories[1][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithAccessories[1][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
break;
}

case 3: {
XeenItem &item = _blacksmithMisc[1][idx2 * 4 + catCount[itemCat]];
XeenItem &item = _blacksmithMisc[1][catCount[itemCat] * 4 + idx1];
item._id = c._weapons[0]._id;
item._material = c._weapons[0]._material;
item._bonusFlags = c._weapons[0]._bonusFlags;
Expand Down

0 comments on commit 48a1f37

Please sign in to comment.