aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-11-23 11:47:02 -0500
committerPaul Gilbert2017-11-23 11:47:02 -0500
commit48a1f3786991f94d98a7f2690eb99172518269df (patch)
tree85066b4ec456b42e89e208320d38cd725fa48edd
parent6f3e8ed396078ff40eafbf1cbc94e5f33d87c0ad (diff)
downloadscummvm-rg350-48a1f3786991f94d98a7f2690eb99172518269df.tar.gz
scummvm-rg350-48a1f3786991f94d98a7f2690eb99172518269df.tar.bz2
scummvm-rg350-48a1f3786991f94d98a7f2690eb99172518269df.zip
XEEN: Fixes for initializing blacksmith wares
-rw-r--r--engines/xeen/character.cpp15
-rw-r--r--engines/xeen/party.cpp18
2 files changed, 14 insertions, 19 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index def830e2a1..0114b0a131 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -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;
}
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 15e7b5fda6..45b85f20f8 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -1436,11 +1436,11 @@ 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;
@@ -1448,7 +1448,7 @@ void Party::resetBlacksmithWares() {
}
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;
@@ -1456,7 +1456,7 @@ void Party::resetBlacksmithWares() {
}
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;
@@ -1464,7 +1464,7 @@ void Party::resetBlacksmithWares() {
}
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;
@@ -1490,7 +1490,7 @@ 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;
@@ -1498,7 +1498,7 @@ void Party::resetBlacksmithWares() {
}
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;
@@ -1506,7 +1506,7 @@ void Party::resetBlacksmithWares() {
}
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;
@@ -1514,7 +1514,7 @@ void Party::resetBlacksmithWares() {
}
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;