mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Fixed charge checks for light and other objects, corrected CellRef charge union comments
This commit is contained in:
parent
9628415e21
commit
3b7a23aa72
@ -36,21 +36,14 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
|
||||
} else {
|
||||
// Check if reference charge is valid for it's proper referenced type
|
||||
CSMWorld::RefIdData::LocalIndex localIndex = mDataSet.searchId(cellRef.mRefID);
|
||||
if (localIndex.second == CSMWorld::UniversalId::Type_Armor ||
|
||||
localIndex.second == CSMWorld::UniversalId::Type_Weapon) {
|
||||
if (cellRef.mChargeFloat < 0) {
|
||||
std::string str = " has negative durability ";
|
||||
bool isLight = localIndex.second == CSMWorld::UniversalId::Type_Light;
|
||||
if ((isLight && cellRef.mChargeFloat < -1) || (!isLight && cellRef.mChargeInt < -1)) {
|
||||
std::string str = " has invalid charge ";
|
||||
if (localIndex.second == CSMWorld::UniversalId::Type_Light)
|
||||
str += boost::lexical_cast<std::string>(cellRef.mChargeFloat);
|
||||
messages.push_back(std::make_pair(id, id.getId() + str));
|
||||
}
|
||||
} else if (localIndex.second == CSMWorld::UniversalId::Type_Lockpick ||
|
||||
localIndex.second == CSMWorld::UniversalId::Type_Probe ||
|
||||
localIndex.second == CSMWorld::UniversalId::Type_Repair) {
|
||||
if (cellRef.mChargeInt < -1) {
|
||||
std::string str = " has invalid charges ";
|
||||
else
|
||||
str += boost::lexical_cast<std::string>(cellRef.mChargeInt);
|
||||
messages.push_back(std::make_pair(id, id.getId() + str));
|
||||
}
|
||||
messages.push_back(std::make_pair(id, id.getId() + str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,10 +59,12 @@ namespace ESM
|
||||
|
||||
// For weapon or armor, this is the remaining item health.
|
||||
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
||||
// For lights it is remaining time.
|
||||
// This could be -1 if the charge was not touched yet (i.e. full).
|
||||
union
|
||||
{
|
||||
int mChargeInt;
|
||||
float mChargeFloat;
|
||||
int mChargeInt; // Used by everything except lights
|
||||
float mChargeFloat; // Used only by lights
|
||||
};
|
||||
|
||||
// Remaining enchantment charge. This could be -1 if the charge was not touched yet (i.e. full).
|
||||
|
Loading…
Reference in New Issue
Block a user