mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-14 14:56:36 +00:00
Fix and enforce local variable naming
This commit is contained in:
parent
c71448359b
commit
d121b606b6
122 changed files with 828 additions and 801 deletions
|
@ -18,3 +18,5 @@ CheckOptions:
|
||||||
value: CamelCase
|
value: CamelCase
|
||||||
- key: readability-identifier-naming.NamespaceIgnoredRegexp
|
- key: readability-identifier-naming.NamespaceIgnoredRegexp
|
||||||
value: 'bpo|osg(DB|FX|Particle|Shadow|Viewer|Util)?'
|
value: 'bpo|osg(DB|FX|Particle|Shadow|Viewer|Util)?'
|
||||||
|
- key: readability-identifier-naming.LocalVariableCase
|
||||||
|
value: camelBack
|
||||||
|
|
|
@ -409,6 +409,7 @@ Ubuntu_Clang:
|
||||||
- mkdir -pv "${CCACHE_DIR}"
|
- mkdir -pv "${CCACHE_DIR}"
|
||||||
- ccache -z -M "${CCACHE_SIZE}"
|
- ccache -z -M "${CCACHE_SIZE}"
|
||||||
- CI/before_script.linux.sh
|
- CI/before_script.linux.sh
|
||||||
|
- cp extern/.clang-tidy build/.clang-tidy
|
||||||
- cd build
|
- cd build
|
||||||
- find . -name *.o -exec touch {} \;
|
- find . -name *.o -exec touch {} \;
|
||||||
- cmake --build . -- -j $(nproc) ${BUILD_TARGETS}
|
- cmake --build . -- -j $(nproc) ${BUILD_TARGETS}
|
||||||
|
|
|
@ -75,8 +75,8 @@ Allowed options)");
|
||||||
bpo::variables_map variables;
|
bpo::variables_map variables;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).options(all).positional(p).run();
|
bpo::parsed_options validOpts = bpo::command_line_parser(argc, argv).options(all).positional(p).run();
|
||||||
bpo::store(valid_opts, variables);
|
bpo::store(validOpts, variables);
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -285,17 +285,17 @@ CUSTOM: customdata.lua
|
||||||
EXPECT_TRUE(scripts.addCustomScript(getId(test2Path)));
|
EXPECT_TRUE(scripts.addCustomScript(getId(test2Path)));
|
||||||
|
|
||||||
sol::state_view sol = mLua.unsafeState();
|
sol::state_view sol = mLua.unsafeState();
|
||||||
std::string X0 = LuaUtil::serialize(sol.create_table_with("x", 0.5));
|
std::string x0 = LuaUtil::serialize(sol.create_table_with("x", 0.5));
|
||||||
std::string X1 = LuaUtil::serialize(sol.create_table_with("x", 1.5));
|
std::string x1 = LuaUtil::serialize(sol.create_table_with("x", 1.5));
|
||||||
|
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.receiveEvent("SomeEvent", X1);
|
scripts.receiveEvent("SomeEvent", x1);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(), "");
|
EXPECT_EQ(internal::GetCapturedStdout(), "");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.receiveEvent("Event1", X1);
|
scripts.receiveEvent("Event1", x1);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test2.lua]:\t event1 1.5\n"
|
"Test[test2.lua]:\t event1 1.5\n"
|
||||||
"Test[stopevent.lua]:\t event1 1.5\n"
|
"Test[stopevent.lua]:\t event1 1.5\n"
|
||||||
|
@ -303,21 +303,21 @@ CUSTOM: customdata.lua
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.receiveEvent("Event2", X1);
|
scripts.receiveEvent("Event2", x1);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test2.lua]:\t event2 1.5\n"
|
"Test[test2.lua]:\t event2 1.5\n"
|
||||||
"Test[test1.lua]:\t event2 1.5\n");
|
"Test[test1.lua]:\t event2 1.5\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.receiveEvent("Event1", X0);
|
scripts.receiveEvent("Event1", x0);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test2.lua]:\t event1 0.5\n"
|
"Test[test2.lua]:\t event1 0.5\n"
|
||||||
"Test[stopevent.lua]:\t event1 0.5\n");
|
"Test[stopevent.lua]:\t event1 0.5\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.receiveEvent("Event2", X0);
|
scripts.receiveEvent("Event2", x0);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test2.lua]:\t event2 0.5\n"
|
"Test[test2.lua]:\t event2 0.5\n"
|
||||||
"Test[test1.lua]:\t event2 0.5\n");
|
"Test[test1.lua]:\t event2 0.5\n");
|
||||||
|
@ -333,12 +333,12 @@ CUSTOM: customdata.lua
|
||||||
EXPECT_TRUE(scripts.addCustomScript(getId(test2Path)));
|
EXPECT_TRUE(scripts.addCustomScript(getId(test2Path)));
|
||||||
|
|
||||||
sol::state_view sol = mLua.unsafeState();
|
sol::state_view sol = mLua.unsafeState();
|
||||||
std::string X = LuaUtil::serialize(sol.create_table_with("x", 0.5));
|
std::string x = LuaUtil::serialize(sol.create_table_with("x", 0.5));
|
||||||
|
|
||||||
{
|
{
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.update(1.5f);
|
scripts.update(1.5f);
|
||||||
scripts.receiveEvent("Event1", X);
|
scripts.receiveEvent("Event1", x);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test1.lua]:\t update 1.5\n"
|
"Test[test1.lua]:\t update 1.5\n"
|
||||||
"Test[test2.lua]:\t update 1.5\n"
|
"Test[test2.lua]:\t update 1.5\n"
|
||||||
|
@ -352,7 +352,7 @@ CUSTOM: customdata.lua
|
||||||
scripts.removeScript(stopEventScriptId);
|
scripts.removeScript(stopEventScriptId);
|
||||||
EXPECT_FALSE(scripts.hasScript(stopEventScriptId));
|
EXPECT_FALSE(scripts.hasScript(stopEventScriptId));
|
||||||
scripts.update(1.5f);
|
scripts.update(1.5f);
|
||||||
scripts.receiveEvent("Event1", X);
|
scripts.receiveEvent("Event1", x);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test1.lua]:\t update 1.5\n"
|
"Test[test1.lua]:\t update 1.5\n"
|
||||||
"Test[test2.lua]:\t update 1.5\n"
|
"Test[test2.lua]:\t update 1.5\n"
|
||||||
|
@ -363,7 +363,7 @@ CUSTOM: customdata.lua
|
||||||
testing::internal::CaptureStdout();
|
testing::internal::CaptureStdout();
|
||||||
scripts.removeScript(getId(test1Path));
|
scripts.removeScript(getId(test1Path));
|
||||||
scripts.update(1.5f);
|
scripts.update(1.5f);
|
||||||
scripts.receiveEvent("Event1", X);
|
scripts.receiveEvent("Event1", x);
|
||||||
EXPECT_EQ(internal::GetCapturedStdout(),
|
EXPECT_EQ(internal::GetCapturedStdout(),
|
||||||
"Test[test2.lua]:\t update 1.5\n"
|
"Test[test2.lua]:\t update 1.5\n"
|
||||||
"Test[test2.lua]:\t event1 0.5\n");
|
"Test[test2.lua]:\t event1 0.5\n");
|
||||||
|
|
|
@ -171,10 +171,10 @@ namespace
|
||||||
|
|
||||||
std::string serialized = LuaUtil::serialize(table);
|
std::string serialized = LuaUtil::serialize(table);
|
||||||
EXPECT_EQ(serialized.size(), 139);
|
EXPECT_EQ(serialized.size(), 139);
|
||||||
sol::table res_table = LuaUtil::deserialize(lua, serialized);
|
sol::table resTable = LuaUtil::deserialize(lua, serialized);
|
||||||
sol::table res_readonly_table = LuaUtil::deserialize(lua, serialized, nullptr, true);
|
sol::table resReadonlyTable = LuaUtil::deserialize(lua, serialized, nullptr, true);
|
||||||
|
|
||||||
for (auto t : { res_table, res_readonly_table })
|
for (auto t : { resTable, resReadonlyTable })
|
||||||
{
|
{
|
||||||
EXPECT_EQ(t.get<int>("aa"), 1);
|
EXPECT_EQ(t.get<int>("aa"), 1);
|
||||||
EXPECT_EQ(t.get<bool>("ab"), true);
|
EXPECT_EQ(t.get<bool>("ab"), true);
|
||||||
|
@ -185,8 +185,8 @@ namespace
|
||||||
EXPECT_EQ(t.get<osg::Vec2f>(2), osg::Vec2f(2, 1));
|
EXPECT_EQ(t.get<osg::Vec2f>(2), osg::Vec2f(2, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
lua["t"] = res_table;
|
lua["t"] = resTable;
|
||||||
lua["ro_t"] = res_readonly_table;
|
lua["ro_t"] = resReadonlyTable;
|
||||||
EXPECT_NO_THROW(lua.safe_script("t.x = 5"));
|
EXPECT_NO_THROW(lua.safe_script("t.x = 5"));
|
||||||
EXPECT_NO_THROW(lua.safe_script("t.nested.x = 5"));
|
EXPECT_NO_THROW(lua.safe_script("t.nested.x = 5"));
|
||||||
EXPECT_ERROR(lua.safe_script("ro_t.x = 5"), "userdata value");
|
EXPECT_ERROR(lua.safe_script("ro_t.x = 5"), "userdata value");
|
||||||
|
|
|
@ -101,9 +101,9 @@ Allowed options)");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).options(all).positional(p).run();
|
bpo::parsed_options validOpts = bpo::command_line_parser(argc, argv).options(all).positional(p).run();
|
||||||
|
|
||||||
bpo::store(valid_opts, variables);
|
bpo::store(validOpts, variables);
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,81 +60,81 @@ namespace
|
||||||
|
|
||||||
std::string ruleString(const ESM::DialogueCondition& ss)
|
std::string ruleString(const ESM::DialogueCondition& ss)
|
||||||
{
|
{
|
||||||
std::string_view type_str = "INVALID";
|
std::string_view typeStr = "INVALID";
|
||||||
std::string_view func_str;
|
std::string_view funcStr;
|
||||||
|
|
||||||
switch (ss.mFunction)
|
switch (ss.mFunction)
|
||||||
{
|
{
|
||||||
case ESM::DialogueCondition::Function_Global:
|
case ESM::DialogueCondition::Function_Global:
|
||||||
type_str = "Global";
|
typeStr = "Global";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_Local:
|
case ESM::DialogueCondition::Function_Local:
|
||||||
type_str = "Local";
|
typeStr = "Local";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_Journal:
|
case ESM::DialogueCondition::Function_Journal:
|
||||||
type_str = "Journal";
|
typeStr = "Journal";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_Item:
|
case ESM::DialogueCondition::Function_Item:
|
||||||
type_str = "Item count";
|
typeStr = "Item count";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_Dead:
|
case ESM::DialogueCondition::Function_Dead:
|
||||||
type_str = "Dead";
|
typeStr = "Dead";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotId:
|
case ESM::DialogueCondition::Function_NotId:
|
||||||
type_str = "Not ID";
|
typeStr = "Not ID";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotFaction:
|
case ESM::DialogueCondition::Function_NotFaction:
|
||||||
type_str = "Not Faction";
|
typeStr = "Not Faction";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotClass:
|
case ESM::DialogueCondition::Function_NotClass:
|
||||||
type_str = "Not Class";
|
typeStr = "Not Class";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotRace:
|
case ESM::DialogueCondition::Function_NotRace:
|
||||||
type_str = "Not Race";
|
typeStr = "Not Race";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotCell:
|
case ESM::DialogueCondition::Function_NotCell:
|
||||||
type_str = "Not Cell";
|
typeStr = "Not Cell";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Function_NotLocal:
|
case ESM::DialogueCondition::Function_NotLocal:
|
||||||
type_str = "Not Local";
|
typeStr = "Not Local";
|
||||||
func_str = ss.mVariable;
|
funcStr = ss.mVariable;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
type_str = "Function";
|
typeStr = "Function";
|
||||||
func_str = ruleFunction(ss.mFunction);
|
funcStr = ruleFunction(ss.mFunction);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view oper_str = "??";
|
std::string_view operStr = "??";
|
||||||
switch (ss.mComparison)
|
switch (ss.mComparison)
|
||||||
{
|
{
|
||||||
case ESM::DialogueCondition::Comp_Eq:
|
case ESM::DialogueCondition::Comp_Eq:
|
||||||
oper_str = "==";
|
operStr = "==";
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Comp_Ne:
|
case ESM::DialogueCondition::Comp_Ne:
|
||||||
oper_str = "!=";
|
operStr = "!=";
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Comp_Gt:
|
case ESM::DialogueCondition::Comp_Gt:
|
||||||
oper_str = "> ";
|
operStr = "> ";
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Comp_Ge:
|
case ESM::DialogueCondition::Comp_Ge:
|
||||||
oper_str = ">=";
|
operStr = ">=";
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Comp_Ls:
|
case ESM::DialogueCondition::Comp_Ls:
|
||||||
oper_str = "< ";
|
operStr = "< ";
|
||||||
break;
|
break;
|
||||||
case ESM::DialogueCondition::Comp_Le:
|
case ESM::DialogueCondition::Comp_Le:
|
||||||
oper_str = "<=";
|
operStr = "<=";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -143,8 +143,7 @@ namespace
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
std::visit([&](auto value) { stream << value; }, ss.mValue);
|
std::visit([&](auto value) { stream << value; }, ss.mValue);
|
||||||
|
|
||||||
std::string result
|
std::string result = Misc::StringUtils::format("%-12s %-32s %2s %s", typeStr, funcStr, operStr, stream.str());
|
||||||
= Misc::StringUtils::format("%-12s %-32s %2s %s", type_str, func_str, oper_str, stream.str());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,14 +181,14 @@ namespace ESSImport
|
||||||
public:
|
public:
|
||||||
void read(ESM::ESMReader& esm) override
|
void read(ESM::ESMReader& esm) override
|
||||||
{
|
{
|
||||||
ESM::Class class_;
|
ESM::Class classRecord;
|
||||||
bool isDeleted = false;
|
bool isDeleted = false;
|
||||||
|
|
||||||
class_.load(esm, isDeleted);
|
classRecord.load(esm, isDeleted);
|
||||||
if (class_.mId == "NEWCLASSID_CHARGEN")
|
if (classRecord.mId == "NEWCLASSID_CHARGEN")
|
||||||
mContext->mCustomPlayerClassName = class_.mName;
|
mContext->mCustomPlayerClassName = classRecord.mName;
|
||||||
|
|
||||||
mRecords[class_.mId] = class_;
|
mRecords[classRecord.mId] = classRecord;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
bpo::options_description desc(R"(Syntax: openmw-essimporter <options> infile.ess outfile.omwsave
|
bpo::options_description desc(R"(Syntax: openmw-essimporter <options> infile.ess outfile.omwsave
|
||||||
Allowed options)");
|
Allowed options)");
|
||||||
bpo::positional_options_description p_desc;
|
bpo::positional_options_description positionalDesc;
|
||||||
auto addOption = desc.add_options();
|
auto addOption = desc.add_options();
|
||||||
addOption("help,h", "produce help message");
|
addOption("help,h", "produce help message");
|
||||||
addOption("mwsave,m", bpo::value<Files::MaybeQuotedPath>(), "morrowind .ess save file");
|
addOption("mwsave,m", bpo::value<Files::MaybeQuotedPath>(), "morrowind .ess save file");
|
||||||
|
@ -23,12 +23,13 @@ Allowed options)");
|
||||||
addOption("compare,c", "compare two .ess files");
|
addOption("compare,c", "compare two .ess files");
|
||||||
addOption("encoding", boost::program_options::value<std::string>()->default_value("win1252"),
|
addOption("encoding", boost::program_options::value<std::string>()->default_value("win1252"),
|
||||||
"encoding of the save file");
|
"encoding of the save file");
|
||||||
p_desc.add("mwsave", 1).add("output", 1);
|
positionalDesc.add("mwsave", 1).add("output", 1);
|
||||||
Files::ConfigurationManager::addCommonOptions(desc);
|
Files::ConfigurationManager::addCommonOptions(desc);
|
||||||
|
|
||||||
bpo::variables_map variables;
|
bpo::variables_map variables;
|
||||||
|
|
||||||
bpo::parsed_options parsed = bpo::command_line_parser(argc, argv).options(desc).positional(p_desc).run();
|
bpo::parsed_options parsed
|
||||||
|
= bpo::command_line_parser(argc, argv).options(desc).positional(positionalDesc).run();
|
||||||
bpo::store(parsed, variables);
|
bpo::store(parsed, variables);
|
||||||
|
|
||||||
if (variables.count("help") || !variables.count("mwsave") || !variables.count("output"))
|
if (variables.count("help") || !variables.count("mwsave") || !variables.count("output"))
|
||||||
|
|
|
@ -43,10 +43,10 @@ std::vector<std::string> Launcher::enumerateOpenALDevicesHrtf()
|
||||||
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
||||||
void* funcPtr = alcGetProcAddress(device, "alcGetStringiSOFT");
|
void* funcPtr = alcGetProcAddress(device, "alcGetStringiSOFT");
|
||||||
memcpy(&alcGetStringiSOFT, &funcPtr, sizeof(funcPtr));
|
memcpy(&alcGetStringiSOFT, &funcPtr, sizeof(funcPtr));
|
||||||
ALCint num_hrtf;
|
ALCint numHrtf;
|
||||||
alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtf);
|
alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &numHrtf);
|
||||||
ret.reserve(num_hrtf);
|
ret.reserve(numHrtf);
|
||||||
for (ALCint i = 0; i < num_hrtf; ++i)
|
for (ALCint i = 0; i < numHrtf; ++i)
|
||||||
{
|
{
|
||||||
const ALCchar* entry = alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
|
const ALCchar* entry = alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
|
||||||
if (strcmp(entry, "") == 0)
|
if (strcmp(entry, "") == 0)
|
||||||
|
|
|
@ -326,10 +326,10 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::filesystem::pat
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int comment_pos = static_cast<int>(utf8.find(';'));
|
const std::string::size_type commentPos = utf8.find(';');
|
||||||
if (comment_pos > 0)
|
if (commentPos != std::string::npos)
|
||||||
{
|
{
|
||||||
utf8 = utf8.substr(0, comment_pos);
|
utf8 = utf8.substr(0, commentPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = static_cast<int>(utf8.find('='));
|
int pos = static_cast<int>(utf8.find('='));
|
||||||
|
|
|
@ -62,7 +62,7 @@ int wmain(int argc, wchar_t* wargv[])
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bpo::options_description desc("Syntax: openmw-iniimporter <options> inifile configfile\nAllowed options");
|
bpo::options_description desc("Syntax: openmw-iniimporter <options> inifile configfile\nAllowed options");
|
||||||
bpo::positional_options_description p_desc;
|
bpo::positional_options_description positionalDesc;
|
||||||
auto addOption = desc.add_options();
|
auto addOption = desc.add_options();
|
||||||
addOption("help,h", "produce help message");
|
addOption("help,h", "produce help message");
|
||||||
addOption("verbose,v", "verbose output");
|
addOption("verbose,v", "verbose output");
|
||||||
|
@ -79,11 +79,12 @@ int wmain(int argc, wchar_t* wargv[])
|
||||||
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
|
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
|
||||||
"\n\twin1252 - Western European (Latin) alphabet, used by default");
|
"\n\twin1252 - Western European (Latin) alphabet, used by default");
|
||||||
;
|
;
|
||||||
p_desc.add("ini", 1).add("cfg", 1);
|
positionalDesc.add("ini", 1).add("cfg", 1);
|
||||||
|
|
||||||
bpo::variables_map vm;
|
bpo::variables_map vm;
|
||||||
|
|
||||||
bpo::parsed_options parsed = bpo::command_line_parser(argc, argv).options(desc).positional(p_desc).run();
|
bpo::parsed_options parsed
|
||||||
|
= bpo::command_line_parser(argc, argv).options(desc).positional(positionalDesc).run();
|
||||||
bpo::store(parsed, vm);
|
bpo::store(parsed, vm);
|
||||||
|
|
||||||
if (vm.count("help") || !vm.count("ini") || !vm.count("cfg"))
|
if (vm.count("help") || !vm.count("ini") || !vm.count("cfg"))
|
||||||
|
|
|
@ -235,8 +235,8 @@ Allowed options)");
|
||||||
bpo::variables_map variables;
|
bpo::variables_map variables;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).options(desc).positional(p).run();
|
bpo::parsed_options validOpts = bpo::command_line_parser(argc, argv).options(desc).positional(p).run();
|
||||||
bpo::store(valid_opts, variables);
|
bpo::store(validOpts, variables);
|
||||||
bpo::notify(variables);
|
bpo::notify(variables);
|
||||||
if (variables.count("help"))
|
if (variables.count("help"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,9 +95,9 @@ namespace CSMPrefs
|
||||||
bool ModifierSetting::handleEvent(QObject* target, int mod, int value)
|
bool ModifierSetting::handleEvent(QObject* target, int mod, int value)
|
||||||
{
|
{
|
||||||
// For potential future exceptions
|
// For potential future exceptions
|
||||||
const int Blacklist[] = { 0 };
|
const int blacklist[] = { 0 };
|
||||||
|
|
||||||
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
const size_t blacklistSize = std::size(blacklist);
|
||||||
|
|
||||||
if (!mEditorActive)
|
if (!mEditorActive)
|
||||||
{
|
{
|
||||||
|
@ -114,9 +114,9 @@ namespace CSMPrefs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle blacklist
|
// Handle blacklist
|
||||||
for (size_t i = 0; i < BlacklistSize; ++i)
|
for (size_t i = 0; i < blacklistSize; ++i)
|
||||||
{
|
{
|
||||||
if (value == Blacklist[i])
|
if (value == blacklist[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace CSMPrefs
|
||||||
|
|
||||||
void ShortcutManager::convertFromString(std::string_view data, QKeySequence& sequence) const
|
void ShortcutManager::convertFromString(std::string_view data, QKeySequence& sequence) const
|
||||||
{
|
{
|
||||||
const int MaxKeys = 4; // A limitation of QKeySequence
|
const int maxKeys = 4; // A limitation of QKeySequence
|
||||||
|
|
||||||
size_t end = data.find(';');
|
size_t end = data.find(';');
|
||||||
size_t size = std::min(end, data.size());
|
size_t size = std::min(end, data.size());
|
||||||
|
@ -185,7 +185,7 @@ namespace CSMPrefs
|
||||||
int keyPos = 0;
|
int keyPos = 0;
|
||||||
int mods = 0;
|
int mods = 0;
|
||||||
|
|
||||||
int keys[MaxKeys] = {};
|
int keys[maxKeys] = {};
|
||||||
|
|
||||||
while (start < value.size())
|
while (start < value.size())
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,7 @@ namespace CSMPrefs
|
||||||
mods = 0;
|
mods = 0;
|
||||||
keyPos += 1;
|
keyPos += 1;
|
||||||
|
|
||||||
if (keyPos >= MaxKeys)
|
if (keyPos >= maxKeys)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,14 +286,14 @@ namespace CSMPrefs
|
||||||
|
|
||||||
QString ShortcutManager::processToolTip(const QString& toolTip) const
|
QString ShortcutManager::processToolTip(const QString& toolTip) const
|
||||||
{
|
{
|
||||||
const QChar SequenceStart = '{';
|
const QChar sequenceStart = '{';
|
||||||
const QChar SequenceEnd = '}';
|
const QChar sequenceEnd = '}';
|
||||||
|
|
||||||
QStringList substrings;
|
QStringList substrings;
|
||||||
|
|
||||||
int prevIndex = 0;
|
int prevIndex = 0;
|
||||||
int startIndex = toolTip.indexOf(SequenceStart);
|
int startIndex = toolTip.indexOf(sequenceStart);
|
||||||
int endIndex = (startIndex != -1) ? toolTip.indexOf(SequenceEnd, startIndex) : -1;
|
int endIndex = (startIndex != -1) ? toolTip.indexOf(sequenceEnd, startIndex) : -1;
|
||||||
|
|
||||||
// Process every valid shortcut escape sequence
|
// Process every valid shortcut escape sequence
|
||||||
while (startIndex != -1 && endIndex != -1)
|
while (startIndex != -1 && endIndex != -1)
|
||||||
|
@ -328,8 +328,8 @@ namespace CSMPrefs
|
||||||
prevIndex = endIndex + 1; // '}' character
|
prevIndex = endIndex + 1; // '}' character
|
||||||
}
|
}
|
||||||
|
|
||||||
startIndex = toolTip.indexOf(SequenceStart, endIndex);
|
startIndex = toolTip.indexOf(sequenceStart, endIndex);
|
||||||
endIndex = (startIndex != -1) ? toolTip.indexOf(SequenceEnd, startIndex) : -1;
|
endIndex = (startIndex != -1) ? toolTip.indexOf(sequenceEnd, startIndex) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevIndex < toolTip.size())
|
if (prevIndex < toolTip.size())
|
||||||
|
|
|
@ -118,9 +118,9 @@ namespace CSMPrefs
|
||||||
bool ShortcutSetting::handleEvent(QObject* target, int mod, int value, bool active)
|
bool ShortcutSetting::handleEvent(QObject* target, int mod, int value, bool active)
|
||||||
{
|
{
|
||||||
// Modifiers are handled differently
|
// Modifiers are handled differently
|
||||||
const int Blacklist[] = { Qt::Key_Shift, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Alt, Qt::Key_AltGr };
|
const int blacklist[] = { Qt::Key_Shift, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Alt, Qt::Key_AltGr };
|
||||||
|
|
||||||
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
const size_t blacklistSize = std::size(blacklist);
|
||||||
|
|
||||||
if (!mEditorActive)
|
if (!mEditorActive)
|
||||||
{
|
{
|
||||||
|
@ -137,9 +137,9 @@ namespace CSMPrefs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle blacklist
|
// Handle blacklist
|
||||||
for (size_t i = 0; i < BlacklistSize; ++i)
|
for (size_t i = 0; i < blacklistSize; ++i)
|
||||||
{
|
{
|
||||||
if (value == Blacklist[i])
|
if (value == blacklist[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,23 +37,23 @@ void CSMTools::ClassCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
||||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ESM::Class& class_ = record.get();
|
const ESM::Class& classRecord = record.get();
|
||||||
|
|
||||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Class, class_.mId);
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Class, classRecord.mId);
|
||||||
|
|
||||||
// A class should have a name
|
// A class should have a name
|
||||||
if (class_.mName.empty())
|
if (classRecord.mName.empty())
|
||||||
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
|
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
|
||||||
|
|
||||||
// A playable class should have a description
|
// A playable class should have a description
|
||||||
if (class_.mData.mIsPlayable != 0 && class_.mDescription.empty())
|
if (classRecord.mData.mIsPlayable != 0 && classRecord.mDescription.empty())
|
||||||
messages.add(id, "Description of a playable class is missing", "", CSMDoc::Message::Severity_Warning);
|
messages.add(id, "Description of a playable class is missing", "", CSMDoc::Message::Severity_Warning);
|
||||||
|
|
||||||
// test for invalid attributes
|
// test for invalid attributes
|
||||||
std::map<int, int> attributeCount;
|
std::map<int, int> attributeCount;
|
||||||
for (size_t i = 0; i < class_.mData.mAttribute.size(); ++i)
|
for (size_t i = 0; i < classRecord.mData.mAttribute.size(); ++i)
|
||||||
{
|
{
|
||||||
int attribute = class_.mData.mAttribute[i];
|
int attribute = classRecord.mData.mAttribute[i];
|
||||||
if (attribute == -1)
|
if (attribute == -1)
|
||||||
messages.add(id, "Attribute #" + std::to_string(i) + " is not set", {}, CSMDoc::Message::Severity_Error);
|
messages.add(id, "Attribute #" + std::to_string(i) + " is not set", {}, CSMDoc::Message::Severity_Error);
|
||||||
else
|
else
|
||||||
|
@ -73,7 +73,7 @@ void CSMTools::ClassCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
||||||
// test for non-unique skill
|
// test for non-unique skill
|
||||||
std::map<int, int> skills; // ID, number of occurrences
|
std::map<int, int> skills; // ID, number of occurrences
|
||||||
|
|
||||||
for (const auto& s : class_.mData.mSkills)
|
for (const auto& s : classRecord.mData.mSkills)
|
||||||
for (int skill : s)
|
for (int skill : s)
|
||||||
++skills[skill];
|
++skills[skill];
|
||||||
|
|
||||||
|
|
|
@ -581,12 +581,12 @@ void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(
|
||||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ESM::CreatureLevList& CreatureLevList
|
const ESM::CreatureLevList& creatureLevList
|
||||||
= (dynamic_cast<const CSMWorld::Record<ESM::CreatureLevList>&>(baseRecord)).get();
|
= (dynamic_cast<const CSMWorld::Record<ESM::CreatureLevList>&>(baseRecord)).get();
|
||||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_CreatureLevelledList,
|
// CreatureLevList but Type_CreatureLevelledList :/
|
||||||
CreatureLevList.mId); // CreatureLevList but Type_CreatureLevelledList :/
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_CreatureLevelledList, creatureLevList.mId);
|
||||||
|
|
||||||
listCheck<ESM::CreatureLevList>(CreatureLevList, messages, id.toString());
|
listCheck<ESM::CreatureLevList>(creatureLevList, messages, id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::itemLevelledListCheck(
|
void CSMTools::ReferenceableCheckStage::itemLevelledListCheck(
|
||||||
|
@ -598,10 +598,10 @@ void CSMTools::ReferenceableCheckStage::itemLevelledListCheck(
|
||||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ESM::ItemLevList& ItemLevList = (dynamic_cast<const CSMWorld::Record<ESM::ItemLevList>&>(baseRecord)).get();
|
const ESM::ItemLevList& itemLevList = (dynamic_cast<const CSMWorld::Record<ESM::ItemLevList>&>(baseRecord)).get();
|
||||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_ItemLevelledList, ItemLevList.mId);
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_ItemLevelledList, itemLevList.mId);
|
||||||
|
|
||||||
listCheck<ESM::ItemLevList>(ItemLevList, messages, id.toString());
|
listCheck<ESM::ItemLevList>(itemLevList, messages, id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::lightCheck(
|
void CSMTools::ReferenceableCheckStage::lightCheck(
|
||||||
|
|
|
@ -474,8 +474,8 @@ namespace CSMWorld
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int TypeColumn = mReferenceables.findColumnIndex(Columns::ColumnId_RecordType);
|
const int typeColumn = mReferenceables.findColumnIndex(Columns::ColumnId_RecordType);
|
||||||
int type = mReferenceables.getData(index, TypeColumn).toInt();
|
int type = mReferenceables.getData(index, typeColumn).toInt();
|
||||||
if (type == UniversalId::Type_Creature)
|
if (type == UniversalId::Type_Creature)
|
||||||
{
|
{
|
||||||
// Valid creature record
|
// Valid creature record
|
||||||
|
@ -606,8 +606,8 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int TypeColumn = mReferenceables.findColumnIndex(Columns::ColumnId_RecordType);
|
const int typeColumn = mReferenceables.findColumnIndex(Columns::ColumnId_RecordType);
|
||||||
int type = mReferenceables.getData(index, TypeColumn).toInt();
|
int type = mReferenceables.getData(index, typeColumn).toInt();
|
||||||
if (type == UniversalId::Type_Armor)
|
if (type == UniversalId::Type_Armor)
|
||||||
{
|
{
|
||||||
auto& armor = dynamic_cast<const Record<ESM::Armor>&>(record).get();
|
auto& armor = dynamic_cast<const Record<ESM::Armor>&>(record).get();
|
||||||
|
|
|
@ -86,14 +86,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant LandNormalsColumn::get(const Record<Land>& record) const
|
QVariant LandNormalsColumn::get(const Record<Land>& record) const
|
||||||
{
|
{
|
||||||
const int Size = Land::LAND_NUM_VERTS * 3;
|
const int size = Land::LAND_NUM_VERTS * 3;
|
||||||
const Land& land = record.get();
|
const Land& land = record.get();
|
||||||
|
|
||||||
DataType values(Size, 0);
|
DataType values(size, 0);
|
||||||
|
|
||||||
if (land.isDataLoaded(Land::DATA_VNML))
|
if (land.isDataLoaded(Land::DATA_VNML))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
values[i] = land.getLandData()->mNormals[i];
|
values[i] = land.getLandData()->mNormals[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,14 +133,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant LandHeightsColumn::get(const Record<Land>& record) const
|
QVariant LandHeightsColumn::get(const Record<Land>& record) const
|
||||||
{
|
{
|
||||||
const int Size = Land::LAND_NUM_VERTS;
|
const int size = Land::LAND_NUM_VERTS;
|
||||||
const Land& land = record.get();
|
const Land& land = record.get();
|
||||||
|
|
||||||
DataType values(Size, 0);
|
DataType values(size, 0);
|
||||||
|
|
||||||
if (land.isDataLoaded(Land::DATA_VHGT))
|
if (land.isDataLoaded(Land::DATA_VHGT))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
values[i] = land.getLandData()->mHeights[i];
|
values[i] = land.getLandData()->mHeights[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,14 +182,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant LandColoursColumn::get(const Record<Land>& record) const
|
QVariant LandColoursColumn::get(const Record<Land>& record) const
|
||||||
{
|
{
|
||||||
const int Size = Land::LAND_NUM_VERTS * 3;
|
const int size = Land::LAND_NUM_VERTS * 3;
|
||||||
const Land& land = record.get();
|
const Land& land = record.get();
|
||||||
|
|
||||||
DataType values(Size, 0);
|
DataType values(size, 0);
|
||||||
|
|
||||||
if (land.isDataLoaded(Land::DATA_VCLR))
|
if (land.isDataLoaded(Land::DATA_VCLR))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
values[i] = land.getLandData()->mColours[i];
|
values[i] = land.getLandData()->mColours[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,14 +231,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant LandTexturesColumn::get(const Record<Land>& record) const
|
QVariant LandTexturesColumn::get(const Record<Land>& record) const
|
||||||
{
|
{
|
||||||
const int Size = Land::LAND_NUM_TEXTURES;
|
const int size = Land::LAND_NUM_TEXTURES;
|
||||||
const Land& land = record.get();
|
const Land& land = record.get();
|
||||||
|
|
||||||
DataType values(Size, 0);
|
DataType values(size, 0);
|
||||||
|
|
||||||
if (land.isDataLoaded(Land::DATA_VTEX))
|
if (land.isDataLoaded(Land::DATA_VTEX))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
values[i] = land.getLandData()->mTextures[i];
|
values[i] = land.getLandData()->mTextures[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,9 +345,9 @@ void CSMWorld::ConstInfoSelectWrapper::updateComparisonType()
|
||||||
|
|
||||||
std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getConditionIntRange() const
|
std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getConditionIntRange() const
|
||||||
{
|
{
|
||||||
const int IntMax = std::numeric_limits<int>::max();
|
const int intMax = std::numeric_limits<int>::max();
|
||||||
const int IntMin = std::numeric_limits<int>::min();
|
const int intMin = std::numeric_limits<int>::min();
|
||||||
const std::pair<int, int> InvalidRange(IntMax, IntMin);
|
const std::pair<int, int> invalidRange(intMax, intMin);
|
||||||
|
|
||||||
int value = std::get<int>(mConstSelect.mValue);
|
int value = std::get<int>(mConstSelect.mValue);
|
||||||
|
|
||||||
|
@ -358,31 +358,31 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getConditionIntRange() con
|
||||||
return std::pair<int, int>(value, value);
|
return std::pair<int, int>(value, value);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Gt:
|
case ESM::DialogueCondition::Comp_Gt:
|
||||||
if (value == IntMax)
|
if (value == intMax)
|
||||||
{
|
{
|
||||||
return InvalidRange;
|
return invalidRange;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return std::pair<int, int>(value + 1, IntMax);
|
return std::pair<int, int>(value + 1, intMax);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Ge:
|
case ESM::DialogueCondition::Comp_Ge:
|
||||||
return std::pair<int, int>(value, IntMax);
|
return std::pair<int, int>(value, intMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Ls:
|
case ESM::DialogueCondition::Comp_Ls:
|
||||||
if (value == IntMin)
|
if (value == intMin)
|
||||||
{
|
{
|
||||||
return InvalidRange;
|
return invalidRange;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return std::pair<int, int>(IntMin, value - 1);
|
return std::pair<int, int>(intMin, value - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Le:
|
case ESM::DialogueCondition::Comp_Le:
|
||||||
return std::pair<int, int>(IntMin, value);
|
return std::pair<int, int>(intMin, value);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::logic_error("InfoSelectWrapper: relation does not have a range");
|
throw std::logic_error("InfoSelectWrapper: relation does not have a range");
|
||||||
|
@ -391,9 +391,9 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getConditionIntRange() con
|
||||||
|
|
||||||
std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getConditionFloatRange() const
|
std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getConditionFloatRange() const
|
||||||
{
|
{
|
||||||
const float FloatMax = std::numeric_limits<float>::infinity();
|
const float floatMax = std::numeric_limits<float>::infinity();
|
||||||
const float FloatMin = -std::numeric_limits<float>::infinity();
|
const float floatMin = -std::numeric_limits<float>::infinity();
|
||||||
const float Epsilon = std::numeric_limits<float>::epsilon();
|
const float epsilon = std::numeric_limits<float>::epsilon();
|
||||||
|
|
||||||
float value = std::get<float>(mConstSelect.mValue);
|
float value = std::get<float>(mConstSelect.mValue);
|
||||||
|
|
||||||
|
@ -404,16 +404,16 @@ std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getConditionFloatRange
|
||||||
return std::pair<float, float>(value, value);
|
return std::pair<float, float>(value, value);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Gt:
|
case ESM::DialogueCondition::Comp_Gt:
|
||||||
return std::pair<float, float>(value + Epsilon, FloatMax);
|
return std::pair<float, float>(value + epsilon, floatMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Ge:
|
case ESM::DialogueCondition::Comp_Ge:
|
||||||
return std::pair<float, float>(value, FloatMax);
|
return std::pair<float, float>(value, floatMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Ls:
|
case ESM::DialogueCondition::Comp_Ls:
|
||||||
return std::pair<float, float>(FloatMin, value - Epsilon);
|
return std::pair<float, float>(floatMin, value - epsilon);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Comp_Le:
|
case ESM::DialogueCondition::Comp_Le:
|
||||||
return std::pair<float, float>(FloatMin, value);
|
return std::pair<float, float>(floatMin, value);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::logic_error("InfoSelectWrapper: given relation does not have a range");
|
throw std::logic_error("InfoSelectWrapper: given relation does not have a range");
|
||||||
|
@ -422,8 +422,8 @@ std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getConditionFloatRange
|
||||||
|
|
||||||
std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
||||||
{
|
{
|
||||||
const int IntMax = std::numeric_limits<int>::max();
|
const int intMax = std::numeric_limits<int>::max();
|
||||||
const int IntMin = std::numeric_limits<int>::min();
|
const int intMin = std::numeric_limits<int>::min();
|
||||||
|
|
||||||
switch (getFunctionName())
|
switch (getFunctionName())
|
||||||
{
|
{
|
||||||
|
@ -455,7 +455,7 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
||||||
case ESM::DialogueCondition::Function_Reputation:
|
case ESM::DialogueCondition::Function_Reputation:
|
||||||
case ESM::DialogueCondition::Function_PcReputation:
|
case ESM::DialogueCondition::Function_PcReputation:
|
||||||
case ESM::DialogueCondition::Function_Journal:
|
case ESM::DialogueCondition::Function_Journal:
|
||||||
return std::pair<int, int>(IntMin, IntMax);
|
return std::pair<int, int>(intMin, intMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_Item:
|
case ESM::DialogueCondition::Function_Item:
|
||||||
case ESM::DialogueCondition::Function_Dead:
|
case ESM::DialogueCondition::Function_Dead:
|
||||||
|
@ -500,7 +500,7 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
||||||
case ESM::DialogueCondition::Function_PcLuck:
|
case ESM::DialogueCondition::Function_PcLuck:
|
||||||
case ESM::DialogueCondition::Function_Level:
|
case ESM::DialogueCondition::Function_Level:
|
||||||
case ESM::DialogueCondition::Function_PcWerewolfKills:
|
case ESM::DialogueCondition::Function_PcWerewolfKills:
|
||||||
return std::pair<int, int>(0, IntMax);
|
return std::pair<int, int>(0, intMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_Fight:
|
case ESM::DialogueCondition::Function_Fight:
|
||||||
case ESM::DialogueCondition::Function_Hello:
|
case ESM::DialogueCondition::Function_Hello:
|
||||||
|
@ -530,12 +530,12 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
||||||
case ESM::DialogueCondition::Function_Global:
|
case ESM::DialogueCondition::Function_Global:
|
||||||
case ESM::DialogueCondition::Function_Local:
|
case ESM::DialogueCondition::Function_Local:
|
||||||
case ESM::DialogueCondition::Function_NotLocal:
|
case ESM::DialogueCondition::Function_NotLocal:
|
||||||
return std::pair<int, int>(IntMin, IntMax);
|
return std::pair<int, int>(intMin, intMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_PcMagicka:
|
case ESM::DialogueCondition::Function_PcMagicka:
|
||||||
case ESM::DialogueCondition::Function_PcFatigue:
|
case ESM::DialogueCondition::Function_PcFatigue:
|
||||||
case ESM::DialogueCondition::Function_PcHealth:
|
case ESM::DialogueCondition::Function_PcHealth:
|
||||||
return std::pair<int, int>(0, IntMax);
|
return std::pair<int, int>(0, intMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_Health_Percent:
|
case ESM::DialogueCondition::Function_Health_Percent:
|
||||||
case ESM::DialogueCondition::Function_PcHealthPercent:
|
case ESM::DialogueCondition::Function_PcHealthPercent:
|
||||||
|
@ -548,8 +548,8 @@ std::pair<int, int> CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const
|
||||||
|
|
||||||
std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getValidFloatRange() const
|
std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getValidFloatRange() const
|
||||||
{
|
{
|
||||||
const float FloatMax = std::numeric_limits<float>::infinity();
|
const float floatMax = std::numeric_limits<float>::infinity();
|
||||||
const float FloatMin = -std::numeric_limits<float>::infinity();
|
const float floatMin = -std::numeric_limits<float>::infinity();
|
||||||
|
|
||||||
switch (getFunctionName())
|
switch (getFunctionName())
|
||||||
{
|
{
|
||||||
|
@ -557,12 +557,12 @@ std::pair<float, float> CSMWorld::ConstInfoSelectWrapper::getValidFloatRange() c
|
||||||
case ESM::DialogueCondition::Function_Global:
|
case ESM::DialogueCondition::Function_Global:
|
||||||
case ESM::DialogueCondition::Function_Local:
|
case ESM::DialogueCondition::Function_Local:
|
||||||
case ESM::DialogueCondition::Function_NotLocal:
|
case ESM::DialogueCondition::Function_NotLocal:
|
||||||
return std::pair<float, float>(FloatMin, FloatMax);
|
return std::pair<float, float>(floatMin, floatMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_PcMagicka:
|
case ESM::DialogueCondition::Function_PcMagicka:
|
||||||
case ESM::DialogueCondition::Function_PcFatigue:
|
case ESM::DialogueCondition::Function_PcFatigue:
|
||||||
case ESM::DialogueCondition::Function_PcHealth:
|
case ESM::DialogueCondition::Function_PcHealth:
|
||||||
return std::pair<float, float>(0, FloatMax);
|
return std::pair<float, float>(0, floatMax);
|
||||||
|
|
||||||
case ESM::DialogueCondition::Function_Health_Percent:
|
case ESM::DialogueCondition::Function_Health_Percent:
|
||||||
case ESM::DialogueCondition::Function_PcHealthPercent:
|
case ESM::DialogueCondition::Function_PcHealthPercent:
|
||||||
|
|
|
@ -1054,14 +1054,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
QVariant RegionWeatherAdapter::getData(const Record<ESM::Region>& record, int subRowIndex, int subColIndex) const
|
QVariant RegionWeatherAdapter::getData(const Record<ESM::Region>& record, int subRowIndex, int subColIndex) const
|
||||||
{
|
{
|
||||||
const char* WeatherNames[]
|
const char* weatherNames[]
|
||||||
= { "Clear", "Cloudy", "Fog", "Overcast", "Rain", "Thunder", "Ash", "Blight", "Snow", "Blizzard" };
|
= { "Clear", "Cloudy", "Fog", "Overcast", "Rain", "Thunder", "Ash", "Blight", "Snow", "Blizzard" };
|
||||||
|
|
||||||
const ESM::Region& region = record.get();
|
const ESM::Region& region = record.get();
|
||||||
|
|
||||||
if (subColIndex == 0 && subRowIndex >= 0 && subRowIndex < 10)
|
if (subColIndex == 0 && subRowIndex >= 0 && subRowIndex < 10)
|
||||||
{
|
{
|
||||||
return WeatherNames[subRowIndex];
|
return weatherNames[subRowIndex];
|
||||||
}
|
}
|
||||||
else if (subColIndex == 1)
|
else if (subColIndex == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,17 +13,17 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
Scope operator()(ESM::StringRefId v) const
|
Scope operator()(ESM::StringRefId v) const
|
||||||
{
|
{
|
||||||
std::string_view namespace_;
|
std::string_view namespaceValue;
|
||||||
|
|
||||||
const std::string::size_type i = v.getValue().find("::");
|
const std::string::size_type i = v.getValue().find("::");
|
||||||
|
|
||||||
if (i != std::string::npos)
|
if (i != std::string::npos)
|
||||||
namespace_ = std::string_view(v.getValue()).substr(0, i);
|
namespaceValue = std::string_view(v.getValue()).substr(0, i);
|
||||||
|
|
||||||
if (Misc::StringUtils::ciEqual(namespace_, "project"))
|
if (Misc::StringUtils::ciEqual(namespaceValue, "project"))
|
||||||
return Scope_Project;
|
return Scope_Project;
|
||||||
|
|
||||||
if (Misc::StringUtils::ciEqual(namespace_, "session"))
|
if (Misc::StringUtils::ciEqual(namespaceValue, "session"))
|
||||||
return Scope_Session;
|
return Scope_Session;
|
||||||
|
|
||||||
return Scope_Content;
|
return Scope_Content;
|
||||||
|
|
|
@ -355,7 +355,7 @@ namespace CSVRender
|
||||||
|
|
||||||
void FreeCameraController::pitch(double value)
|
void FreeCameraController::pitch(double value)
|
||||||
{
|
{
|
||||||
const double Constraint = osg::PI / 2 - 0.1;
|
const double constraint = osg::PI / 2 - 0.1;
|
||||||
|
|
||||||
if (mLockUpright)
|
if (mLockUpright)
|
||||||
{
|
{
|
||||||
|
@ -369,8 +369,8 @@ namespace CSVRender
|
||||||
if ((mUp ^ up) * left < 0)
|
if ((mUp ^ up) * left < 0)
|
||||||
pitchAngle *= -1;
|
pitchAngle *= -1;
|
||||||
|
|
||||||
if (std::abs(pitchAngle + value) > Constraint)
|
if (std::abs(pitchAngle + value) > constraint)
|
||||||
value = (pitchAngle > 0 ? 1 : -1) * Constraint - pitchAngle;
|
value = (pitchAngle > 0 ? 1 : -1) * constraint - pitchAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCamera()->getViewMatrix() *= osg::Matrixd::rotate(value, LocalLeft);
|
getCamera()->getViewMatrix() *= osg::Matrixd::rotate(value, LocalLeft);
|
||||||
|
@ -651,7 +651,7 @@ namespace CSVRender
|
||||||
|
|
||||||
void OrbitCameraController::initialize()
|
void OrbitCameraController::initialize()
|
||||||
{
|
{
|
||||||
static const int DefaultStartDistance = 10000.f;
|
const int defaultStartDistance = 10000.f;
|
||||||
|
|
||||||
// Try to intelligently pick focus object
|
// Try to intelligently pick focus object
|
||||||
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector(
|
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector(
|
||||||
|
@ -665,7 +665,7 @@ namespace CSVRender
|
||||||
getCamera()->accept(visitor);
|
getCamera()->accept(visitor);
|
||||||
|
|
||||||
osg::Vec3d eye, center, up;
|
osg::Vec3d eye, center, up;
|
||||||
getCamera()->getViewMatrixAsLookAt(eye, center, up, DefaultStartDistance);
|
getCamera()->getViewMatrixAsLookAt(eye, center, up, defaultStartDistance);
|
||||||
|
|
||||||
if (intersector->getIntersections().begin() != intersector->getIntersections().end())
|
if (intersector->getIntersections().begin() != intersector->getIntersections().end())
|
||||||
{
|
{
|
||||||
|
@ -675,7 +675,7 @@ namespace CSVRender
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mCenter = center;
|
mCenter = center;
|
||||||
mDistance = DefaultStartDistance;
|
mDistance = defaultStartDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
|
|
|
@ -138,13 +138,13 @@ namespace CSVRender
|
||||||
|
|
||||||
void CellWater::recreate()
|
void CellWater::recreate()
|
||||||
{
|
{
|
||||||
const int InteriorScalar = 20;
|
const int interiorScalar = 20;
|
||||||
const int SegmentsPerCell = 1;
|
const int segmentsPerCell = 1;
|
||||||
const int TextureRepeatsPerCell = 6;
|
const int textureRepeatsPerCell = 6;
|
||||||
|
|
||||||
const float Alpha = 0.5f;
|
const float alpha = 0.5f;
|
||||||
|
|
||||||
const int RenderBin = osg::StateSet::TRANSPARENT_BIN - 1;
|
const int renderBin = osg::StateSet::TRANSPARENT_BIN - 1;
|
||||||
|
|
||||||
if (mWaterGeometry)
|
if (mWaterGeometry)
|
||||||
{
|
{
|
||||||
|
@ -162,18 +162,18 @@ namespace CSVRender
|
||||||
if (mExterior)
|
if (mExterior)
|
||||||
{
|
{
|
||||||
size = CellSize;
|
size = CellSize;
|
||||||
segments = SegmentsPerCell;
|
segments = segmentsPerCell;
|
||||||
textureRepeats = TextureRepeatsPerCell;
|
textureRepeats = textureRepeatsPerCell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = CellSize * InteriorScalar;
|
size = CellSize * interiorScalar;
|
||||||
segments = SegmentsPerCell * InteriorScalar;
|
segments = segmentsPerCell * interiorScalar;
|
||||||
textureRepeats = TextureRepeatsPerCell * InteriorScalar;
|
textureRepeats = textureRepeatsPerCell * interiorScalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
mWaterGeometry = SceneUtil::createWaterGeometry(size, segments, textureRepeats);
|
mWaterGeometry = SceneUtil::createWaterGeometry(size, segments, textureRepeats);
|
||||||
mWaterGeometry->setStateSet(SceneUtil::createSimpleWaterStateSet(Alpha, RenderBin));
|
mWaterGeometry->setStateSet(SceneUtil::createSimpleWaterStateSet(alpha, renderBin));
|
||||||
|
|
||||||
// Add water texture
|
// Add water texture
|
||||||
constexpr VFS::Path::NormalizedView prefix("textures/water");
|
constexpr VFS::Path::NormalizedView prefix("textures/water");
|
||||||
|
|
|
@ -27,9 +27,9 @@ public:
|
||||||
|
|
||||||
void apply(osg::Switch& switchNode) override
|
void apply(osg::Switch& switchNode) override
|
||||||
{
|
{
|
||||||
constexpr int NoIndex = -1;
|
constexpr int noIndex = -1;
|
||||||
|
|
||||||
int initialIndex = NoIndex;
|
int initialIndex = noIndex;
|
||||||
if (!switchNode.getUserValue("initialIndex", initialIndex))
|
if (!switchNode.getUserValue("initialIndex", initialIndex))
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < switchNode.getValueList().size(); ++i)
|
for (size_t i = 0; i < switchNode.getValueList().size(); ++i)
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialIndex != NoIndex)
|
if (initialIndex != noIndex)
|
||||||
switchNode.setUserValue("initialIndex", initialIndex);
|
switchNode.setUserValue("initialIndex", initialIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
if (switchNode.getName() == Constants::NightDayLabel)
|
if (switchNode.getName() == Constants::NightDayLabel)
|
||||||
switchNode.setSingleChildOn(mIndex);
|
switchNode.setSingleChildOn(mIndex);
|
||||||
}
|
}
|
||||||
else if (initialIndex != NoIndex)
|
else if (initialIndex != noIndex)
|
||||||
{
|
{
|
||||||
switchNode.setSingleChildOn(initialIndex);
|
switchNode.setSingleChildOn(initialIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ void CSVRender::Object::update()
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables();
|
const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables();
|
||||||
const int TypeIndex = referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_RecordType);
|
const int typeIndex = referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_RecordType);
|
||||||
const int ModelIndex = referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_Model);
|
const int modelIndex = referenceables.findColumnIndex(CSMWorld::Columns::ColumnId_Model);
|
||||||
|
|
||||||
int index = referenceables.searchId(mReferenceableId);
|
int index = referenceables.searchId(mReferenceableId);
|
||||||
const ESM::Light* light = nullptr;
|
const ESM::Light* light = nullptr;
|
||||||
|
@ -99,8 +99,8 @@ void CSVRender::Object::update()
|
||||||
|
|
||||||
/// \todo check for Deleted state (error 1)
|
/// \todo check for Deleted state (error 1)
|
||||||
|
|
||||||
int recordType = referenceables.getData(index, TypeIndex).toInt();
|
int recordType = referenceables.getData(index, typeIndex).toInt();
|
||||||
std::string model = referenceables.getData(index, ModelIndex).toString().toUtf8().constData();
|
std::string model = referenceables.getData(index, modelIndex).toString().toUtf8().constData();
|
||||||
|
|
||||||
if (recordType == CSMWorld::UniversalId::Type_Light)
|
if (recordType == CSMWorld::UniversalId::Type_Light)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,10 +97,10 @@ namespace CSVRender
|
||||||
, mDragGeometry(nullptr)
|
, mDragGeometry(nullptr)
|
||||||
, mTag(new PathgridTag(this))
|
, mTag(new PathgridTag(this))
|
||||||
{
|
{
|
||||||
const float CoordScalar = ESM::Land::REAL_SIZE;
|
const float coordScalar = ESM::Land::REAL_SIZE;
|
||||||
|
|
||||||
mBaseNode = new osg::PositionAttitudeTransform();
|
mBaseNode = new osg::PositionAttitudeTransform();
|
||||||
mBaseNode->setPosition(osg::Vec3f(mCoords.getX() * CoordScalar, mCoords.getY() * CoordScalar, 0.f));
|
mBaseNode->setPosition(osg::Vec3f(mCoords.getX() * coordScalar, mCoords.getY() * coordScalar, 0.f));
|
||||||
mBaseNode->setUserData(mTag);
|
mBaseNode->setUserData(mTag);
|
||||||
mBaseNode->setUpdateCallback(new PathgridNodeCallback());
|
mBaseNode->setUpdateCallback(new PathgridNodeCallback());
|
||||||
mBaseNode->setNodeMask(Mask_Pathgrid);
|
mBaseNode->setNodeMask(Mask_Pathgrid);
|
||||||
|
@ -698,12 +698,12 @@ namespace CSVRender
|
||||||
|
|
||||||
int Pathgrid::clampToCell(int v)
|
int Pathgrid::clampToCell(int v)
|
||||||
{
|
{
|
||||||
const int CellExtent = ESM::Land::REAL_SIZE;
|
const int cellExtent = ESM::Land::REAL_SIZE;
|
||||||
|
|
||||||
if (mInterior)
|
if (mInterior)
|
||||||
return v;
|
return v;
|
||||||
else if (v > CellExtent)
|
else if (v > cellExtent)
|
||||||
return CellExtent;
|
return cellExtent;
|
||||||
else if (v < 0)
|
else if (v < 0)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
|
|
@ -318,10 +318,10 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<CSMWorld::CellCoordinates, bool> cellCoordinates_pair = CSMWorld::CellCoordinates::fromId(mCellId);
|
std::pair<CSMWorld::CellCoordinates, bool> cellCoordinatesPair = CSMWorld::CellCoordinates::fromId(mCellId);
|
||||||
|
|
||||||
int cellX = cellCoordinates_pair.first.getX();
|
int cellX = cellCoordinatesPair.first.getX();
|
||||||
int cellY = cellCoordinates_pair.first.getY();
|
int cellY = cellCoordinatesPair.first.getY();
|
||||||
|
|
||||||
// The coordinates of hit in mCellId
|
// The coordinates of hit in mCellId
|
||||||
int xHitInCell(float(((hit.worldPos.x() - (cellX * cellSize)) * landTextureSize / cellSize) - 0.25));
|
int xHitInCell(float(((hit.worldPos.x() - (cellX * cellSize)) * landTextureSize / cellSize) - 0.25));
|
||||||
|
@ -380,11 +380,11 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
if (yHitInCell + (r % landTextureSize) > landTextureSize - 1)
|
if (yHitInCell + (r % landTextureSize) > landTextureSize - 1)
|
||||||
lowerrightCellY++;
|
lowerrightCellY++;
|
||||||
|
|
||||||
for (int i_cell = upperLeftCellX; i_cell <= lowerrightCellX; i_cell++)
|
for (int iCell = upperLeftCellX; iCell <= lowerrightCellX; iCell++)
|
||||||
{
|
{
|
||||||
for (int j_cell = upperLeftCellY; j_cell <= lowerrightCellY; j_cell++)
|
for (int jCell = upperLeftCellY; jCell <= lowerrightCellY; jCell++)
|
||||||
{
|
{
|
||||||
iteratedCellId = CSMWorld::CellCoordinates::generateId(i_cell, j_cell);
|
iteratedCellId = CSMWorld::CellCoordinates::generateId(iCell, jCell);
|
||||||
if (allowLandTextureEditing(iteratedCellId))
|
if (allowLandTextureEditing(iteratedCellId))
|
||||||
{
|
{
|
||||||
CSMWorld::LandTexturesColumn::DataType newTerrain
|
CSMWorld::LandTexturesColumn::DataType newTerrain
|
||||||
|
@ -395,8 +395,7 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
for (int j = 0; j < landTextureSize; j++)
|
for (int j = 0; j < landTextureSize; j++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (i_cell == cellX && j_cell == cellY && abs(i - xHitInCell) < r
|
if (iCell == cellX && jCell == cellY && abs(i - xHitInCell) < r && abs(j - yHitInCell) < r)
|
||||||
&& abs(j - yHitInCell) < r)
|
|
||||||
{
|
{
|
||||||
newTerrain[j * landTextureSize + i] = brushInt;
|
newTerrain[j * landTextureSize + i] = brushInt;
|
||||||
}
|
}
|
||||||
|
@ -404,17 +403,17 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
{
|
{
|
||||||
int distanceX(0);
|
int distanceX(0);
|
||||||
int distanceY(0);
|
int distanceY(0);
|
||||||
if (i_cell < cellX)
|
if (iCell < cellX)
|
||||||
distanceX = xHitInCell + landTextureSize * abs(i_cell - cellX) - i;
|
distanceX = xHitInCell + landTextureSize * abs(iCell - cellX) - i;
|
||||||
if (j_cell < cellY)
|
if (jCell < cellY)
|
||||||
distanceY = yHitInCell + landTextureSize * abs(j_cell - cellY) - j;
|
distanceY = yHitInCell + landTextureSize * abs(jCell - cellY) - j;
|
||||||
if (i_cell > cellX)
|
if (iCell > cellX)
|
||||||
distanceX = -xHitInCell + landTextureSize * abs(i_cell - cellX) + i;
|
distanceX = -xHitInCell + landTextureSize * abs(iCell - cellX) + i;
|
||||||
if (j_cell > cellY)
|
if (jCell > cellY)
|
||||||
distanceY = -yHitInCell + landTextureSize * abs(j_cell - cellY) + j;
|
distanceY = -yHitInCell + landTextureSize * abs(jCell - cellY) + j;
|
||||||
if (i_cell == cellX)
|
if (iCell == cellX)
|
||||||
distanceX = abs(i - xHitInCell);
|
distanceX = abs(i - xHitInCell);
|
||||||
if (j_cell == cellY)
|
if (jCell == cellY)
|
||||||
distanceY = abs(j - yHitInCell);
|
distanceY = abs(j - yHitInCell);
|
||||||
if (distanceX < r && distanceY < r)
|
if (distanceX < r && distanceY < r)
|
||||||
newTerrain[j * landTextureSize + i] = brushInt;
|
newTerrain[j * landTextureSize + i] = brushInt;
|
||||||
|
@ -443,11 +442,11 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
if (yHitInCell + (r % landTextureSize) > landTextureSize - 1)
|
if (yHitInCell + (r % landTextureSize) > landTextureSize - 1)
|
||||||
lowerrightCellY++;
|
lowerrightCellY++;
|
||||||
|
|
||||||
for (int i_cell = upperLeftCellX; i_cell <= lowerrightCellX; i_cell++)
|
for (int iCell = upperLeftCellX; iCell <= lowerrightCellX; iCell++)
|
||||||
{
|
{
|
||||||
for (int j_cell = upperLeftCellY; j_cell <= lowerrightCellY; j_cell++)
|
for (int jCell = upperLeftCellY; jCell <= lowerrightCellY; jCell++)
|
||||||
{
|
{
|
||||||
iteratedCellId = CSMWorld::CellCoordinates::generateId(i_cell, j_cell);
|
iteratedCellId = CSMWorld::CellCoordinates::generateId(iCell, jCell);
|
||||||
if (allowLandTextureEditing(iteratedCellId))
|
if (allowLandTextureEditing(iteratedCellId))
|
||||||
{
|
{
|
||||||
CSMWorld::LandTexturesColumn::DataType newTerrain
|
CSMWorld::LandTexturesColumn::DataType newTerrain
|
||||||
|
@ -457,8 +456,7 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
{
|
{
|
||||||
for (int j = 0; j < landTextureSize; j++)
|
for (int j = 0; j < landTextureSize; j++)
|
||||||
{
|
{
|
||||||
if (i_cell == cellX && j_cell == cellY && abs(i - xHitInCell) < r
|
if (iCell == cellX && jCell == cellY && abs(i - xHitInCell) < r && abs(j - yHitInCell) < r)
|
||||||
&& abs(j - yHitInCell) < r)
|
|
||||||
{
|
{
|
||||||
int distanceX = abs(i - xHitInCell);
|
int distanceX = abs(i - xHitInCell);
|
||||||
int distanceY = abs(j - yHitInCell);
|
int distanceY = abs(j - yHitInCell);
|
||||||
|
@ -471,17 +469,17 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
||||||
{
|
{
|
||||||
int distanceX(0);
|
int distanceX(0);
|
||||||
int distanceY(0);
|
int distanceY(0);
|
||||||
if (i_cell < cellX)
|
if (iCell < cellX)
|
||||||
distanceX = xHitInCell + landTextureSize * abs(i_cell - cellX) - i;
|
distanceX = xHitInCell + landTextureSize * abs(iCell - cellX) - i;
|
||||||
if (j_cell < cellY)
|
if (jCell < cellY)
|
||||||
distanceY = yHitInCell + landTextureSize * abs(j_cell - cellY) - j;
|
distanceY = yHitInCell + landTextureSize * abs(jCell - cellY) - j;
|
||||||
if (i_cell > cellX)
|
if (iCell > cellX)
|
||||||
distanceX = -xHitInCell + landTextureSize * abs(i_cell - cellX) + i;
|
distanceX = -xHitInCell + landTextureSize * abs(iCell - cellX) + i;
|
||||||
if (j_cell > cellY)
|
if (jCell > cellY)
|
||||||
distanceY = -yHitInCell + landTextureSize * abs(j_cell - cellY) + j;
|
distanceY = -yHitInCell + landTextureSize * abs(jCell - cellY) + j;
|
||||||
if (i_cell == cellX)
|
if (iCell == cellX)
|
||||||
distanceX = abs(i - xHitInCell);
|
distanceX = abs(i - xHitInCell);
|
||||||
if (j_cell == cellY)
|
if (jCell == cellY)
|
||||||
distanceY = abs(j - yHitInCell);
|
distanceY = abs(j - yHitInCell);
|
||||||
float distance = std::round(sqrt(pow(distanceX, 2) + pow(distanceY, 2)));
|
float distance = std::round(sqrt(pow(distanceX, 2) + pow(distanceY, 2)));
|
||||||
float rf = static_cast<float>(mBrushSize) / 2;
|
float rf = static_cast<float>(mBrushSize) / 2;
|
||||||
|
|
|
@ -270,9 +270,9 @@ CSVWidget::SceneToolRun* CSVRender::WorldspaceWidget::makeRunTool(CSVWidget::Sce
|
||||||
{
|
{
|
||||||
int state = debugProfiles.data(debugProfiles.index(i, stateColumn)).toInt();
|
int state = debugProfiles.data(debugProfiles.index(i, stateColumn)).toInt();
|
||||||
|
|
||||||
bool default_ = debugProfiles.data(debugProfiles.index(i, defaultColumn)).toInt();
|
const bool defaultValue = debugProfiles.data(debugProfiles.index(i, defaultColumn)).toInt();
|
||||||
|
|
||||||
if (state != CSMWorld::RecordBase::State_Deleted && default_)
|
if (state != CSMWorld::RecordBase::State_Deleted && defaultValue)
|
||||||
profiles.emplace_back(debugProfiles.data(debugProfiles.index(i, idColumn)).toString().toUtf8().constData());
|
profiles.emplace_back(debugProfiles.data(debugProfiles.index(i, idColumn)).toString().toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,23 +122,23 @@ std::string CSVWorld::GenericCreator::getNamespace() const
|
||||||
|
|
||||||
void CSVWorld::GenericCreator::updateNamespace()
|
void CSVWorld::GenericCreator::updateNamespace()
|
||||||
{
|
{
|
||||||
std::string namespace_ = getNamespace();
|
std::string namespaceName = getNamespace();
|
||||||
|
|
||||||
mValidator->setNamespace(namespace_);
|
mValidator->setNamespace(namespaceName);
|
||||||
|
|
||||||
int index = mId->text().indexOf("::");
|
int index = mId->text().indexOf("::");
|
||||||
|
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
// no namespace in old text
|
// no namespace in old text
|
||||||
mId->setText(QString::fromUtf8(namespace_.c_str()) + mId->text());
|
mId->setText(QString::fromUtf8(namespaceName.c_str()) + mId->text());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string oldNamespace = Misc::StringUtils::lowerCase(mId->text().left(index).toUtf8().constData());
|
std::string oldNamespace = Misc::StringUtils::lowerCase(mId->text().left(index).toUtf8().constData());
|
||||||
|
|
||||||
if (oldNamespace == "project" || oldNamespace == "session")
|
if (oldNamespace == "project" || oldNamespace == "session")
|
||||||
mId->setText(QString::fromUtf8(namespace_.c_str()) + mId->text().mid(index + 2));
|
mId->setText(QString::fromUtf8(namespaceName.c_str()) + mId->text().mid(index + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,12 @@ QValidator::State CSVWorld::IdValidator::validate(QString& input, int& pos) cons
|
||||||
|
|
||||||
if (!mNamespace.empty())
|
if (!mNamespace.empty())
|
||||||
{
|
{
|
||||||
std::string namespace_ = input.left(static_cast<int>(mNamespace.size())).toUtf8().constData();
|
const std::string namespaceName = input.left(static_cast<int>(mNamespace.size())).toUtf8().constData();
|
||||||
|
|
||||||
if (Misc::StringUtils::lowerCase(namespace_) != mNamespace)
|
if (Misc::StringUtils::lowerCase(namespaceName) != mNamespace)
|
||||||
return QValidator::Invalid; // incorrect namespace
|
return QValidator::Invalid; // incorrect namespace
|
||||||
|
|
||||||
iter += namespace_.size();
|
iter += namespaceName.size();
|
||||||
first = false;
|
first = false;
|
||||||
prevScope = true;
|
prevScope = true;
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,9 @@ QValidator::State CSVWorld::IdValidator::validate(QString& input, int& pos) cons
|
||||||
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
QString namespace_ = input.left(index);
|
const QString namespaceName = input.left(index);
|
||||||
|
|
||||||
if (namespace_ == "project" || namespace_ == "session")
|
if (namespaceName == "project" || namespaceName == "session")
|
||||||
return QValidator::Invalid; // reserved namespace
|
return QValidator::Invalid; // reserved namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,9 @@ QValidator::State CSVWorld::IdValidator::validate(QString& input, int& pos) cons
|
||||||
return QValidator::Acceptable;
|
return QValidator::Acceptable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::IdValidator::setNamespace(const std::string& namespace_)
|
void CSVWorld::IdValidator::setNamespace(const std::string& value)
|
||||||
{
|
{
|
||||||
mNamespace = Misc::StringUtils::lowerCase(namespace_);
|
mNamespace = Misc::StringUtils::lowerCase(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CSVWorld::IdValidator::getError() const
|
std::string CSVWorld::IdValidator::getError() const
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
State validate(QString& input, int& pos) const override;
|
State validate(QString& input, int& pos) const override;
|
||||||
|
|
||||||
void setNamespace(const std::string& namespace_);
|
void setNamespace(const std::string& value);
|
||||||
|
|
||||||
/// Return a description of the error that resulted in the last call of validate
|
/// Return a description of the error that resulted in the last call of validate
|
||||||
/// returning QValidator::Intermediate. If the last call to validate returned
|
/// returning QValidator::Intermediate. If the last call to validate returned
|
||||||
|
|
|
@ -22,22 +22,22 @@ namespace CSVWorld
|
||||||
, mX(nullptr)
|
, mX(nullptr)
|
||||||
, mY(nullptr)
|
, mY(nullptr)
|
||||||
{
|
{
|
||||||
const int MaxInt = std::numeric_limits<int>::max();
|
const int maxInt = std::numeric_limits<int>::max();
|
||||||
const int MinInt = std::numeric_limits<int>::min();
|
const int minInt = std::numeric_limits<int>::min();
|
||||||
|
|
||||||
setManualEditing(false);
|
setManualEditing(false);
|
||||||
|
|
||||||
mXLabel = new QLabel("X: ");
|
mXLabel = new QLabel("X: ");
|
||||||
mX = new QSpinBox();
|
mX = new QSpinBox();
|
||||||
mX->setMinimum(MinInt);
|
mX->setMinimum(minInt);
|
||||||
mX->setMaximum(MaxInt);
|
mX->setMaximum(maxInt);
|
||||||
insertBeforeButtons(mXLabel, false);
|
insertBeforeButtons(mXLabel, false);
|
||||||
insertBeforeButtons(mX, true);
|
insertBeforeButtons(mX, true);
|
||||||
|
|
||||||
mYLabel = new QLabel("Y: ");
|
mYLabel = new QLabel("Y: ");
|
||||||
mY = new QSpinBox();
|
mY = new QSpinBox();
|
||||||
mY->setMinimum(MinInt);
|
mY->setMinimum(minInt);
|
||||||
mY->setMaximum(MaxInt);
|
mY->setMaximum(maxInt);
|
||||||
insertBeforeButtons(mYLabel, false);
|
insertBeforeButtons(mYLabel, false);
|
||||||
insertBeforeButtons(mY, true);
|
insertBeforeButtons(mY, true);
|
||||||
|
|
||||||
|
|
|
@ -493,12 +493,13 @@ void OMW::Engine::createWindow()
|
||||||
const SDLUtil::VSyncMode vsync = Settings::video().mVsyncMode;
|
const SDLUtil::VSyncMode vsync = Settings::video().mVsyncMode;
|
||||||
unsigned antialiasing = static_cast<unsigned>(Settings::video().mAntialiasing);
|
unsigned antialiasing = static_cast<unsigned>(Settings::video().mAntialiasing);
|
||||||
|
|
||||||
int pos_x = SDL_WINDOWPOS_CENTERED_DISPLAY(screen), pos_y = SDL_WINDOWPOS_CENTERED_DISPLAY(screen);
|
int posX = SDL_WINDOWPOS_CENTERED_DISPLAY(screen);
|
||||||
|
int posY = SDL_WINDOWPOS_CENTERED_DISPLAY(screen);
|
||||||
|
|
||||||
if (windowMode == Settings::WindowMode::Fullscreen || windowMode == Settings::WindowMode::WindowedFullscreen)
|
if (windowMode == Settings::WindowMode::Fullscreen || windowMode == Settings::WindowMode::WindowedFullscreen)
|
||||||
{
|
{
|
||||||
pos_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
posX = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
||||||
pos_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
posY = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
|
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
|
@ -535,7 +536,7 @@ void OMW::Engine::createWindow()
|
||||||
{
|
{
|
||||||
while (!mWindow)
|
while (!mWindow)
|
||||||
{
|
{
|
||||||
mWindow = SDL_CreateWindow("OpenMW", pos_x, pos_y, width, height, flags);
|
mWindow = SDL_CreateWindow("OpenMW", posX, posY, width, height, flags);
|
||||||
if (!mWindow)
|
if (!mWindow)
|
||||||
{
|
{
|
||||||
// Try with a lower AA
|
// Try with a lower AA
|
||||||
|
@ -961,14 +962,14 @@ void OMW::Engine::go()
|
||||||
prepareEngine();
|
prepareEngine();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const auto* stats_file = _wgetenv(L"OPENMW_OSG_STATS_FILE");
|
const auto* statsFile = _wgetenv(L"OPENMW_OSG_STATS_FILE");
|
||||||
#else
|
#else
|
||||||
const auto* stats_file = std::getenv("OPENMW_OSG_STATS_FILE");
|
const auto* statsFile = std::getenv("OPENMW_OSG_STATS_FILE");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::filesystem::path path;
|
std::filesystem::path path;
|
||||||
if (stats_file != nullptr)
|
if (statsFile != nullptr)
|
||||||
path = stats_file;
|
path = statsFile;
|
||||||
|
|
||||||
std::ofstream stats;
|
std::ofstream stats;
|
||||||
if (!path.empty())
|
if (!path.empty())
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace MWBase
|
||||||
virtual void setPlayerClass(const ESM::RefId& id) = 0;
|
virtual void setPlayerClass(const ESM::RefId& id) = 0;
|
||||||
///< Set player class to stock class.
|
///< Set player class to stock class.
|
||||||
|
|
||||||
virtual void setPlayerClass(const ESM::Class& class_) = 0;
|
virtual void setPlayerClass(const ESM::Class& value) = 0;
|
||||||
///< Set player class to custom class.
|
///< Set player class to custom class.
|
||||||
|
|
||||||
virtual void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) = 0;
|
virtual void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) = 0;
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
|
|
||||||
const int size = 11;
|
const int size = 11;
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ namespace MWClass
|
||||||
for (int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
if (sMapping[i][0] == ref->mBase->mData.mType)
|
if (sMapping[i][0] == ref->mBase->mData.mType)
|
||||||
{
|
{
|
||||||
slots_.push_back(int(sMapping[i][1]));
|
slots.push_back(int(sMapping[i][1]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::RefId Armor::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
ESM::RefId Armor::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
||||||
|
@ -352,9 +352,9 @@ namespace MWClass
|
||||||
return { 0, "#{sInventoryMessage1}" };
|
return { 0, "#{sInventoryMessage1}" };
|
||||||
|
|
||||||
// slots that this item can be equipped in
|
// slots that this item can be equipped in
|
||||||
std::pair<std::vector<int>, bool> slots_ = getEquipmentSlots(ptr);
|
std::pair<std::vector<int>, bool> slots = getEquipmentSlots(ptr);
|
||||||
|
|
||||||
if (slots_.first.empty())
|
if (slots.first.empty())
|
||||||
return { 0, {} };
|
return { 0, {} };
|
||||||
|
|
||||||
if (npc.getClass().isNpc())
|
if (npc.getClass().isNpc())
|
||||||
|
@ -377,7 +377,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<int>::const_iterator slot = slots_.first.begin(); slot != slots_.first.end(); ++slot)
|
for (std::vector<int>::const_iterator slot = slots.first.begin(); slot != slots.first.end(); ++slot)
|
||||||
{
|
{
|
||||||
// If equipping a shield, check if there's a twohanded weapon conflicting with it
|
// If equipping a shield, check if there's a twohanded weapon conflicting with it
|
||||||
if (*slot == MWWorld::InventoryStore::Slot_CarriedLeft)
|
if (*slot == MWWorld::InventoryStore::Slot_CarriedLeft)
|
||||||
|
|
|
@ -66,12 +66,12 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();
|
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
|
|
||||||
if (ref->mBase->mData.mType == ESM::Clothing::Ring)
|
if (ref->mBase->mData.mType == ESM::Clothing::Ring)
|
||||||
{
|
{
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_LeftRing));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_LeftRing));
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_RightRing));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_RightRing));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -90,12 +90,12 @@ namespace MWClass
|
||||||
for (int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
if (sMapping[i][0] == ref->mBase->mData.mType)
|
if (sMapping[i][0] == ref->mBase->mData.mType)
|
||||||
{
|
{
|
||||||
slots_.push_back(int(sMapping[i][1]));
|
slots.push_back(int(sMapping[i][1]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::RefId Clothing::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
ESM::RefId Clothing::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
||||||
|
@ -200,9 +200,9 @@ namespace MWClass
|
||||||
const MWWorld::ConstPtr& ptr, const MWWorld::Ptr& npc) const
|
const MWWorld::ConstPtr& ptr, const MWWorld::Ptr& npc) const
|
||||||
{
|
{
|
||||||
// slots that this item can be equipped in
|
// slots that this item can be equipped in
|
||||||
std::pair<std::vector<int>, bool> slots_ = getEquipmentSlots(ptr);
|
std::pair<std::vector<int>, bool> slots = getEquipmentSlots(ptr);
|
||||||
|
|
||||||
if (slots_.first.empty())
|
if (slots.first.empty())
|
||||||
return { 0, {} };
|
return { 0, {} };
|
||||||
|
|
||||||
if (npc.getClass().isNpc())
|
if (npc.getClass().isNpc())
|
||||||
|
|
|
@ -113,12 +113,12 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Light>* ref = ptr.get<ESM::Light>();
|
const MWWorld::LiveCellRef<ESM::Light>* ref = ptr.get<ESM::Light>();
|
||||||
|
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
|
|
||||||
if (ref->mBase->mData.mFlags & ESM::Light::Carry)
|
if (ref->mBase->mData.mFlags & ESM::Light::Carry)
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_CarriedLeft));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_CarriedLeft));
|
||||||
|
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Light::getValue(const MWWorld::ConstPtr& ptr) const
|
int Light::getValue(const MWWorld::ConstPtr& ptr) const
|
||||||
|
|
|
@ -63,11 +63,11 @@ namespace MWClass
|
||||||
|
|
||||||
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots(const MWWorld::ConstPtr& ptr) const
|
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
|
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
slots.push_back(static_cast<int>(MWWorld::InventoryStore::Slot_CarriedRight));
|
||||||
|
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lockpick::getValue(const MWWorld::ConstPtr& ptr) const
|
int Lockpick::getValue(const MWWorld::ConstPtr& ptr) const
|
||||||
|
|
|
@ -87,9 +87,9 @@ namespace
|
||||||
|
|
||||||
int is_even(double d)
|
int is_even(double d)
|
||||||
{
|
{
|
||||||
double int_part;
|
double intPart;
|
||||||
modf(d / 2.0, &int_part);
|
modf(d / 2.0, &intPart);
|
||||||
return 2.0 * int_part == d;
|
return 2.0 * intPart == d;
|
||||||
}
|
}
|
||||||
|
|
||||||
int round_ieee_754(double d)
|
int round_ieee_754(double d)
|
||||||
|
@ -118,9 +118,9 @@ namespace
|
||||||
creatureStats.setAttribute(attribute.mId, race->mData.getAttribute(attribute.mId, male));
|
creatureStats.setAttribute(attribute.mId, race->mData.getAttribute(attribute.mId, male));
|
||||||
|
|
||||||
// class bonus
|
// class bonus
|
||||||
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
const ESM::Class* npcClass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
||||||
|
|
||||||
for (int attribute : class_->mData.mAttribute)
|
for (int attribute : npcClass->mData.mAttribute)
|
||||||
{
|
{
|
||||||
if (attribute >= 0 && attribute < ESM::Attribute::Length)
|
if (attribute >= 0 && attribute < ESM::Attribute::Length)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ namespace
|
||||||
// is this a minor or major skill?
|
// is this a minor or major skill?
|
||||||
float add = 0.2f;
|
float add = 0.2f;
|
||||||
int index = ESM::Skill::refIdToIndex(skill.mId);
|
int index = ESM::Skill::refIdToIndex(skill.mId);
|
||||||
for (const auto& skills : class_->mData.mSkills)
|
for (const auto& skills : npcClass->mData.mSkills)
|
||||||
{
|
{
|
||||||
if (skills[0] == index)
|
if (skills[0] == index)
|
||||||
add = 0.5;
|
add = 0.5;
|
||||||
|
@ -164,14 +164,14 @@ namespace
|
||||||
|
|
||||||
int multiplier = 3;
|
int multiplier = 3;
|
||||||
|
|
||||||
if (class_->mData.mSpecialization == ESM::Class::Combat)
|
if (npcClass->mData.mSpecialization == ESM::Class::Combat)
|
||||||
multiplier += 2;
|
multiplier += 2;
|
||||||
else if (class_->mData.mSpecialization == ESM::Class::Stealth)
|
else if (npcClass->mData.mSpecialization == ESM::Class::Stealth)
|
||||||
multiplier += 1;
|
multiplier += 1;
|
||||||
|
|
||||||
if (std::find(class_->mData.mAttribute.begin(), class_->mData.mAttribute.end(),
|
if (std::find(npcClass->mData.mAttribute.begin(), npcClass->mData.mAttribute.end(),
|
||||||
ESM::Attribute::refIdToIndex(ESM::Attribute::Endurance))
|
ESM::Attribute::refIdToIndex(ESM::Attribute::Endurance))
|
||||||
!= class_->mData.mAttribute.end())
|
!= npcClass->mData.mAttribute.end())
|
||||||
multiplier += 1;
|
multiplier += 1;
|
||||||
|
|
||||||
creatureStats.setHealth(floor(0.5f * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
creatureStats.setHealth(floor(0.5f * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
||||||
|
@ -194,7 +194,7 @@ namespace
|
||||||
void autoCalculateSkills(
|
void autoCalculateSkills(
|
||||||
const ESM::NPC* npc, MWMechanics::NpcStats& npcStats, const MWWorld::Ptr& ptr, bool spellsInitialised)
|
const ESM::NPC* npc, MWMechanics::NpcStats& npcStats, const MWWorld::Ptr& ptr, bool spellsInitialised)
|
||||||
{
|
{
|
||||||
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
const ESM::Class* npcClass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
||||||
|
|
||||||
unsigned int level = npcStats.getLevel();
|
unsigned int level = npcStats.getLevel();
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ namespace
|
||||||
{
|
{
|
||||||
int bonus = (i == 0) ? 10 : 25;
|
int bonus = (i == 0) ? 10 : 25;
|
||||||
|
|
||||||
for (const auto& skills : class_->mData.mSkills)
|
for (const auto& skills : npcClass->mData.mSkills)
|
||||||
{
|
{
|
||||||
ESM::RefId id = ESM::Skill::indexToRefId(skills[i]);
|
ESM::RefId id = ESM::Skill::indexToRefId(skills[i]);
|
||||||
if (!id.empty())
|
if (!id.empty())
|
||||||
|
@ -228,7 +228,7 @@ namespace
|
||||||
if (bonusIt != race->mData.mBonus.end())
|
if (bonusIt != race->mData.mBonus.end())
|
||||||
raceBonus = bonusIt->mBonus;
|
raceBonus = bonusIt->mBonus;
|
||||||
|
|
||||||
for (const auto& skills : class_->mData.mSkills)
|
for (const auto& skills : npcClass->mData.mSkills)
|
||||||
{
|
{
|
||||||
// is this a minor or major skill?
|
// is this a minor or major skill?
|
||||||
if (std::find(skills.begin(), skills.end(), index) != skills.end())
|
if (std::find(skills.begin(), skills.end(), index) != skills.end())
|
||||||
|
@ -239,7 +239,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// is this skill in the same Specialization as the class?
|
// is this skill in the same Specialization as the class?
|
||||||
if (skill.mData.mSpecialization == class_->mData.mSpecialization)
|
if (skill.mData.mSpecialization == npcClass->mData.mSpecialization)
|
||||||
{
|
{
|
||||||
specMultiplier = 0.5f;
|
specMultiplier = 0.5f;
|
||||||
specBonus = 5;
|
specBonus = 5;
|
||||||
|
@ -1166,8 +1166,8 @@ namespace MWClass
|
||||||
const ESM::NPC* npc = actor.get<ESM::NPC>()->mBase;
|
const ESM::NPC* npc = actor.get<ESM::NPC>()->mBase;
|
||||||
if (npc->mFlags & ESM::NPC::Autocalc)
|
if (npc->mFlags & ESM::NPC::Autocalc)
|
||||||
{
|
{
|
||||||
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
const ESM::Class* npcClass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
||||||
return class_->mData.mServices;
|
return npcClass->mData.mServices;
|
||||||
}
|
}
|
||||||
return npc->mAiData.mServices;
|
return npc->mAiData.mServices;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,11 +62,11 @@ namespace MWClass
|
||||||
|
|
||||||
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots(const MWWorld::ConstPtr& ptr) const
|
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
|
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
slots.push_back(static_cast<int>(MWWorld::InventoryStore::Slot_CarriedRight));
|
||||||
|
|
||||||
return std::make_pair(slots_, false);
|
return std::make_pair(slots, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Probe::getValue(const MWWorld::ConstPtr& ptr) const
|
int Probe::getValue(const MWWorld::ConstPtr& ptr) const
|
||||||
|
|
|
@ -86,23 +86,23 @@ namespace MWClass
|
||||||
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();
|
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();
|
||||||
ESM::WeaponType::Class weapClass = MWMechanics::getWeaponType(ref->mBase->mData.mType)->mWeaponClass;
|
ESM::WeaponType::Class weapClass = MWMechanics::getWeaponType(ref->mBase->mData.mType)->mWeaponClass;
|
||||||
|
|
||||||
std::vector<int> slots_;
|
std::vector<int> slots;
|
||||||
bool stack = false;
|
bool stack = false;
|
||||||
|
|
||||||
if (weapClass == ESM::WeaponType::Ammo)
|
if (weapClass == ESM::WeaponType::Ammo)
|
||||||
{
|
{
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_Ammunition));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_Ammunition));
|
||||||
stack = true;
|
stack = true;
|
||||||
}
|
}
|
||||||
else if (weapClass == ESM::WeaponType::Thrown)
|
else if (weapClass == ESM::WeaponType::Thrown)
|
||||||
{
|
{
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
||||||
stack = true;
|
stack = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
slots_.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
slots.push_back(int(MWWorld::InventoryStore::Slot_CarriedRight));
|
||||||
|
|
||||||
return std::make_pair(slots_, stack);
|
return std::make_pair(slots, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::RefId Weapon::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
ESM::RefId Weapon::getEquipmentSkill(const MWWorld::ConstPtr& ptr, bool useLuaInterfaceIfAvailable) const
|
||||||
|
@ -278,9 +278,9 @@ namespace MWClass
|
||||||
if (hasItemHealth(ptr) && getItemHealth(ptr) == 0)
|
if (hasItemHealth(ptr) && getItemHealth(ptr) == 0)
|
||||||
return { 0, "#{sInventoryMessage1}" };
|
return { 0, "#{sInventoryMessage1}" };
|
||||||
|
|
||||||
std::pair<std::vector<int>, bool> slots_ = getEquipmentSlots(ptr);
|
std::pair<std::vector<int>, bool> slots = getEquipmentSlots(ptr);
|
||||||
|
|
||||||
if (slots_.first.empty())
|
if (slots.first.empty())
|
||||||
return { 0, {} };
|
return { 0, {} };
|
||||||
|
|
||||||
int type = ptr.get<ESM::Weapon>()->mBase->mData.mType;
|
int type = ptr.get<ESM::Weapon>()->mBase->mData.mType;
|
||||||
|
|
|
@ -96,8 +96,8 @@ namespace MWDialogue
|
||||||
if (tok->isExplicitLink())
|
if (tok->isExplicitLink())
|
||||||
{
|
{
|
||||||
// calculation of standard form for all hyperlinks
|
// calculation of standard form for all hyperlinks
|
||||||
size_t asterisk_count = HyperTextParser::removePseudoAsterisks(topicId);
|
size_t asteriskCount = HyperTextParser::removePseudoAsterisks(topicId);
|
||||||
for (; asterisk_count > 0; --asterisk_count)
|
for (; asteriskCount > 0; --asteriskCount)
|
||||||
topicId.append("*");
|
topicId.append("*");
|
||||||
|
|
||||||
topicId = mTranslationDataStorage.topicStandardForm(topicId);
|
topicId = mTranslationDataStorage.topicStandardForm(topicId);
|
||||||
|
|
|
@ -16,27 +16,28 @@ namespace MWDialogue
|
||||||
std::vector<Token> parseHyperText(const std::string& text)
|
std::vector<Token> parseHyperText(const std::string& text)
|
||||||
{
|
{
|
||||||
std::vector<Token> result;
|
std::vector<Token> result;
|
||||||
size_t pos_end = std::string::npos, iteration_pos = 0;
|
size_t posEnd = std::string::npos;
|
||||||
|
size_t iterationPos = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
size_t pos_begin = text.find('@', iteration_pos);
|
const size_t posBegin = text.find('@', iterationPos);
|
||||||
if (pos_begin != std::string::npos)
|
if (posBegin != std::string::npos)
|
||||||
pos_end = text.find('#', pos_begin);
|
posEnd = text.find('#', posBegin);
|
||||||
|
|
||||||
if (pos_begin != std::string::npos && pos_end != std::string::npos)
|
if (posBegin != std::string::npos && posEnd != std::string::npos)
|
||||||
{
|
{
|
||||||
if (pos_begin != iteration_pos)
|
if (posBegin != iterationPos)
|
||||||
tokenizeKeywords(text.substr(iteration_pos, pos_begin - iteration_pos), result);
|
tokenizeKeywords(text.substr(iterationPos, posBegin - iterationPos), result);
|
||||||
|
|
||||||
std::string link = text.substr(pos_begin + 1, pos_end - pos_begin - 1);
|
std::string link = text.substr(posBegin + 1, posEnd - posBegin - 1);
|
||||||
result.emplace_back(link, Token::ExplicitLink);
|
result.emplace_back(link, Token::ExplicitLink);
|
||||||
|
|
||||||
iteration_pos = pos_end + 1;
|
iterationPos = posEnd + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (iteration_pos != text.size())
|
if (iterationPos != text.size())
|
||||||
tokenizeKeywords(text.substr(iteration_pos), result);
|
tokenizeKeywords(text.substr(iterationPos), result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,16 +301,16 @@ namespace MWGui
|
||||||
Style* createHotStyle(Style* baseStyle, const Colour& normalColour, const Colour& hoverColour,
|
Style* createHotStyle(Style* baseStyle, const Colour& normalColour, const Colour& hoverColour,
|
||||||
const Colour& activeColour, InteractiveId id, bool unique) override
|
const Colour& activeColour, InteractiveId id, bool unique) override
|
||||||
{
|
{
|
||||||
StyleImpl* BaseStyle = static_cast<StyleImpl*>(baseStyle);
|
StyleImpl* const baseStyleImpl = static_cast<StyleImpl*>(baseStyle);
|
||||||
|
|
||||||
if (!unique)
|
if (!unique)
|
||||||
for (Styles::iterator i = mBook->mStyles.begin(); i != mBook->mStyles.end(); ++i)
|
for (Styles::iterator i = mBook->mStyles.begin(); i != mBook->mStyles.end(); ++i)
|
||||||
if (i->match(BaseStyle->mFont, hoverColour, activeColour, normalColour, id))
|
if (i->match(baseStyleImpl->mFont, hoverColour, activeColour, normalColour, id))
|
||||||
return &*i;
|
return &*i;
|
||||||
|
|
||||||
StyleImpl& style = *mBook->mStyles.insert(mBook->mStyles.end(), StyleImpl());
|
StyleImpl& style = *mBook->mStyles.insert(mBook->mStyles.end(), StyleImpl());
|
||||||
|
|
||||||
style.mFont = BaseStyle->mFont;
|
style.mFont = baseStyleImpl->mFont;
|
||||||
style.mHotColour = hoverColour;
|
style.mHotColour = hoverColour;
|
||||||
style.mActiveColour = activeColour;
|
style.mActiveColour = activeColour;
|
||||||
style.mNormalColour = normalColour;
|
style.mNormalColour = normalColour;
|
||||||
|
@ -351,10 +351,10 @@ namespace MWGui
|
||||||
assert(end <= mCurrentContent->size());
|
assert(end <= mCurrentContent->size());
|
||||||
assert(begin <= mCurrentContent->size());
|
assert(begin <= mCurrentContent->size());
|
||||||
|
|
||||||
Utf8Point begin_ = mCurrentContent->data() + begin;
|
const Utf8Point contentBegin = mCurrentContent->data() + begin;
|
||||||
Utf8Point end_ = mCurrentContent->data() + end;
|
const Utf8Point contentEnd = mCurrentContent->data() + end;
|
||||||
|
|
||||||
writeImpl(static_cast<StyleImpl*>(style), begin_, end_);
|
writeImpl(static_cast<StyleImpl*>(style), contentBegin, contentEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lineBreak(float margin) override
|
void lineBreak(float margin) override
|
||||||
|
@ -512,8 +512,8 @@ namespace MWGui
|
||||||
if (ucsBreakingSpace(stream.peek()) && !mPartialWord.empty())
|
if (ucsBreakingSpace(stream.peek()) && !mPartialWord.empty())
|
||||||
add_partial_text();
|
add_partial_text();
|
||||||
|
|
||||||
int word_width = 0;
|
int wordWidth = 0;
|
||||||
int space_width = 0;
|
int spaceWidth = 0;
|
||||||
|
|
||||||
Utf8Stream::Point lead = stream.current();
|
Utf8Stream::Point lead = stream.current();
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
|
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
|
||||||
if (info.charFound)
|
if (info.charFound)
|
||||||
space_width += static_cast<int>(info.advance + info.bearingX);
|
spaceWidth += static_cast<int>(info.advance + info.bearingX);
|
||||||
stream.consume();
|
stream.consume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
|
MWGui::GlyphInfo info = GlyphInfo(style->mFont, stream.peek());
|
||||||
if (info.charFound)
|
if (info.charFound)
|
||||||
word_width += static_cast<int>(info.advance + info.bearingX);
|
wordWidth += static_cast<int>(info.advance + info.bearingX);
|
||||||
stream.consume();
|
stream.consume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,9 +541,9 @@ namespace MWGui
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (lead != origin)
|
if (lead != origin)
|
||||||
mPartialWhitespace.emplace_back(style, lead, origin, space_width);
|
mPartialWhitespace.emplace_back(style, lead, origin, spaceWidth);
|
||||||
if (origin != extent)
|
if (origin != extent)
|
||||||
mPartialWord.emplace_back(style, origin, extent, word_width);
|
mPartialWord.emplace_back(style, origin, extent, wordWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,17 +553,17 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int fontHeight = Settings::gui().mFontSize;
|
const int fontHeight = Settings::gui().mFontSize;
|
||||||
int space_width = 0;
|
int spaceWidth = 0;
|
||||||
int word_width = 0;
|
int wordWidth = 0;
|
||||||
|
|
||||||
for (PartialTextConstIterator i = mPartialWhitespace.begin(); i != mPartialWhitespace.end(); ++i)
|
for (PartialTextConstIterator i = mPartialWhitespace.begin(); i != mPartialWhitespace.end(); ++i)
|
||||||
space_width += i->mWidth;
|
spaceWidth += i->mWidth;
|
||||||
for (PartialTextConstIterator i = mPartialWord.begin(); i != mPartialWord.end(); ++i)
|
for (PartialTextConstIterator i = mPartialWord.begin(); i != mPartialWord.end(); ++i)
|
||||||
word_width += i->mWidth;
|
wordWidth += i->mWidth;
|
||||||
|
|
||||||
int left = mLine ? mLine->mRect.right : 0;
|
int left = mLine ? mLine->mRect.right : 0;
|
||||||
|
|
||||||
if (left + space_width + word_width > mPageWidth)
|
if (left + spaceWidth + wordWidth > mPageWidth)
|
||||||
{
|
{
|
||||||
mLine = nullptr;
|
mLine = nullptr;
|
||||||
mRun = nullptr;
|
mRun = nullptr;
|
||||||
|
@ -952,9 +952,9 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (mFocusItem != nullptr)
|
if (mFocusItem != nullptr)
|
||||||
{
|
{
|
||||||
MyGUI::IFont* Font = mBook->affectedFont(mFocusItem);
|
MyGUI::IFont* const font = mBook->affectedFont(mFocusItem);
|
||||||
|
|
||||||
ActiveTextFormats::iterator i = mActiveTextFormats.find(Font);
|
ActiveTextFormats::iterator i = mActiveTextFormats.find(font);
|
||||||
|
|
||||||
if (mNode && i != mActiveTextFormats.end())
|
if (mNode && i != mActiveTextFormats.end())
|
||||||
mNode->outOfDate(i->second->mRenderItem);
|
mNode->outOfDate(i->second->mRenderItem);
|
||||||
|
@ -1119,17 +1119,17 @@ namespace MWGui
|
||||||
|
|
||||||
void operator()(Section const& section, Line const& line, Run const& run) const
|
void operator()(Section const& section, Line const& line, Run const& run) const
|
||||||
{
|
{
|
||||||
MyGUI::IFont* Font = run.mStyle->mFont;
|
MyGUI::IFont* const font = run.mStyle->mFont;
|
||||||
|
|
||||||
ActiveTextFormats::iterator j = this_->mActiveTextFormats.find(Font);
|
ActiveTextFormats::iterator j = this_->mActiveTextFormats.find(font);
|
||||||
|
|
||||||
if (j == this_->mActiveTextFormats.end())
|
if (j == this_->mActiveTextFormats.end())
|
||||||
{
|
{
|
||||||
auto textFormat = std::make_unique<TextFormat>(Font, this_);
|
auto textFormat = std::make_unique<TextFormat>(font, this_);
|
||||||
|
|
||||||
textFormat->mTexture = Font->getTextureFont();
|
textFormat->mTexture = font->getTextureFont();
|
||||||
|
|
||||||
j = this_->mActiveTextFormats.insert(std::make_pair(Font, std::move(textFormat))).first;
|
j = this_->mActiveTextFormats.insert(std::make_pair(font, std::move(textFormat))).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
j->second->mCountVertex += run.mPrintableChars * 6;
|
j->second->mCountVertex += run.mPrintableChars * 6;
|
||||||
|
@ -1201,15 +1201,15 @@ namespace MWGui
|
||||||
|
|
||||||
while (!stream.eof())
|
while (!stream.eof())
|
||||||
{
|
{
|
||||||
Utf8Stream::UnicodeChar code_point = stream.consume();
|
const Utf8Stream::UnicodeChar codePoint = stream.consume();
|
||||||
|
|
||||||
if (ucsCarriageReturn(code_point))
|
if (ucsCarriageReturn(codePoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ucsSpace(code_point))
|
if (!ucsSpace(codePoint))
|
||||||
glyphStream.emitGlyph(code_point);
|
glyphStream.emitGlyph(codePoint);
|
||||||
else
|
else
|
||||||
glyphStream.emitSpace(code_point);
|
glyphStream.emitSpace(codePoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1231,10 +1231,10 @@ namespace MWGui
|
||||||
GlyphStream glyphStream(textFormat.mFont, static_cast<float>(mCoord.left),
|
GlyphStream glyphStream(textFormat.mFont, static_cast<float>(mCoord.left),
|
||||||
static_cast<float>(mCoord.top - mViewTop), z /*mNode->getNodeDepth()*/, vertices, renderXform);
|
static_cast<float>(mCoord.top - mViewTop), z /*mNode->getNodeDepth()*/, vertices, renderXform);
|
||||||
|
|
||||||
int visit_top = (std::max)(mViewTop, mViewTop + int(renderXform.clipTop));
|
const int visitTop = std::max(mViewTop, mViewTop + static_cast<int>(renderXform.clipTop));
|
||||||
int visit_bottom = (std::min)(mViewBottom, mViewTop + int(renderXform.clipBottom));
|
const int visitBottom = std::min(mViewBottom, mViewTop + static_cast<int>(renderXform.clipBottom));
|
||||||
|
|
||||||
mBook->visitRuns(visit_top, visit_bottom, textFormat.mFont, RenderRun(this, glyphStream));
|
mBook->visitRuns(visitTop, visitBottom, textFormat.mFont, RenderRun(this, glyphStream));
|
||||||
|
|
||||||
textFormat.mRenderItem->setLastVertexCount(glyphStream.end() - vertices);
|
textFormat.mRenderItem->setLastVertexCount(glyphStream.end() - vertices);
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,7 +634,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
std::string output = input;
|
std::string output = input;
|
||||||
std::string tmp = input;
|
std::string tmp = input;
|
||||||
bool has_front_quote = false;
|
bool hasFrontQuote = false;
|
||||||
|
|
||||||
/* Does the input string contain things that don't have to be completed? If yes erase them. */
|
/* Does the input string contain things that don't have to be completed? If yes erase them. */
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ namespace MWGui
|
||||||
if (numquotes % 2)
|
if (numquotes % 2)
|
||||||
{
|
{
|
||||||
tmp.erase(0, tmp.rfind('"') + 1);
|
tmp.erase(0, tmp.rfind('"') + 1);
|
||||||
has_front_quote = true;
|
hasFrontQuote = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -672,7 +672,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
tmp.clear();
|
tmp.clear();
|
||||||
}
|
}
|
||||||
has_front_quote = false;
|
hasFrontQuote = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* No quotation marks. Are there spaces?*/
|
/* No quotation marks. Are there spaces?*/
|
||||||
|
@ -706,7 +706,7 @@ namespace MWGui
|
||||||
/* Iterate through the vector. */
|
/* Iterate through the vector. */
|
||||||
for (std::string& name : mNames)
|
for (std::string& name : mNames)
|
||||||
{
|
{
|
||||||
bool string_different = false;
|
bool stringDifferent = false;
|
||||||
|
|
||||||
/* Is the string shorter than the input string? If yes skip it. */
|
/* Is the string shorter than the input string? If yes skip it. */
|
||||||
if (name.length() < tmp.length())
|
if (name.length() < tmp.length())
|
||||||
|
@ -717,12 +717,12 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (Misc::StringUtils::toLower(*iter) != Misc::StringUtils::toLower(*iter2))
|
if (Misc::StringUtils::toLower(*iter) != Misc::StringUtils::toLower(*iter2))
|
||||||
{
|
{
|
||||||
string_different = true;
|
stringDifferent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string_different)
|
if (stringDifferent)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* The beginning of the string matches the input string, save it for the next test. */
|
/* The beginning of the string matches the input string, save it for the next test. */
|
||||||
|
@ -741,11 +741,11 @@ namespace MWGui
|
||||||
/* Adding quotation marks when the input string started with a quotation mark or has spaces in it*/
|
/* Adding quotation marks when the input string started with a quotation mark or has spaces in it*/
|
||||||
if ((matches.front().find(' ') != std::string::npos))
|
if ((matches.front().find(' ') != std::string::npos))
|
||||||
{
|
{
|
||||||
if (!has_front_quote)
|
if (!hasFrontQuote)
|
||||||
output += '"';
|
output += '"';
|
||||||
return output.append(matches.front() + std::string("\" "));
|
return output.append(matches.front() + std::string("\" "));
|
||||||
}
|
}
|
||||||
else if (has_front_quote)
|
else if (hasFrontQuote)
|
||||||
{
|
{
|
||||||
return output.append(matches.front() + std::string("\" "));
|
return output.append(matches.front() + std::string("\" "));
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,16 +181,16 @@ namespace MWGui
|
||||||
// We need this copy for when @# hyperlinks are replaced
|
// We need this copy for when @# hyperlinks are replaced
|
||||||
std::string text = mText;
|
std::string text = mText;
|
||||||
|
|
||||||
size_t pos_end = std::string::npos;
|
size_t posEnd = std::string::npos;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
size_t pos_begin = text.find('@');
|
const size_t posBegin = text.find('@');
|
||||||
if (pos_begin != std::string::npos)
|
if (posBegin != std::string::npos)
|
||||||
pos_end = text.find('#', pos_begin);
|
posEnd = text.find('#', posBegin);
|
||||||
|
|
||||||
if (pos_begin != std::string::npos && pos_end != std::string::npos)
|
if (posBegin != std::string::npos && posEnd != std::string::npos)
|
||||||
{
|
{
|
||||||
std::string link = text.substr(pos_begin + 1, pos_end - pos_begin - 1);
|
std::string link = text.substr(posBegin + 1, posEnd - posBegin - 1);
|
||||||
const char specialPseudoAsteriskCharacter = 127;
|
const char specialPseudoAsteriskCharacter = 127;
|
||||||
std::replace(link.begin(), link.end(), specialPseudoAsteriskCharacter, '*');
|
std::replace(link.begin(), link.end(), specialPseudoAsteriskCharacter, '*');
|
||||||
std::string topicName
|
std::string topicName
|
||||||
|
@ -200,10 +200,10 @@ namespace MWGui
|
||||||
while (displayName[displayName.size() - 1] == '*')
|
while (displayName[displayName.size() - 1] == '*')
|
||||||
displayName.erase(displayName.size() - 1, 1);
|
displayName.erase(displayName.size() - 1, 1);
|
||||||
|
|
||||||
text.replace(pos_begin, pos_end + 1 - pos_begin, displayName);
|
text.replace(posBegin, posEnd + 1 - posBegin, displayName);
|
||||||
|
|
||||||
if (topicLinks.find(topicName) != topicLinks.end())
|
if (topicLinks.find(topicName) != topicLinks.end())
|
||||||
hyperLinks[std::make_pair(pos_begin, pos_begin + displayName.size())]
|
hyperLinks[std::make_pair(posBegin, posBegin + displayName.size())]
|
||||||
= intptr_t(topicLinks[topicName].get());
|
= intptr_t(topicLinks[topicName].get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -657,8 +657,8 @@ namespace MWGui
|
||||||
|
|
||||||
MWWorld::Ptr InventoryWindow::getAvatarSelectedItem(int x, int y)
|
MWWorld::Ptr InventoryWindow::getAvatarSelectedItem(int x, int y)
|
||||||
{
|
{
|
||||||
const osg::Vec2f viewport_coords = mapPreviewWindowToViewport(x, y);
|
const osg::Vec2f viewportCoords = mapPreviewWindowToViewport(x, y);
|
||||||
int slot = mPreview->getSlotSelected(viewport_coords.x(), viewport_coords.y());
|
int slot = mPreview->getSlotSelected(viewportCoords.x(), viewportCoords.y());
|
||||||
|
|
||||||
if (slot == -1)
|
if (slot == -1)
|
||||||
return MWWorld::Ptr();
|
return MWWorld::Ptr();
|
||||||
|
|
|
@ -105,16 +105,16 @@ namespace MWGui
|
||||||
|
|
||||||
utf8text = getText();
|
utf8text = getText();
|
||||||
|
|
||||||
size_t pos_end = 0;
|
size_t posEnd = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
size_t pos_begin = utf8text.find('@');
|
const size_t posBegin = utf8text.find('@');
|
||||||
if (pos_begin != std::string::npos)
|
if (posBegin != std::string::npos)
|
||||||
pos_end = utf8text.find('#', pos_begin);
|
posEnd = utf8text.find('#', posBegin);
|
||||||
|
|
||||||
if (pos_begin != std::string::npos && pos_end != std::string::npos)
|
if (posBegin != std::string::npos && posEnd != std::string::npos)
|
||||||
{
|
{
|
||||||
std::string link = utf8text.substr(pos_begin + 1, pos_end - pos_begin - 1);
|
std::string link = utf8text.substr(posBegin + 1, posEnd - posBegin - 1);
|
||||||
const char specialPseudoAsteriskCharacter = 127;
|
const char specialPseudoAsteriskCharacter = 127;
|
||||||
std::replace(link.begin(), link.end(), specialPseudoAsteriskCharacter, '*');
|
std::replace(link.begin(), link.end(), specialPseudoAsteriskCharacter, '*');
|
||||||
std::string_view topicName = MWBase::Environment::get()
|
std::string_view topicName = MWBase::Environment::get()
|
||||||
|
@ -126,11 +126,11 @@ namespace MWGui
|
||||||
while (displayName[displayName.size() - 1] == '*')
|
while (displayName[displayName.size() - 1] == '*')
|
||||||
displayName.erase(displayName.size() - 1, 1);
|
displayName.erase(displayName.size() - 1, 1);
|
||||||
|
|
||||||
utf8text.replace(pos_begin, pos_end + 1 - pos_begin, displayName);
|
utf8text.replace(posBegin, posEnd + 1 - posBegin, displayName);
|
||||||
|
|
||||||
intptr_t value = 0;
|
intptr_t value = 0;
|
||||||
if (mModel->mKeywordSearch.containsKeyword(topicName, value))
|
if (mModel->mKeywordSearch.containsKeyword(topicName, value))
|
||||||
mHyperLinks[std::make_pair(pos_begin, pos_begin + displayName.size())] = value;
|
mHyperLinks[std::make_pair(posBegin, posBegin + displayName.size())] = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,23 +11,23 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
void Layout::initialise(std::string_view _layout)
|
void Layout::initialise(std::string_view _layout)
|
||||||
{
|
{
|
||||||
const auto MAIN_WINDOW = "_Main";
|
constexpr char mainWindow[] = "_Main";
|
||||||
mLayoutName = _layout;
|
mLayoutName = _layout;
|
||||||
|
|
||||||
mPrefix = MyGUI::utility::toString(this, "_");
|
mPrefix = MyGUI::utility::toString(this, "_");
|
||||||
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix);
|
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix);
|
||||||
|
|
||||||
const std::string main_name = mPrefix + MAIN_WINDOW;
|
const std::string mainName = mPrefix + mainWindow;
|
||||||
for (MyGUI::Widget* widget : mListWindowRoot)
|
for (MyGUI::Widget* widget : mListWindowRoot)
|
||||||
{
|
{
|
||||||
if (widget->getName() == main_name)
|
if (widget->getName() == mainName)
|
||||||
mMainWidget = widget;
|
mMainWidget = widget;
|
||||||
|
|
||||||
// Force the alignment to update immediately
|
// Force the alignment to update immediately
|
||||||
widget->_setAlign(widget->getSize(), widget->getParentSize());
|
widget->_setAlign(widget->getSize(), widget->getParentSize());
|
||||||
}
|
}
|
||||||
MYGUI_ASSERT(
|
MYGUI_ASSERT(
|
||||||
mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found.");
|
mMainWidget, "root widget name '" << mainWindow << "' in layout '" << mLayoutName << "' not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layout::shutdown()
|
void Layout::shutdown()
|
||||||
|
|
|
@ -59,11 +59,10 @@ namespace MWGui
|
||||||
void LoadingScreen::findSplashScreens()
|
void LoadingScreen::findSplashScreens()
|
||||||
{
|
{
|
||||||
auto isSupportedExtension = [](const std::string_view& ext) {
|
auto isSupportedExtension = [](const std::string_view& ext) {
|
||||||
static const std::array<std::string, 7> supported_extensions{ { "tga", "dds", "ktx", "png", "bmp", "jpeg",
|
static const std::array<std::string, 7> supportedExtensions{ { "tga", "dds", "ktx", "png", "bmp", "jpeg",
|
||||||
"jpg" } };
|
"jpg" } };
|
||||||
return !ext.empty()
|
return !ext.empty()
|
||||||
&& std::find(supported_extensions.begin(), supported_extensions.end(), ext)
|
&& std::find(supportedExtensions.begin(), supportedExtensions.end(), ext) != supportedExtensions.end();
|
||||||
!= supported_extensions.end();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr VFS::Path::NormalizedView splash("splash/");
|
constexpr VFS::Path::NormalizedView splash("splash/");
|
||||||
|
|
|
@ -1078,13 +1078,13 @@ namespace MWGui
|
||||||
MapMarkerType mapMarkerWidget = { osg::Vec2f(x, y), createMarker(name, x, y, 0) };
|
MapMarkerType mapMarkerWidget = { osg::Vec2f(x, y), createMarker(name, x, y, 0) };
|
||||||
mGlobalMapMarkers.emplace(mapMarkerWidget, std::vector<MapMarkerType>());
|
mGlobalMapMarkers.emplace(mapMarkerWidget, std::vector<MapMarkerType>());
|
||||||
|
|
||||||
std::string name_ = name.substr(0, name.find(','));
|
const std::string markerName = name.substr(0, name.find(','));
|
||||||
auto& entry = mGlobalMapMarkersByName[name_];
|
auto& entry = mGlobalMapMarkersByName[markerName];
|
||||||
if (!entry.widget)
|
if (!entry.widget)
|
||||||
{
|
{
|
||||||
entry = { osg::Vec2f(x, y), entry.widget }; // update the coords
|
entry = { osg::Vec2f(x, y), entry.widget }; // update the coords
|
||||||
|
|
||||||
entry.widget = createMarker(name_, entry.position.x(), entry.position.y(), 1);
|
entry.widget = createMarker(markerName, entry.position.x(), entry.position.y(), 1);
|
||||||
mGlobalMapMarkers.emplace(entry, std::vector<MapMarkerType>{ entry });
|
mGlobalMapMarkers.emplace(entry, std::vector<MapMarkerType>{ entry });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -323,21 +323,21 @@ namespace MWGui
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
const std::string_view NA = "#{Interface:NotAvailableShort}";
|
const std::string_view notAvailable = "#{Interface:NotAvailableShort}";
|
||||||
const char endl = '\n';
|
const char endl = '\n';
|
||||||
|
|
||||||
std::string_view author = technique->getAuthor().empty() ? NA : technique->getAuthor();
|
std::string_view author = technique->getAuthor().empty() ? notAvailable : technique->getAuthor();
|
||||||
std::string_view version = technique->getVersion().empty() ? NA : technique->getVersion();
|
std::string_view version = technique->getVersion().empty() ? notAvailable : technique->getVersion();
|
||||||
std::string_view description = technique->getDescription().empty() ? NA : technique->getDescription();
|
std::string_view description = technique->getDescription().empty() ? notAvailable : technique->getDescription();
|
||||||
|
|
||||||
auto serializeBool = [](bool value) { return value ? "#{Interface:Yes}" : "#{Interface:No}"; };
|
auto serializeBool = [](bool value) { return value ? "#{Interface:Yes}" : "#{Interface:No}"; };
|
||||||
|
|
||||||
const auto flags = technique->getFlags();
|
const auto flags = technique->getFlags();
|
||||||
|
|
||||||
const auto flag_interior = serializeBool(!(flags & Fx::Technique::Flag_Disable_Interiors));
|
const auto flagInterior = serializeBool(!(flags & Fx::Technique::Flag_Disable_Interiors));
|
||||||
const auto flag_exterior = serializeBool(!(flags & Fx::Technique::Flag_Disable_Exteriors));
|
const auto flagExterior = serializeBool(!(flags & Fx::Technique::Flag_Disable_Exteriors));
|
||||||
const auto flag_underwater = serializeBool(!(flags & Fx::Technique::Flag_Disable_Underwater));
|
const auto flagUnderwater = serializeBool(!(flags & Fx::Technique::Flag_Disable_Underwater));
|
||||||
const auto flag_abovewater = serializeBool(!(flags & Fx::Technique::Flag_Disable_Abovewater));
|
const auto flagAbovewater = serializeBool(!(flags & Fx::Technique::Flag_Disable_Abovewater));
|
||||||
|
|
||||||
switch (technique->getStatus())
|
switch (technique->getStatus())
|
||||||
{
|
{
|
||||||
|
@ -356,12 +356,11 @@ namespace MWGui
|
||||||
<< "#{fontcolourhtml=header}#{OMWShaders:Description}: #{fontcolourhtml=normal} " << description
|
<< "#{fontcolourhtml=header}#{OMWShaders:Description}: #{fontcolourhtml=normal} " << description
|
||||||
<< endl
|
<< endl
|
||||||
<< endl
|
<< endl
|
||||||
<< "#{fontcolourhtml=header}#{OMWShaders:InInteriors}: #{fontcolourhtml=normal} " << flag_interior
|
<< "#{fontcolourhtml=header}#{OMWShaders:InInteriors}: #{fontcolourhtml=normal} " << flagInterior
|
||||||
<< "#{fontcolourhtml=header} #{OMWShaders:InExteriors}: #{fontcolourhtml=normal} " << flag_exterior
|
<< "#{fontcolourhtml=header} #{OMWShaders:InExteriors}: #{fontcolourhtml=normal} " << flagExterior
|
||||||
<< "#{fontcolourhtml=header} #{OMWShaders:Underwater}: #{fontcolourhtml=normal} "
|
<< "#{fontcolourhtml=header} #{OMWShaders:Underwater}: #{fontcolourhtml=normal} " << flagUnderwater
|
||||||
<< flag_underwater
|
|
||||||
<< "#{fontcolourhtml=header} #{OMWShaders:Abovewater}: #{fontcolourhtml=normal} "
|
<< "#{fontcolourhtml=header} #{OMWShaders:Abovewater}: #{fontcolourhtml=normal} "
|
||||||
<< flag_abovewater;
|
<< flagAbovewater;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Fx::Technique::Status::Parse_Error:
|
case Fx::Technique::Status::Parse_Error:
|
||||||
|
|
|
@ -186,10 +186,10 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Find the localised name for this class from the store
|
// Find the localised name for this class from the store
|
||||||
const ESM::Class* class_
|
const ESM::Class* playerClass
|
||||||
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().search(signature.mPlayerClassId);
|
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().search(signature.mPlayerClassId);
|
||||||
if (class_)
|
if (playerClass)
|
||||||
className = class_->mName;
|
className = playerClass->mName;
|
||||||
else
|
else
|
||||||
className = "?"; // From an older savegame format that did not support custom classes properly.
|
className = "?"; // From an older savegame format that did not support custom classes properly.
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,15 +325,15 @@ namespace MWGui
|
||||||
NoDrop::onFrame(dt);
|
NoDrop::onFrame(dt);
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
const MWMechanics::NpcStats& PCstats = player.getClass().getNpcStats(player);
|
const MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats(player);
|
||||||
const auto& store = MWBase::Environment::get().getESMStore();
|
const auto& store = MWBase::Environment::get().getESMStore();
|
||||||
|
|
||||||
std::stringstream detail;
|
std::stringstream detail;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (const auto& attribute : store->get<ESM::Attribute>())
|
for (const auto& attribute : store->get<ESM::Attribute>())
|
||||||
{
|
{
|
||||||
float mult = PCstats.getLevelupAttributeMultiplier(attribute.mId);
|
float mult = playerStats.getLevelupAttributeMultiplier(attribute.mId);
|
||||||
mult = std::min(mult, 100 - PCstats.getAttribute(attribute.mId).getBase());
|
mult = std::min(mult, 100 - playerStats.getAttribute(attribute.mId).getBase());
|
||||||
if (mult > 1)
|
if (mult > 1)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
|
@ -352,21 +352,21 @@ namespace MWGui
|
||||||
getWidget(levelWidget, i == 0 ? "Level_str" : "LevelText");
|
getWidget(levelWidget, i == 0 ? "Level_str" : "LevelText");
|
||||||
|
|
||||||
levelWidget->setUserString(
|
levelWidget->setUserString(
|
||||||
"RangePosition_LevelProgress", MyGUI::utility::toString(PCstats.getLevelProgress()));
|
"RangePosition_LevelProgress", MyGUI::utility::toString(playerStats.getLevelProgress()));
|
||||||
levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max));
|
levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max));
|
||||||
levelWidget->setUserString("Caption_LevelProgressText",
|
levelWidget->setUserString("Caption_LevelProgressText",
|
||||||
MyGUI::utility::toString(PCstats.getLevelProgress()) + "/" + MyGUI::utility::toString(max));
|
MyGUI::utility::toString(playerStats.getLevelProgress()) + "/" + MyGUI::utility::toString(max));
|
||||||
levelWidget->setUserString("Caption_LevelDetailText", detailText);
|
levelWidget->setUserString("Caption_LevelDetailText", detailText);
|
||||||
}
|
}
|
||||||
|
|
||||||
setFactions(PCstats.getFactionRanks());
|
setFactions(playerStats.getFactionRanks());
|
||||||
setExpelled(PCstats.getExpelled());
|
setExpelled(playerStats.getExpelled());
|
||||||
|
|
||||||
const auto& signId = MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
const auto& signId = MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
||||||
|
|
||||||
setBirthSign(signId);
|
setBirthSign(signId);
|
||||||
setReputation(PCstats.getReputation());
|
setReputation(playerStats.getReputation());
|
||||||
setBounty(PCstats.getBounty());
|
setBounty(playerStats.getBounty());
|
||||||
|
|
||||||
if (mChanged)
|
if (mChanged)
|
||||||
updateSkillArea();
|
updateSkillArea();
|
||||||
|
@ -578,8 +578,8 @@ namespace MWGui
|
||||||
if (!mFactions.empty())
|
if (!mFactions.empty())
|
||||||
{
|
{
|
||||||
MWWorld::Ptr playerPtr = MWMechanics::getPlayer();
|
MWWorld::Ptr playerPtr = MWMechanics::getPlayer();
|
||||||
const MWMechanics::NpcStats& PCstats = playerPtr.getClass().getNpcStats(playerPtr);
|
const MWMechanics::NpcStats& playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||||
const std::set<ESM::RefId>& expelled = PCstats.getExpelled();
|
const std::set<ESM::RefId>& expelled = playerStats.getExpelled();
|
||||||
|
|
||||||
bool firstFaction = true;
|
bool firstFaction = true;
|
||||||
for (const auto& [factionId, factionRank] : mFactions)
|
for (const auto& [factionId, factionRank] : mFactions)
|
||||||
|
|
|
@ -604,17 +604,17 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mHorizontalScrollIndex = -totalSize.width;
|
mHorizontalScrollIndex = -totalSize.width;
|
||||||
}
|
}
|
||||||
int horizontal_scroll = mHorizontalScrollIndex;
|
int horizontalScroll = mHorizontalScrollIndex;
|
||||||
if (horizontal_scroll < 40)
|
if (horizontalScroll < 40)
|
||||||
{
|
{
|
||||||
horizontal_scroll = 40;
|
horizontalScroll = 40;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
horizontal_scroll = 80 - mHorizontalScrollIndex;
|
horizontalScroll = 80 - mHorizontalScrollIndex;
|
||||||
}
|
}
|
||||||
captionWidget->setPosition(
|
captionWidget->setPosition(
|
||||||
MyGUI::IntPoint(horizontal_scroll, captionWidget->getPosition().top + padding.top));
|
MyGUI::IntPoint(horizontalScroll, captionWidget->getPosition().top + padding.top));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,9 +55,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ESM::Position PlayerPos = player.getRefData().getPosition();
|
const ESM::Position playerPos = player.getRefData().getPosition();
|
||||||
float d = sqrt(pow(pos.pos[0] - PlayerPos.pos[0], 2) + pow(pos.pos[1] - PlayerPos.pos[1], 2)
|
float d = sqrt(pow(pos.pos[0] - playerPos.pos[0], 2) + pow(pos.pos[1] - playerPos.pos[1], 2)
|
||||||
+ pow(pos.pos[2] - PlayerPos.pos[2], 2));
|
+ pow(pos.pos[2] - playerPos.pos[2], 2));
|
||||||
float fTravelMult = gmst.find("fTravelMult")->mValue.getFloat();
|
float fTravelMult = gmst.find("fTravelMult")->mValue.getFloat();
|
||||||
if (fTravelMult != 0)
|
if (fTravelMult != 0)
|
||||||
price = static_cast<int>(d / fTravelMult);
|
price = static_cast<int>(d / fTravelMult);
|
||||||
|
|
|
@ -1096,19 +1096,19 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
std::string_view tag = _tag;
|
std::string_view tag = _tag;
|
||||||
|
|
||||||
std::string_view MyGuiPrefix = "setting=";
|
constexpr std::string_view myGuiPrefix = "setting=";
|
||||||
|
|
||||||
std::string_view tokenToFind = "sCell=";
|
constexpr std::string_view tokenToFind = "sCell=";
|
||||||
|
|
||||||
if (tag.starts_with(MyGuiPrefix))
|
if (tag.starts_with(myGuiPrefix))
|
||||||
{
|
{
|
||||||
tag = tag.substr(MyGuiPrefix.length());
|
tag = tag.substr(myGuiPrefix.length());
|
||||||
size_t comma_pos = tag.find(',');
|
const size_t commaPos = tag.find(',');
|
||||||
if (comma_pos == std::string_view::npos)
|
if (commaPos == std::string_view::npos)
|
||||||
throw std::runtime_error("Invalid setting tag (expected comma): " + std::string(tag));
|
throw std::runtime_error("Invalid setting tag (expected comma): " + std::string(tag));
|
||||||
|
|
||||||
std::string_view settingSection = tag.substr(0, comma_pos);
|
std::string_view settingSection = tag.substr(0, commaPos);
|
||||||
std::string_view settingTag = tag.substr(comma_pos + 1, tag.length());
|
std::string_view settingTag = tag.substr(commaPos + 1, tag.length());
|
||||||
|
|
||||||
_result = Settings::get<MyGUI::Colour>(settingSection, settingTag).get().print();
|
_result = Settings::get<MyGUI::Colour>(settingSection, settingTag).get().print();
|
||||||
}
|
}
|
||||||
|
@ -2244,12 +2244,12 @@ namespace MWGui
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
{
|
{
|
||||||
// everything looks good, send it to the cursor manager
|
// everything looks good, send it to the cursor manager
|
||||||
Uint8 hotspot_x = imgSetPointer->getHotSpot().left;
|
const Uint8 hotspotX = imgSetPointer->getHotSpot().left;
|
||||||
Uint8 hotspot_y = imgSetPointer->getHotSpot().top;
|
const Uint8 hotspotY = imgSetPointer->getHotSpot().top;
|
||||||
int rotation = imgSetPointer->getRotation();
|
int rotation = imgSetPointer->getRotation();
|
||||||
MyGUI::IntSize pointerSize = imgSetPointer->getSize();
|
MyGUI::IntSize pointerSize = imgSetPointer->getSize();
|
||||||
|
|
||||||
mCursorManager->createCursor(imgSetPointer->getResourceName(), rotation, image, hotspot_x, hotspot_y,
|
mCursorManager->createCursor(imgSetPointer->getResourceName(), rotation, image, hotspotX, hotspotY,
|
||||||
pointerSize.width, pointerSize.height);
|
pointerSize.width, pointerSize.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,10 +330,9 @@ namespace MWInput
|
||||||
float ControllerManager::getAxisValue(SDL_GameControllerAxis axis) const
|
float ControllerManager::getAxisValue(SDL_GameControllerAxis axis) const
|
||||||
{
|
{
|
||||||
SDL_GameController* cntrl = mBindingsManager->getControllerOrNull();
|
SDL_GameController* cntrl = mBindingsManager->getControllerOrNull();
|
||||||
constexpr int AXIS_MAX_ABSOLUTE_VALUE = 32768;
|
constexpr float axisMaxAbsoluteValue = 32768;
|
||||||
if (cntrl)
|
if (cntrl != nullptr)
|
||||||
return SDL_GameControllerGetAxis(cntrl, axis) / static_cast<float>(AXIS_MAX_ABSOLUTE_VALUE);
|
return SDL_GameControllerGetAxis(cntrl, axis) / axisMaxAbsoluteValue;
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,9 @@ namespace MWLua
|
||||||
contentFiles[LuaUtil::toLuaIndex(i)] = Misc::StringUtils::lowerCase(slot.mProfile.mContentFiles[i]);
|
contentFiles[LuaUtil::toLuaIndex(i)] = Misc::StringUtils::lowerCase(slot.mProfile.mContentFiles[i]);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto system_time = std::chrono::system_clock::now()
|
const auto systemTime = std::chrono::system_clock::now()
|
||||||
- (std::filesystem::file_time_type::clock::now() - slot.mTimeStamp);
|
- (std::filesystem::file_time_type::clock::now() - slot.mTimeStamp);
|
||||||
slotInfo["creationTime"] = std::chrono::duration<double>(system_time.time_since_epoch()).count();
|
slotInfo["creationTime"] = std::chrono::duration<double>(systemTime.time_since_epoch()).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
slotInfo["contentFiles"] = contentFiles;
|
slotInfo["contentFiles"] = contentFiles;
|
||||||
|
|
|
@ -31,14 +31,14 @@ namespace MWLua
|
||||||
static std::pair<MWWorld::ContainerStoreIterator, bool> findInInventory(
|
static std::pair<MWWorld::ContainerStoreIterator, bool> findInInventory(
|
||||||
MWWorld::InventoryStore& store, const EquipmentItem& item, int slot = sAnySlot)
|
MWWorld::InventoryStore& store, const EquipmentItem& item, int slot = sAnySlot)
|
||||||
{
|
{
|
||||||
auto old_it = slot != sAnySlot ? store.getSlot(slot) : store.end();
|
auto oldIt = slot != sAnySlot ? store.getSlot(slot) : store.end();
|
||||||
MWWorld::Ptr itemPtr;
|
MWWorld::Ptr itemPtr;
|
||||||
|
|
||||||
if (std::holds_alternative<ObjectId>(item))
|
if (std::holds_alternative<ObjectId>(item))
|
||||||
{
|
{
|
||||||
itemPtr = MWBase::Environment::get().getWorldModel()->getPtr(std::get<ObjectId>(item));
|
itemPtr = MWBase::Environment::get().getWorldModel()->getPtr(std::get<ObjectId>(item));
|
||||||
if (old_it != store.end() && *old_it == itemPtr)
|
if (oldIt != store.end() && *oldIt == itemPtr)
|
||||||
return { old_it, true }; // already equipped
|
return { oldIt, true }; // already equipped
|
||||||
if (itemPtr.isEmpty() || itemPtr.getCellRef().getCount() == 0
|
if (itemPtr.isEmpty() || itemPtr.getCellRef().getCount() == 0
|
||||||
|| itemPtr.getContainerStore() != static_cast<const MWWorld::ContainerStore*>(&store))
|
|| itemPtr.getContainerStore() != static_cast<const MWWorld::ContainerStore*>(&store))
|
||||||
{
|
{
|
||||||
|
@ -50,8 +50,8 @@ namespace MWLua
|
||||||
{
|
{
|
||||||
const auto& stringId = std::get<std::string>(item);
|
const auto& stringId = std::get<std::string>(item);
|
||||||
ESM::RefId recordId = ESM::RefId::deserializeText(stringId);
|
ESM::RefId recordId = ESM::RefId::deserializeText(stringId);
|
||||||
if (old_it != store.end() && old_it->getCellRef().getRefId() == recordId)
|
if (oldIt != store.end() && oldIt->getCellRef().getRefId() == recordId)
|
||||||
return { old_it, true }; // already equipped
|
return { oldIt, true }; // already equipped
|
||||||
itemPtr = store.search(recordId);
|
itemPtr = store.search(recordId);
|
||||||
if (itemPtr.isEmpty() || itemPtr.getCellRef().getCount() == 0)
|
if (itemPtr.isEmpty() || itemPtr.getCellRef().getCount() == 0)
|
||||||
{
|
{
|
||||||
|
@ -119,15 +119,15 @@ namespace MWLua
|
||||||
|
|
||||||
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
||||||
{
|
{
|
||||||
auto old_it = store.getSlot(slot);
|
auto oldIt = store.getSlot(slot);
|
||||||
auto new_it = equipment.find(slot);
|
auto newIt = equipment.find(slot);
|
||||||
if (new_it == equipment.end())
|
if (newIt == equipment.end())
|
||||||
{
|
{
|
||||||
if (old_it != store.end())
|
if (oldIt != store.end())
|
||||||
store.unequipSlot(slot);
|
store.unequipSlot(slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tryEquipToSlot(slot, new_it->second))
|
if (tryEquipToSlot(slot, newIt->second))
|
||||||
usedSlots[slot] = true;
|
usedSlots[slot] = true;
|
||||||
}
|
}
|
||||||
for (const auto& [slot, item] : equipment)
|
for (const auto& [slot, item] : equipment)
|
||||||
|
|
|
@ -762,9 +762,9 @@ namespace MWMechanics
|
||||||
// start combat with actor2.
|
// start combat with actor2.
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
bool LOS = world->getLOS(actor1, actor2) && mechanicsManager->awarenessCheck(actor2, actor1);
|
const bool los = world->getLOS(actor1, actor2) && mechanicsManager->awarenessCheck(actor2, actor1);
|
||||||
|
|
||||||
if (LOS)
|
if (los)
|
||||||
mechanicsManager->startCombat(actor1, actor2, &cachedAllies.getActorsSidingWith(actor2));
|
mechanicsManager->startCombat(actor1, actor2, &cachedAllies.getActorsSidingWith(actor2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1441,10 +1441,10 @@ namespace MWMechanics
|
||||||
// Find the earliest `t` when |relPos + relSpeed * t| == collisionDist.
|
// Find the earliest `t` when |relPos + relSpeed * t| == collisionDist.
|
||||||
const float vr = relPos.x() * relSpeed.x() + relPos.y() * relSpeed.y();
|
const float vr = relPos.x() * relSpeed.x() + relPos.y() * relSpeed.y();
|
||||||
const float v2 = relSpeed.length2();
|
const float v2 = relSpeed.length2();
|
||||||
const float Dh = vr * vr - v2 * (relPos.length2() - collisionDist * collisionDist);
|
const float dh = vr * vr - v2 * (relPos.length2() - collisionDist * collisionDist);
|
||||||
if (Dh <= 0 || v2 == 0)
|
if (dh <= 0 || v2 == 0)
|
||||||
continue; // No solution; distance is always >= collisionDist.
|
continue; // No solution; distance is always >= collisionDist.
|
||||||
const float t = (-vr - std::sqrt(Dh)) / v2;
|
const float t = (-vr - std::sqrt(dh)) / v2;
|
||||||
|
|
||||||
if (t < 0 || t > timeToCollision)
|
if (t < 0 || t > timeToCollision)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -140,9 +140,9 @@ namespace MWMechanics
|
||||||
const osg::Vec3f destination = storage.mUseCustomDestination
|
const osg::Vec3f destination = storage.mUseCustomDestination
|
||||||
? storage.mCustomDestination
|
? storage.mCustomDestination
|
||||||
: target.getRefData().getPosition().asVec3();
|
: target.getRefData().getPosition().asVec3();
|
||||||
const bool is_target_reached = pathTo(actor, destination, duration,
|
const bool isTargetReached = pathTo(actor, destination, duration,
|
||||||
characterController.getSupportedMovementDirections(), targetReachedTolerance);
|
characterController.getSupportedMovementDirections(), targetReachedTolerance);
|
||||||
if (is_target_reached)
|
if (isTargetReached)
|
||||||
storage.mReadyToAttack = true;
|
storage.mReadyToAttack = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,11 +348,11 @@ namespace MWMechanics
|
||||||
void MWMechanics::AiCombat::updateLOS(
|
void MWMechanics::AiCombat::updateLOS(
|
||||||
const MWWorld::Ptr& actor, const MWWorld::Ptr& target, float duration, MWMechanics::AiCombatStorage& storage)
|
const MWWorld::Ptr& actor, const MWWorld::Ptr& target, float duration, MWMechanics::AiCombatStorage& storage)
|
||||||
{
|
{
|
||||||
static const float LOS_UPDATE_DURATION = 0.5f;
|
const float losUpdateDuration = 0.5f;
|
||||||
if (storage.mUpdateLOSTimer <= 0.f)
|
if (storage.mUpdateLOSTimer <= 0.f)
|
||||||
{
|
{
|
||||||
storage.mLOS = MWBase::Environment::get().getWorld()->getLOS(actor, target);
|
storage.mLOS = MWBase::Environment::get().getWorld()->getLOS(actor, target);
|
||||||
storage.mUpdateLOSTimer = LOS_UPDATE_DURATION;
|
storage.mUpdateLOSTimer = losUpdateDuration;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
storage.mUpdateLOSTimer -= duration;
|
storage.mUpdateLOSTimer -= duration;
|
||||||
|
@ -361,7 +361,7 @@ namespace MWMechanics
|
||||||
void MWMechanics::AiCombat::updateFleeing(const MWWorld::Ptr& actor, const MWWorld::Ptr& target, float duration,
|
void MWMechanics::AiCombat::updateFleeing(const MWWorld::Ptr& actor, const MWWorld::Ptr& target, float duration,
|
||||||
MWWorld::MovementDirectionFlags supportedMovementDirections, AiCombatStorage& storage)
|
MWWorld::MovementDirectionFlags supportedMovementDirections, AiCombatStorage& storage)
|
||||||
{
|
{
|
||||||
static const float BLIND_RUN_DURATION = 1.0f;
|
const float blindRunDuration = 1.0f;
|
||||||
|
|
||||||
updateLOS(actor, target, duration, storage);
|
updateLOS(actor, target, duration, storage);
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ namespace MWMechanics
|
||||||
case AiCombatStorage::FleeState_RunBlindly:
|
case AiCombatStorage::FleeState_RunBlindly:
|
||||||
{
|
{
|
||||||
// timer to prevent twitchy movement that can be observed in vanilla MW
|
// timer to prevent twitchy movement that can be observed in vanilla MW
|
||||||
if (storage.mFleeBlindRunTimer < BLIND_RUN_DURATION)
|
if (storage.mFleeBlindRunTimer < blindRunDuration)
|
||||||
{
|
{
|
||||||
storage.mFleeBlindRunTimer += duration;
|
storage.mFleeBlindRunTimer += duration;
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ namespace
|
||||||
float velDir = vTargetMoveDir * vDirToTargetNormalized;
|
float velDir = vTargetMoveDir * vDirToTargetNormalized;
|
||||||
|
|
||||||
// time to collision between target and projectile
|
// time to collision between target and projectile
|
||||||
float t_collision;
|
float tCollision;
|
||||||
|
|
||||||
float projVelDirSquared = projSpeed * projSpeed - velPerp * velPerp;
|
float projVelDirSquared = projSpeed * projSpeed - velPerp * velPerp;
|
||||||
if (projVelDirSquared > 0)
|
if (projVelDirSquared > 0)
|
||||||
|
@ -814,12 +814,12 @@ namespace
|
||||||
float projDistDiff = vDirToTarget * vTargetMoveDirNormalized; // dot product
|
float projDistDiff = vDirToTarget * vTargetMoveDirNormalized; // dot product
|
||||||
projDistDiff = std::sqrt(distToTarget * distToTarget - projDistDiff * projDistDiff);
|
projDistDiff = std::sqrt(distToTarget * distToTarget - projDistDiff * projDistDiff);
|
||||||
|
|
||||||
t_collision = projDistDiff / (std::sqrt(projVelDirSquared) - velDir);
|
tCollision = projDistDiff / (std::sqrt(projVelDirSquared) - velDir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
t_collision = 0; // speed of projectile is not enough to reach moving target
|
tCollision = 0; // speed of projectile is not enough to reach moving target
|
||||||
|
|
||||||
return vDirToTarget + vTargetMoveDir * t_collision;
|
return vDirToTarget + vTargetMoveDir * tCollision;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,9 +186,9 @@ namespace MWMechanics
|
||||||
// class
|
// class
|
||||||
if (mClassSelected)
|
if (mClassSelected)
|
||||||
{
|
{
|
||||||
const ESM::Class* class_ = esmStore.get<ESM::Class>().find(player->mClass);
|
const ESM::Class* playerClass = esmStore.get<ESM::Class>().find(player->mClass);
|
||||||
|
|
||||||
for (int attribute : class_->mData.mAttribute)
|
for (int attribute : playerClass->mData.mAttribute)
|
||||||
{
|
{
|
||||||
ESM::RefId id = ESM::Attribute::indexToRefId(attribute);
|
ESM::RefId id = ESM::Attribute::indexToRefId(attribute);
|
||||||
if (!id.empty())
|
if (!id.empty())
|
||||||
|
@ -199,7 +199,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
int bonus = i == 0 ? 10 : 25;
|
int bonus = i == 0 ? 10 : 25;
|
||||||
|
|
||||||
for (const auto& skills : class_->mData.mSkills)
|
for (const auto& skills : playerClass->mData.mSkills)
|
||||||
{
|
{
|
||||||
ESM::RefId id = ESM::Skill::indexToRefId(skills[i]);
|
ESM::RefId id = ESM::Skill::indexToRefId(skills[i]);
|
||||||
if (!id.empty())
|
if (!id.empty())
|
||||||
|
@ -209,7 +209,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (const ESM::Skill& skill : esmStore.get<ESM::Skill>())
|
for (const ESM::Skill& skill : esmStore.get<ESM::Skill>())
|
||||||
{
|
{
|
||||||
if (skill.mData.mSpecialization == class_->mData.mSpecialization)
|
if (skill.mData.mSpecialization == playerClass->mData.mSpecialization)
|
||||||
npcStats.getSkill(skill.mId).setBase(npcStats.getSkill(skill.mId).getBase() + 5);
|
npcStats.getSkill(skill.mId).setBase(npcStats.getSkill(skill.mId).getBase() + 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,11 +466,11 @@ namespace MWMechanics
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerClass(const ESM::Class& cls)
|
void MechanicsManager::setPlayerClass(const ESM::Class& value)
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
const ESM::Class* ptr = world->getStore().insert(cls);
|
const ESM::Class* ptr = world->getStore().insert(value);
|
||||||
|
|
||||||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||||
player.mClass = ptr->mId;
|
player.mClass = ptr->mId;
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace MWMechanics
|
||||||
void setPlayerClass(const ESM::RefId& id) override;
|
void setPlayerClass(const ESM::RefId& id) override;
|
||||||
///< Set player class to stock class.
|
///< Set player class to stock class.
|
||||||
|
|
||||||
void setPlayerClass(const ESM::Class& class_) override;
|
void setPlayerClass(const ESM::Class& value) override;
|
||||||
///< Set player class to custom class.
|
///< Set player class to custom class.
|
||||||
|
|
||||||
void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) override;
|
void restoreDynamicStats(const MWWorld::Ptr& actor, double hours, bool sleep) override;
|
||||||
|
|
|
@ -167,7 +167,7 @@ void MWMechanics::NpcStats::setFactionReputation(const ESM::RefId& faction, int
|
||||||
mFactionReputation[faction] = value;
|
mFactionReputation[faction] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
float MWMechanics::NpcStats::getSkillProgressRequirement(ESM::RefId id, const ESM::Class& class_) const
|
float MWMechanics::NpcStats::getSkillProgressRequirement(ESM::RefId id, const ESM::Class& npcClass) const
|
||||||
{
|
{
|
||||||
float progressRequirement = 1.f + getSkill(id).getBase();
|
float progressRequirement = 1.f + getSkill(id).getBase();
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(ESM::RefId id, const ES
|
||||||
|
|
||||||
float typeFactor = gmst.find("fMiscSkillBonus")->mValue.getFloat();
|
float typeFactor = gmst.find("fMiscSkillBonus")->mValue.getFloat();
|
||||||
int index = ESM::Skill::refIdToIndex(skill->mId);
|
int index = ESM::Skill::refIdToIndex(skill->mId);
|
||||||
for (const auto& skills : class_.mData.mSkills)
|
for (const auto& skills : npcClass.mData.mSkills)
|
||||||
{
|
{
|
||||||
if (skills[0] == index)
|
if (skills[0] == index)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(ESM::RefId id, const ES
|
||||||
|
|
||||||
float specialisationFactor = 1;
|
float specialisationFactor = 1;
|
||||||
|
|
||||||
if (skill->mData.mSpecialization == class_.mData.mSpecialization)
|
if (skill->mData.mSpecialization == npcClass.mData.mSpecialization)
|
||||||
{
|
{
|
||||||
specialisationFactor = gmst.find("fSpecialSkillBonus")->mValue.getFloat();
|
specialisationFactor = gmst.find("fSpecialSkillBonus")->mValue.getFloat();
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool isInFaction(const ESM::RefId& faction) const;
|
bool isInFaction(const ESM::RefId& faction) const;
|
||||||
|
|
||||||
float getSkillProgressRequirement(ESM::RefId id, const ESM::Class& class_) const;
|
float getSkillProgressRequirement(ESM::RefId id, const ESM::Class& npcClass) const;
|
||||||
|
|
||||||
int getLevelProgress() const;
|
int getLevelProgress() const;
|
||||||
void setLevelProgress(int progress);
|
void setLevelProgress(int progress);
|
||||||
|
|
|
@ -132,12 +132,12 @@ namespace MWMechanics
|
||||||
dir.z() = 0;
|
dir.z() = 0;
|
||||||
dir.normalize();
|
dir.normalize();
|
||||||
float verticalOffset = 200; // instead of '200' here we want the height of the actor
|
float verticalOffset = 200; // instead of '200' here we want the height of the actor
|
||||||
osg::Vec3f _from = from + dir * offsetXY + osg::Z_AXIS * verticalOffset;
|
const osg::Vec3f adjustedFrom = from + dir * offsetXY + osg::Z_AXIS * verticalOffset;
|
||||||
|
|
||||||
// cast up-down ray and find height of hit in world space
|
// cast up-down ray and find height of hit in world space
|
||||||
float h = _from.z()
|
float h = adjustedFrom.z()
|
||||||
- MWBase::Environment::get().getWorld()->getDistToNearestRayHit(
|
- MWBase::Environment::get().getWorld()->getDistToNearestRayHit(
|
||||||
_from, -osg::Z_AXIS, verticalOffset + PATHFIND_Z_REACH + 1);
|
adjustedFrom, -osg::Z_AXIS, verticalOffset + PATHFIND_Z_REACH + 1);
|
||||||
|
|
||||||
return (std::abs(from.z() - h) <= PATHFIND_Z_REACH);
|
return (std::abs(from.z() - h) <= PATHFIND_Z_REACH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,13 +273,13 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
// not in closedset - i.e. have not traversed this edge destination
|
// not in closedset - i.e. have not traversed this edge destination
|
||||||
size_t dest = edge.index;
|
size_t dest = edge.index;
|
||||||
float tentative_g = gScore[current] + edge.cost;
|
float tentativeG = gScore[current] + edge.cost;
|
||||||
bool isInOpenSet = std::find(openset.begin(), openset.end(), dest) != openset.end();
|
bool isInOpenSet = std::find(openset.begin(), openset.end(), dest) != openset.end();
|
||||||
if (!isInOpenSet || tentative_g < gScore[dest])
|
if (!isInOpenSet || tentativeG < gScore[dest])
|
||||||
{
|
{
|
||||||
graphParent[dest] = current;
|
graphParent[dest] = current;
|
||||||
gScore[dest] = tentative_g;
|
gScore[dest] = tentativeG;
|
||||||
fScore[dest] = tentative_g + costAStar(mPathgrid->mPoints[dest], mPathgrid->mPoints[goal]);
|
fScore[dest] = tentativeG + costAStar(mPathgrid->mPoints[dest], mPathgrid->mPoints[goal]);
|
||||||
if (!isInOpenSet)
|
if (!isInOpenSet)
|
||||||
{
|
{
|
||||||
// add this edge to openset, lowest cost goes to the front
|
// add this edge to openset, lowest cost goes to the front
|
||||||
|
|
|
@ -462,12 +462,11 @@ namespace MWPhysics
|
||||||
resultCallback.m_collisionFilterGroup = CollisionType_Projectile;
|
resultCallback.m_collisionFilterGroup = CollisionType_Projectile;
|
||||||
|
|
||||||
const btQuaternion btrot = btQuaternion::getIdentity();
|
const btQuaternion btrot = btQuaternion::getIdentity();
|
||||||
btTransform from_(btrot, btFrom);
|
|
||||||
btTransform to_(btrot, btTo);
|
|
||||||
|
|
||||||
const btCollisionShape* shape = projectile.mCollisionObject->getCollisionShape();
|
const btCollisionShape* shape = projectile.mCollisionObject->getCollisionShape();
|
||||||
assert(shape->isConvex());
|
assert(shape->isConvex());
|
||||||
collisionWorld->convexSweepTest(static_cast<const btConvexShape*>(shape), from_, to_, resultCallback);
|
collisionWorld->convexSweepTest(static_cast<const btConvexShape*>(shape), btTransform(btrot, btFrom),
|
||||||
|
btTransform(btrot, btTo), resultCallback);
|
||||||
|
|
||||||
projectile.mPosition
|
projectile.mPosition
|
||||||
= Misc::Convert::toOsg(projectile.mProjectile->isActive() ? btTo : resultCallback.m_hitPointWorld);
|
= Misc::Convert::toOsg(projectile.mProjectile->isActive() ? btTo : resultCallback.m_hitPointWorld);
|
||||||
|
|
|
@ -262,10 +262,8 @@ namespace MWPhysics
|
||||||
btSphereShape shape(radius);
|
btSphereShape shape(radius);
|
||||||
const btQuaternion btrot = btQuaternion::getIdentity();
|
const btQuaternion btrot = btQuaternion::getIdentity();
|
||||||
|
|
||||||
btTransform from_(btrot, Misc::Convert::toBullet(from));
|
mTaskScheduler->convexSweepTest(&shape, btTransform(btrot, Misc::Convert::toBullet(from)),
|
||||||
btTransform to_(btrot, Misc::Convert::toBullet(to));
|
btTransform(btrot, Misc::Convert::toBullet(to)), callback);
|
||||||
|
|
||||||
mTaskScheduler->convexSweepTest(&shape, from_, to_, callback);
|
|
||||||
|
|
||||||
RayCastingResult result;
|
RayCastingResult result;
|
||||||
result.mHit = callback.hasHit();
|
result.mHit = callback.hasHit();
|
||||||
|
|
|
@ -50,16 +50,16 @@ namespace MWPhysics
|
||||||
// This trace needs to be at least a couple units long, but there's no one particular ideal length.
|
// This trace needs to be at least a couple units long, but there's no one particular ideal length.
|
||||||
// The length of 2.1 chosen here is a "works well in practice after testing a few random lengths" value.
|
// The length of 2.1 chosen here is a "works well in practice after testing a few random lengths" value.
|
||||||
// (Also, we only do this short test if the intended collision trace is long enough for it to make sense.)
|
// (Also, we only do this short test if the intended collision trace is long enough for it to make sense.)
|
||||||
const float fallback_length = 2.1f;
|
const float fallbackLength = 2.1f;
|
||||||
bool doing_short_trace = false;
|
bool doingShortTrace = false;
|
||||||
// For some reason, typical scenes perform a little better if we increase the threshold length for the length
|
// For some reason, typical scenes perform a little better if we increase the threshold length for the length
|
||||||
// test. (Multiplying by 2 in 'square distance' units gives us about 1.4x the threshold length. In benchmarks
|
// test. (Multiplying by 2 in 'square distance' units gives us about 1.4x the threshold length. In benchmarks
|
||||||
// this was
|
// this was
|
||||||
// slightly better for the performance of normal scenes than 4.0, and just plain better than 1.0.)
|
// slightly better for the performance of normal scenes than 4.0, and just plain better than 1.0.)
|
||||||
if (attempt_short_trace && (btend - btstart).length2() > fallback_length * fallback_length * 2.0)
|
if (attempt_short_trace && (btend - btstart).length2() > fallbackLength * fallbackLength * 2.0)
|
||||||
{
|
{
|
||||||
btend = btstart + (btend - btstart).normalized() * fallback_length;
|
btend = btstart + (btend - btstart).normalized() * fallbackLength;
|
||||||
doing_short_trace = true;
|
doingShortTrace = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto traceCallback = sweepHelper(actor, btstart, btend, world, false);
|
const auto traceCallback = sweepHelper(actor, btstart, btend, world, false);
|
||||||
|
@ -69,7 +69,7 @@ namespace MWPhysics
|
||||||
{
|
{
|
||||||
mFraction = traceCallback.m_closestHitFraction;
|
mFraction = traceCallback.m_closestHitFraction;
|
||||||
// ensure fraction is correct (covers intended distance traveled instead of actual distance traveled)
|
// ensure fraction is correct (covers intended distance traveled instead of actual distance traveled)
|
||||||
if (doing_short_trace && (end - start).length2() > 0.0)
|
if (doingShortTrace && (end - start).length2() > 0.0)
|
||||||
mFraction *= (btend - btstart).length() / (end - start).length();
|
mFraction *= (btend - btstart).length() / (end - start).length();
|
||||||
mPlaneNormal = Misc::Convert::toOsg(traceCallback.m_hitNormalWorld);
|
mPlaneNormal = Misc::Convert::toOsg(traceCallback.m_hitNormalWorld);
|
||||||
mEndPos = (end - start) * mFraction + start;
|
mEndPos = (end - start) * mFraction + start;
|
||||||
|
@ -78,7 +78,7 @@ namespace MWPhysics
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (doing_short_trace)
|
if (doingShortTrace)
|
||||||
{
|
{
|
||||||
btend = Misc::Convert::toBullet(end);
|
btend = Misc::Convert::toBullet(end);
|
||||||
const auto newTraceCallback = sweepHelper(actor, btstart, btend, world, false);
|
const auto newTraceCallback = sweepHelper(actor, btstart, btend, world, false);
|
||||||
|
|
|
@ -616,8 +616,8 @@ namespace MWRender
|
||||||
ESM::PartReferenceType parts[] = { ESM::PRT_Groin, ESM::PRT_Skirt, ESM::PRT_RLeg, ESM::PRT_LLeg,
|
ESM::PartReferenceType parts[] = { ESM::PRT_Groin, ESM::PRT_Skirt, ESM::PRT_RLeg, ESM::PRT_LLeg,
|
||||||
ESM::PRT_RUpperarm, ESM::PRT_LUpperarm, ESM::PRT_RKnee, ESM::PRT_LKnee, ESM::PRT_RForearm,
|
ESM::PRT_RUpperarm, ESM::PRT_LUpperarm, ESM::PRT_RKnee, ESM::PRT_LKnee, ESM::PRT_RForearm,
|
||||||
ESM::PRT_LForearm, ESM::PRT_Cuirass };
|
ESM::PRT_LForearm, ESM::PRT_Cuirass };
|
||||||
size_t parts_size = sizeof(parts) / sizeof(parts[0]);
|
const size_t partsSize = sizeof(parts) / sizeof(parts[0]);
|
||||||
for (size_t p = 0; p < parts_size; ++p)
|
for (size_t p = 0; p < partsSize; ++p)
|
||||||
reserveIndividualPart(parts[p], slotlist[i].mSlot, prio);
|
reserveIndividualPart(parts[p], slotlist[i].mSlot, prio);
|
||||||
}
|
}
|
||||||
else if (slotlist[i].mSlot == MWWorld::InventoryStore::Slot_Skirt)
|
else if (slotlist[i].mSlot == MWWorld::InventoryStore::Slot_Skirt)
|
||||||
|
@ -1149,14 +1149,14 @@ namespace MWRender
|
||||||
const std::vector<const ESM::BodyPart*>& NpcAnimation::getBodyParts(
|
const std::vector<const ESM::BodyPart*>& NpcAnimation::getBodyParts(
|
||||||
const ESM::RefId& race, bool female, bool firstPerson, bool werewolf)
|
const ESM::RefId& race, bool female, bool firstPerson, bool werewolf)
|
||||||
{
|
{
|
||||||
static const int Flag_FirstPerson = 1 << 1;
|
constexpr int flagFirstPerson = 1 << 1;
|
||||||
static const int Flag_Female = 1 << 0;
|
constexpr int flagFemale = 1 << 0;
|
||||||
|
|
||||||
int flags = (werewolf ? -1 : 0);
|
int flags = (werewolf ? -1 : 0);
|
||||||
if (female)
|
if (female)
|
||||||
flags |= Flag_Female;
|
flags |= flagFemale;
|
||||||
if (firstPerson)
|
if (firstPerson)
|
||||||
flags |= Flag_FirstPerson;
|
flags |= flagFirstPerson;
|
||||||
|
|
||||||
RaceMapping::iterator found = sRaceMapping.find(std::make_pair(race, flags));
|
RaceMapping::iterator found = sRaceMapping.find(std::make_pair(race, flags));
|
||||||
if (found != sRaceMapping.end())
|
if (found != sRaceMapping.end())
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace
|
||||||
|
|
||||||
osg::Object* clone(const osg::CopyOp& op) const override { return nullptr; }
|
osg::Object* clone(const osg::CopyOp& op) const override { return nullptr; }
|
||||||
|
|
||||||
void operate(osgParticle::Particle* P, double dt) override {}
|
void operate(osgParticle::Particle* particle, double dt) override {}
|
||||||
|
|
||||||
void operateParticles(osgParticle::ParticleSystem* ps, double dt) override
|
void operateParticles(osgParticle::ParticleSystem* ps, double dt) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,8 +295,8 @@ namespace MWScript
|
||||||
std::string_view InterpreterContext::getNPCClass() const
|
std::string_view InterpreterContext::getNPCClass() const
|
||||||
{
|
{
|
||||||
const ESM::NPC* npc = getReferenceImp().get<ESM::NPC>()->mBase;
|
const ESM::NPC* npc = getReferenceImp().get<ESM::NPC>()->mBase;
|
||||||
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
const ESM::Class* npcClass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
|
||||||
return class_->mName;
|
return npcClass->mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view InterpreterContext::getNPCFaction() const
|
std::string_view InterpreterContext::getNPCFaction() const
|
||||||
|
@ -356,8 +356,8 @@ namespace MWScript
|
||||||
std::string_view InterpreterContext::getPCClass() const
|
std::string_view InterpreterContext::getPCClass() const
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
const ESM::RefId& class_ = world->getPlayerPtr().get<ESM::NPC>()->mBase->mClass;
|
const ESM::RefId& playerClass = world->getPlayerPtr().get<ESM::NPC>()->mBase->mClass;
|
||||||
return world->getStore().get<ESM::Class>().find(class_)->mName;
|
return world->getStore().get<ESM::Class>().find(playerClass)->mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view InterpreterContext::getPCRank() const
|
std::string_view InterpreterContext::getPCRank() const
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
mErrorHandler.setContext(script->mId.getRefIdString());
|
mErrorHandler.setContext(script->mId.getRefIdString());
|
||||||
|
|
||||||
bool Success = true;
|
bool success = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::istringstream input(script->mScriptText);
|
std::istringstream input(script->mScriptText);
|
||||||
|
@ -55,25 +55,25 @@ namespace MWScript
|
||||||
scanner.scan(mParser);
|
scanner.scan(mParser);
|
||||||
|
|
||||||
if (!mErrorHandler.isGood())
|
if (!mErrorHandler.isGood())
|
||||||
Success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
catch (const Compiler::SourceException&)
|
catch (const Compiler::SourceException&)
|
||||||
{
|
{
|
||||||
// error has already been reported via error handler
|
// error has already been reported via error handler
|
||||||
Success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
catch (const std::exception& error)
|
catch (const std::exception& error)
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Error: An exception has been thrown: " << error.what();
|
Log(Debug::Error) << "Error: An exception has been thrown: " << error.what();
|
||||||
Success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Success)
|
if (!success)
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Error: script compiling failed: " << name;
|
Log(Debug::Error) << "Error: script compiling failed: " << name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Success)
|
if (success)
|
||||||
{
|
{
|
||||||
mScripts.emplace(name, CompiledScript(mParser.getProgram(), mParser.getLocals()));
|
mScripts.emplace(name, CompiledScript(mParser.getProgram(), mParser.getLocals()));
|
||||||
|
|
||||||
|
|
|
@ -111,11 +111,11 @@ namespace MWSound
|
||||||
if (!mStream)
|
if (!mStream)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::ptrdiff_t stream_idx = mStream - mFormatCtx->streams;
|
std::ptrdiff_t streamIdx = mStream - mFormatCtx->streams;
|
||||||
while (av_read_frame(mFormatCtx.get(), &mPacket) >= 0)
|
while (av_read_frame(mFormatCtx.get(), &mPacket) >= 0)
|
||||||
{
|
{
|
||||||
/* Check if the packet belongs to this stream */
|
/* Check if the packet belongs to this stream */
|
||||||
if (stream_idx == mPacket.stream_index)
|
if (streamIdx == mPacket.stream_index)
|
||||||
{
|
{
|
||||||
if (mPacket.pts != (int64_t)AV_NOPTS_VALUE)
|
if (mPacket.pts != (int64_t)AV_NOPTS_VALUE)
|
||||||
mNextPts = av_q2d((*mStream)->time_base) * mPacket.pts;
|
mNextPts = av_q2d((*mStream)->time_base) * mPacket.pts;
|
||||||
|
@ -131,7 +131,7 @@ namespace MWSound
|
||||||
|
|
||||||
bool FFmpegDecoder::getAVAudioData()
|
bool FFmpegDecoder::getAVAudioData()
|
||||||
{
|
{
|
||||||
bool got_frame = false;
|
bool gotFrame = false;
|
||||||
|
|
||||||
if (mCodecCtx->codec_type != AVMEDIA_TYPE_AUDIO)
|
if (mCodecCtx->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||||
return false;
|
return false;
|
||||||
|
@ -156,7 +156,7 @@ namespace MWSound
|
||||||
|
|
||||||
if (mFrame->nb_samples == 0)
|
if (mFrame->nb_samples == 0)
|
||||||
continue;
|
continue;
|
||||||
got_frame = true;
|
gotFrame = true;
|
||||||
|
|
||||||
if (mSwr)
|
if (mSwr)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +186,7 @@ namespace MWSound
|
||||||
else
|
else
|
||||||
mFrameData = &mFrame->data[0];
|
mFrameData = &mFrame->data[0];
|
||||||
|
|
||||||
} while (!got_frame);
|
} while (!gotFrame);
|
||||||
mNextPts += (double)mFrame->nb_samples / mCodecCtx->sample_rate;
|
mNextPts += (double)mFrame->nb_samples / mCodecCtx->sample_rate;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -416,11 +416,11 @@ namespace MWSound
|
||||||
|
|
||||||
*samplerate = mCodecCtx->sample_rate;
|
*samplerate = mCodecCtx->sample_rate;
|
||||||
#if OPENMW_FFMPEG_5_OR_GREATER
|
#if OPENMW_FFMPEG_5_OR_GREATER
|
||||||
AVChannelLayout ch_layout = mCodecCtx->ch_layout;
|
AVChannelLayout chLayout = mCodecCtx->ch_layout;
|
||||||
if (ch_layout.u.mask == 0)
|
if (chLayout.u.mask == 0)
|
||||||
av_channel_layout_default(&ch_layout, mCodecCtx->ch_layout.nb_channels);
|
av_channel_layout_default(&chLayout, mCodecCtx->ch_layout.nb_channels);
|
||||||
|
|
||||||
if (mOutputSampleFormat != mCodecCtx->sample_fmt || mOutputChannelLayout.u.mask != ch_layout.u.mask)
|
if (mOutputSampleFormat != mCodecCtx->sample_fmt || mOutputChannelLayout.u.mask != chLayout.u.mask)
|
||||||
#else
|
#else
|
||||||
int64_t ch_layout = mCodecCtx->channel_layout;
|
int64_t ch_layout = mCodecCtx->channel_layout;
|
||||||
if (ch_layout == 0)
|
if (ch_layout == 0)
|
||||||
|
@ -435,7 +435,7 @@ namespace MWSound
|
||||||
&mOutputChannelLayout, // output ch layout
|
&mOutputChannelLayout, // output ch layout
|
||||||
mOutputSampleFormat, // output sample format
|
mOutputSampleFormat, // output sample format
|
||||||
mCodecCtx->sample_rate, // output sample rate
|
mCodecCtx->sample_rate, // output sample rate
|
||||||
&ch_layout, // input ch layout
|
&chLayout, // input ch layout
|
||||||
mCodecCtx->sample_fmt, // input sample format
|
mCodecCtx->sample_fmt, // input sample format
|
||||||
mCodecCtx->sample_rate, // input sample rate
|
mCodecCtx->sample_rate, // input sample rate
|
||||||
0, // logging level offset
|
0, // logging level offset
|
||||||
|
|
|
@ -48,12 +48,13 @@ namespace MWSound
|
||||||
size_t getSampleOffset()
|
size_t getSampleOffset()
|
||||||
{
|
{
|
||||||
#if OPENMW_FFMPEG_5_OR_GREATER
|
#if OPENMW_FFMPEG_5_OR_GREATER
|
||||||
ssize_t clock_delay = (mFrameSize - mFramePos) / mOutputChannelLayout.nb_channels
|
const ssize_t clockDelay = (mFrameSize - mFramePos) / mOutputChannelLayout.nb_channels
|
||||||
#else
|
#else
|
||||||
ssize_t clock_delay = (mFrameSize - mFramePos) / av_get_channel_layout_nb_channels(mOutputChannelLayout)
|
const ssize_t clockDelay = (mFrameSize - mFramePos)
|
||||||
|
/ av_get_channel_layout_nb_channels(mOutputChannelLayout)
|
||||||
#endif
|
#endif
|
||||||
/ av_get_bytes_per_sample(mOutputSampleFormat);
|
/ av_get_bytes_per_sample(mOutputSampleFormat);
|
||||||
return (size_t)(mAudioClock * mAudioContext->sample_rate) - clock_delay;
|
return static_cast<size_t>(static_cast<ssize_t>(mAudioClock * mAudioContext->sample_rate) - clockDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getStreamName()
|
std::string getStreamName()
|
||||||
|
|
|
@ -750,9 +750,9 @@ namespace MWSound
|
||||||
if (!hrtfname.empty())
|
if (!hrtfname.empty())
|
||||||
{
|
{
|
||||||
ALCint index = -1;
|
ALCint index = -1;
|
||||||
ALCint num_hrtf;
|
ALCint numHrtf;
|
||||||
alcGetIntegerv(mDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtf);
|
alcGetIntegerv(mDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &numHrtf);
|
||||||
for (ALCint i = 0; i < num_hrtf; ++i)
|
for (ALCint i = 0; i < numHrtf; ++i)
|
||||||
{
|
{
|
||||||
const ALCchar* entry = alcGetStringiSOFT(mDevice, ALC_HRTF_SPECIFIER_SOFT, i);
|
const ALCchar* entry = alcGetStringiSOFT(mDevice, ALC_HRTF_SPECIFIER_SOFT, i);
|
||||||
if (hrtfname == entry)
|
if (hrtfname == entry)
|
||||||
|
@ -818,9 +818,9 @@ namespace MWSound
|
||||||
Log(Debug::Warning) << "HRTF status unavailable";
|
Log(Debug::Warning) << "HRTF status unavailable";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ALCint hrtf_state;
|
ALCint hrtfState;
|
||||||
alcGetIntegerv(mDevice, ALC_HRTF_SOFT, 1, &hrtf_state);
|
alcGetIntegerv(mDevice, ALC_HRTF_SOFT, 1, &hrtfState);
|
||||||
if (!hrtf_state)
|
if (!hrtfState)
|
||||||
Log(Debug::Info) << "HRTF disabled";
|
Log(Debug::Info) << "HRTF disabled";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1015,10 +1015,10 @@ namespace MWSound
|
||||||
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
||||||
getALCFunc(alcGetStringiSOFT, mDevice, "alcGetStringiSOFT");
|
getALCFunc(alcGetStringiSOFT, mDevice, "alcGetStringiSOFT");
|
||||||
|
|
||||||
ALCint num_hrtf;
|
ALCint numHrtf;
|
||||||
alcGetIntegerv(mDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtf);
|
alcGetIntegerv(mDevice, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &numHrtf);
|
||||||
ret.reserve(num_hrtf);
|
ret.reserve(numHrtf);
|
||||||
for (ALCint i = 0; i < num_hrtf; ++i)
|
for (ALCint i = 0; i < numHrtf; ++i)
|
||||||
{
|
{
|
||||||
const ALCchar* entry = alcGetStringiSOFT(mDevice, ALC_HRTF_SPECIFIER_SOFT, i);
|
const ALCchar* entry = alcGetStringiSOFT(mDevice, ALC_HRTF_SPECIFIER_SOFT, i);
|
||||||
ret.emplace_back(entry);
|
ret.emplace_back(entry);
|
||||||
|
|
|
@ -46,8 +46,8 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
// slots that this item can be equipped in
|
// slots that this item can be equipped in
|
||||||
std::pair<std::vector<int>, bool> slots_ = getTarget().getClass().getEquipmentSlots(getTarget());
|
std::pair<std::vector<int>, bool> slots = getTarget().getClass().getEquipmentSlots(getTarget());
|
||||||
if (slots_.first.empty())
|
if (slots.first.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// retrieve ContainerStoreIterator to the item
|
// retrieve ContainerStoreIterator to the item
|
||||||
|
@ -64,8 +64,8 @@ namespace MWWorld
|
||||||
throw std::runtime_error("ActionEquip can't find item " + object.getCellRef().getRefId().toDebugString());
|
throw std::runtime_error("ActionEquip can't find item " + object.getCellRef().getRefId().toDebugString());
|
||||||
|
|
||||||
// equip the item in the first free slot
|
// equip the item in the first free slot
|
||||||
std::vector<int>::const_iterator slot = slots_.first.begin();
|
std::vector<int>::const_iterator slot = slots.first.begin();
|
||||||
for (; slot != slots_.first.end(); ++slot)
|
for (; slot != slots.first.end(); ++slot)
|
||||||
{
|
{
|
||||||
// if the item is equipped already, nothing to do
|
// if the item is equipped already, nothing to do
|
||||||
if (invStore.getSlot(*slot) == it)
|
if (invStore.getSlot(*slot) == it)
|
||||||
|
@ -81,14 +81,14 @@ namespace MWWorld
|
||||||
|
|
||||||
// all slots are occupied -> cycle
|
// all slots are occupied -> cycle
|
||||||
// move all slots one towards begin(), then equip the item in the slot that is now free
|
// move all slots one towards begin(), then equip the item in the slot that is now free
|
||||||
if (slot == slots_.first.end())
|
if (slot == slots.first.end())
|
||||||
{
|
{
|
||||||
ContainerStoreIterator enchItem = invStore.getSelectedEnchantItem();
|
ContainerStoreIterator enchItem = invStore.getSelectedEnchantItem();
|
||||||
bool reEquip = false;
|
bool reEquip = false;
|
||||||
for (slot = slots_.first.begin(); slot != slots_.first.end(); ++slot)
|
for (slot = slots.first.begin(); slot != slots.first.end(); ++slot)
|
||||||
{
|
{
|
||||||
invStore.unequipSlot(*slot, false);
|
invStore.unequipSlot(*slot, false);
|
||||||
if (slot + 1 != slots_.first.end())
|
if (slot + 1 != slots.first.end())
|
||||||
{
|
{
|
||||||
invStore.equip(*slot, invStore.getSlot(*(slot + 1)));
|
invStore.equip(*slot, invStore.getSlot(*(slot + 1)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ void MWWorld::InventoryStore::copySlots(const InventoryStore& store)
|
||||||
mSelectedEnchantItem = slot;
|
mSelectedEnchantItem = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::InventoryStore::initSlots(TSlots& slots_)
|
void MWWorld::InventoryStore::initSlots(TSlots& slots)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Slots; ++i)
|
for (int i = 0; i < Slots; ++i)
|
||||||
slots_.push_back(end());
|
slots.push_back(end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::InventoryStore::storeEquipmentState(
|
void MWWorld::InventoryStore::storeEquipmentState(
|
||||||
|
@ -159,18 +159,18 @@ void MWWorld::InventoryStore::equip(int slot, const ContainerStoreIterator& iter
|
||||||
if (iterator.getContainerStore() != this)
|
if (iterator.getContainerStore() != this)
|
||||||
throw std::runtime_error("attempt to equip an item that is not in the inventory");
|
throw std::runtime_error("attempt to equip an item that is not in the inventory");
|
||||||
|
|
||||||
std::pair<std::vector<int>, bool> slots_;
|
std::pair<std::vector<int>, bool> slots;
|
||||||
|
|
||||||
slots_ = iterator->getClass().getEquipmentSlots(*iterator);
|
slots = iterator->getClass().getEquipmentSlots(*iterator);
|
||||||
|
|
||||||
if (std::find(slots_.first.begin(), slots_.first.end(), slot) == slots_.first.end())
|
if (std::find(slots.first.begin(), slots.first.end(), slot) == slots.first.end())
|
||||||
throw std::runtime_error("invalid slot");
|
throw std::runtime_error("invalid slot");
|
||||||
|
|
||||||
if (mSlots[slot] != end())
|
if (mSlots[slot] != end())
|
||||||
unequipSlot(slot);
|
unequipSlot(slot);
|
||||||
|
|
||||||
// unstack item pointed to by iterator if required
|
// unstack item pointed to by iterator if required
|
||||||
if (iterator != end() && !slots_.second
|
if (iterator != end() && !slots.second
|
||||||
&& iterator->getCellRef().getCount() > 1) // if slots.second is true, item can stay stacked when equipped
|
&& iterator->getCellRef().getCount() > 1) // if slots.second is true, item can stay stacked when equipped
|
||||||
{
|
{
|
||||||
unstack(*iterator);
|
unstack(*iterator);
|
||||||
|
@ -219,7 +219,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::findSlot(int slot) cons
|
||||||
return mSlots[slot];
|
return mSlots[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots_)
|
void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots)
|
||||||
{
|
{
|
||||||
const Ptr& actor = getPtr();
|
const Ptr& actor = getPtr();
|
||||||
if (!actor.getClass().isNpc())
|
if (!actor.getClass().isNpc())
|
||||||
|
@ -337,14 +337,14 @@ void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots_)
|
||||||
if (arrow == end())
|
if (arrow == end())
|
||||||
hasAmmo = false;
|
hasAmmo = false;
|
||||||
else
|
else
|
||||||
slots_[Slot_Ammunition] = arrow;
|
slots[Slot_Ammunition] = arrow;
|
||||||
}
|
}
|
||||||
else if (ammotype == ESM::Weapon::Bolt)
|
else if (ammotype == ESM::Weapon::Bolt)
|
||||||
{
|
{
|
||||||
if (bolt == end())
|
if (bolt == end())
|
||||||
hasAmmo = false;
|
hasAmmo = false;
|
||||||
else
|
else
|
||||||
slots_[Slot_Ammunition] = bolt;
|
slots[Slot_Ammunition] = bolt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAmmo)
|
if (hasAmmo)
|
||||||
|
@ -362,10 +362,10 @@ void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots_)
|
||||||
}
|
}
|
||||||
|
|
||||||
int slot = itemsSlots.first.front();
|
int slot = itemsSlots.first.front();
|
||||||
slots_[slot] = weapon;
|
slots[slot] = weapon;
|
||||||
|
|
||||||
if (ammotype == ESM::Weapon::None)
|
if (ammotype == ESM::Weapon::None)
|
||||||
slots_[Slot_Ammunition] = end();
|
slots[Slot_Ammunition] = end();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -376,7 +376,7 @@ void MWWorld::InventoryStore::autoEquipWeapon(TSlots& slots_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots)
|
||||||
{
|
{
|
||||||
const Ptr& actor = getPtr();
|
const Ptr& actor = getPtr();
|
||||||
|
|
||||||
|
@ -428,9 +428,9 @@ void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
||||||
for (const int slot : itemSlots)
|
for (const int slot : itemSlots)
|
||||||
{
|
{
|
||||||
// check if slot may require swapping if current item is more valuable
|
// check if slot may require swapping if current item is more valuable
|
||||||
if (slots_.at(slot) != end())
|
if (slots.at(slot) != end())
|
||||||
{
|
{
|
||||||
Ptr old = *slots_.at(slot);
|
Ptr old = *slots.at(slot);
|
||||||
const MWWorld::Class& oldCls = old.getClass();
|
const MWWorld::Class& oldCls = old.getClass();
|
||||||
unsigned int oldType = old.getType();
|
unsigned int oldType = old.getType();
|
||||||
|
|
||||||
|
@ -443,10 +443,10 @@ void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
||||||
// If the left ring slot is filled, don't swap if the right ring is cheaper
|
// If the left ring slot is filled, don't swap if the right ring is cheaper
|
||||||
if (slot == Slot_LeftRing)
|
if (slot == Slot_LeftRing)
|
||||||
{
|
{
|
||||||
if (slots_.at(Slot_RightRing) == end())
|
if (slots.at(Slot_RightRing) == end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Ptr rightRing = *slots_.at(Slot_RightRing);
|
Ptr rightRing = *slots.at(Slot_RightRing);
|
||||||
if (rightRing.getClass().getValue(rightRing) <= oldCls.getValue(old))
|
if (rightRing.getClass().getValue(rightRing) <= oldCls.getValue(old))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are here it means item can be equipped or swapped
|
// if we are here it means item can be equipped or swapped
|
||||||
slots_[slot] = iter;
|
slots[slot] = iter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,22 +494,22 @@ void MWWorld::InventoryStore::autoEquipArmor(TSlots& slots_)
|
||||||
|
|
||||||
void MWWorld::InventoryStore::autoEquip()
|
void MWWorld::InventoryStore::autoEquip()
|
||||||
{
|
{
|
||||||
TSlots slots_;
|
TSlots slots;
|
||||||
initSlots(slots_);
|
initSlots(slots);
|
||||||
|
|
||||||
// Disable model update during auto-equip
|
// Disable model update during auto-equip
|
||||||
mUpdatesEnabled = false;
|
mUpdatesEnabled = false;
|
||||||
|
|
||||||
// Autoequip clothing, armor and weapons.
|
// Autoequip clothing, armor and weapons.
|
||||||
// Equipping lights is handled in Actors::updateEquippedLight based on environment light.
|
// Equipping lights is handled in Actors::updateEquippedLight based on environment light.
|
||||||
autoEquipWeapon(slots_);
|
autoEquipWeapon(slots);
|
||||||
autoEquipArmor(slots_);
|
autoEquipArmor(slots);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < slots_.size(); ++i)
|
for (std::size_t i = 0; i < slots.size(); ++i)
|
||||||
{
|
{
|
||||||
if (slots_[i] != mSlots[i])
|
if (slots[i] != mSlots[i])
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
break;
|
break;
|
||||||
|
@ -519,7 +519,7 @@ void MWWorld::InventoryStore::autoEquip()
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
mSlots.swap(slots_);
|
mSlots.swap(slots);
|
||||||
fireEquipmentChangedEvent();
|
fireEquipmentChangedEvent();
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,15 +67,15 @@ namespace MWWorld
|
||||||
|
|
||||||
TSlots mSlots;
|
TSlots mSlots;
|
||||||
|
|
||||||
void autoEquipWeapon(TSlots& slots_);
|
void autoEquipWeapon(TSlots& slots);
|
||||||
void autoEquipArmor(TSlots& slots_);
|
void autoEquipArmor(TSlots& slots);
|
||||||
|
|
||||||
// selected magic item (for using enchantments of type "Cast once" or "Cast when used")
|
// selected magic item (for using enchantments of type "Cast once" or "Cast when used")
|
||||||
ContainerStoreIterator mSelectedEnchantItem;
|
ContainerStoreIterator mSelectedEnchantItem;
|
||||||
|
|
||||||
void copySlots(const InventoryStore& store);
|
void copySlots(const InventoryStore& store);
|
||||||
|
|
||||||
void initSlots(TSlots& slots_);
|
void initSlots(TSlots& slots);
|
||||||
|
|
||||||
void fireEquipmentChangedEvent();
|
void fireEquipmentChangedEvent();
|
||||||
|
|
||||||
|
|
|
@ -123,14 +123,14 @@ namespace
|
||||||
texture = magicEffect->mParticle;
|
texture = magicEffect->mParticle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectileEffects.mList.size()
|
// insert a VFX_Multiple projectile if there are multiple projectile effects
|
||||||
> 1) // insert a VFX_Multiple projectile if there are multiple projectile effects
|
if (projectileEffects.mList.size() > 1)
|
||||||
{
|
{
|
||||||
const ESM::RefId ID = ESM::RefId::stringRefId("VFX_Multiple" + std::to_string(effects->mList.size()));
|
const ESM::RefId projectileId
|
||||||
std::vector<ESM::RefId>::iterator it;
|
= ESM::RefId::stringRefId("VFX_Multiple" + std::to_string(effects->mList.size()));
|
||||||
it = projectileIDs.begin();
|
projectileIDs.insert(projectileIDs.begin(), projectileId);
|
||||||
it = projectileIDs.insert(it, ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return projectileEffects;
|
return projectileEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -858,12 +858,12 @@ namespace MWWorld
|
||||||
if (mTimeSettings.mNightStart < mSunriseTime)
|
if (mTimeSettings.mNightStart < mSunriseTime)
|
||||||
adjustedNightStart += 24.f;
|
adjustedNightStart += 24.f;
|
||||||
|
|
||||||
const bool is_night = adjustedHour >= adjustedNightStart;
|
const bool isNight = adjustedHour >= adjustedNightStart;
|
||||||
const float dayDuration = adjustedNightStart - mSunriseTime;
|
const float dayDuration = adjustedNightStart - mSunriseTime;
|
||||||
const float nightDuration = 24.f - dayDuration;
|
const float nightDuration = 24.f - dayDuration;
|
||||||
|
|
||||||
float orbit;
|
float orbit;
|
||||||
if (!is_night)
|
if (!isNight)
|
||||||
{
|
{
|
||||||
float t = (adjustedHour - mSunriseTime) / dayDuration;
|
float t = (adjustedHour - mSunriseTime) / dayDuration;
|
||||||
orbit = 1.f - 2.f * t;
|
orbit = 1.f - 2.f * t;
|
||||||
|
@ -877,7 +877,7 @@ namespace MWWorld
|
||||||
// Hardcoded constant from Morrowind
|
// Hardcoded constant from Morrowind
|
||||||
const osg::Vec3f sunDir(-400.f * orbit, 75.f, -100.f);
|
const osg::Vec3f sunDir(-400.f * orbit, 75.f, -100.f);
|
||||||
mRendering.setSunDirection(sunDir);
|
mRendering.setSunDirection(sunDir);
|
||||||
mRendering.setNight(is_night);
|
mRendering.setNight(isNight);
|
||||||
}
|
}
|
||||||
|
|
||||||
float underwaterFog = mUnderwaterFog.getValue(time.getHour(), mTimeSettings, "Fog");
|
float underwaterFog = mUnderwaterFog.getValue(time.getHour(), mTimeSettings, "Fog");
|
||||||
|
|
|
@ -900,9 +900,9 @@ QString Wizard::UnshieldWorker::findFile(const QString& fileName, const QString&
|
||||||
QStringList Wizard::UnshieldWorker::findFiles(
|
QStringList Wizard::UnshieldWorker::findFiles(
|
||||||
const QString& fileName, const QString& path, int depth, bool recursive, bool directories, Qt::MatchFlags flags)
|
const QString& fileName, const QString& path, int depth, bool recursive, bool directories, Qt::MatchFlags flags)
|
||||||
{
|
{
|
||||||
static const int MAXIMUM_DEPTH = 10;
|
constexpr int maximumDepth = 10;
|
||||||
|
|
||||||
if (depth >= MAXIMUM_DEPTH)
|
if (depth >= maximumDepth)
|
||||||
{
|
{
|
||||||
qWarning("Maximum directory depth limit reached.");
|
qWarning("Maximum directory depth limit reached.");
|
||||||
return QStringList();
|
return QStringList();
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace Compiler
|
||||||
|
|
||||||
bool peek(std::istream& in)
|
bool peek(std::istream& in)
|
||||||
{
|
{
|
||||||
std::streampos p_orig = in.tellg();
|
std::streampos pOrig = in.tellg();
|
||||||
|
|
||||||
char ch = static_cast<char>(in.peek());
|
char ch = static_cast<char>(in.peek());
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ namespace Compiler
|
||||||
|
|
||||||
mLength = length;
|
mLength = length;
|
||||||
|
|
||||||
in.seekg(p_orig);
|
in.seekg(pOrig);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,10 +92,10 @@ const ContentSelectorModel::EsmFile* ContentSelectorModel::ContentModel::item(co
|
||||||
QModelIndex ContentSelectorModel::ContentModel::indexFromItem(const EsmFile* item) const
|
QModelIndex ContentSelectorModel::ContentModel::indexFromItem(const EsmFile* item) const
|
||||||
{
|
{
|
||||||
// workaround: non-const pointer cast for calls from outside contentmodel/contentselector
|
// workaround: non-const pointer cast for calls from outside contentmodel/contentselector
|
||||||
EsmFile* non_const_file_ptr = const_cast<EsmFile*>(item);
|
EsmFile* const nonConstFilePtr = const_cast<EsmFile*>(item);
|
||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
return index(mFiles.indexOf(non_const_file_ptr), 0);
|
return index(mFiles.indexOf(nonConstFilePtr), 0);
|
||||||
|
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,13 @@ public:
|
||||||
|
|
||||||
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override
|
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override
|
||||||
{
|
{
|
||||||
static const QString ContentTypeAddon = QString::number((int)ContentSelectorModel::ContentType_Addon);
|
static const QString contentTypeAddon
|
||||||
|
= QString::number(static_cast<int>(ContentSelectorModel::ContentType_Addon));
|
||||||
|
|
||||||
QModelIndex nameIndex = sourceModel()->index(sourceRow, 0, sourceParent);
|
QModelIndex nameIndex = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
const QString userRole = sourceModel()->data(nameIndex, Qt::UserRole).toString();
|
const QString userRole = sourceModel()->data(nameIndex, Qt::UserRole).toString();
|
||||||
|
|
||||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent) && userRole == ContentTypeAddon;
|
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent) && userRole == contentTypeAddon;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -320,9 +320,9 @@ static void crash_catcher(int signum, siginfo_t* siginfo, void* /*context*/)
|
||||||
else
|
else
|
||||||
crash_info.siginfo = *siginfo;
|
crash_info.siginfo = *siginfo;
|
||||||
|
|
||||||
const pid_t dbg_pid = fork();
|
const pid_t dbgPid = fork();
|
||||||
/* Fork off to start a crash handler */
|
/* Fork off to start a crash handler */
|
||||||
switch (dbg_pid)
|
switch (dbgPid)
|
||||||
{
|
{
|
||||||
/* Error */
|
/* Error */
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -342,7 +342,7 @@ static void crash_catcher(int signum, siginfo_t* siginfo, void* /*context*/)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
prctl(PR_SET_PTRACER, dbg_pid, 0, 0, 0);
|
prctl(PR_SET_PTRACER, dbgPid, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
safe_write(fd[1], &crash_info, sizeof(crash_info));
|
safe_write(fd[1], &crash_info, sizeof(crash_info));
|
||||||
close(fd[0]);
|
close(fd[0]);
|
||||||
|
@ -352,7 +352,7 @@ static void crash_catcher(int signum, siginfo_t* siginfo, void* /*context*/)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
if (waitpid(dbg_pid, &status, 0) == dbg_pid && (WIFEXITED(status) || WIFSIGNALED(status)))
|
if (waitpid(dbgPid, &status, 0) == dbgPid && (WIFEXITED(status) || WIFSIGNALED(status)))
|
||||||
{
|
{
|
||||||
/* The debug process died before it could kill us */
|
/* The debug process died before it could kill us */
|
||||||
raise(signum);
|
raise(signum);
|
||||||
|
|
|
@ -68,37 +68,37 @@ static void generateCube(osg::Geometry& geom, float dim)
|
||||||
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
|
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
|
||||||
osg::ref_ptr<osg::DrawElementsUShort> indices = new osg::DrawElementsUShort(osg::DrawElementsUShort::TRIANGLES, 0);
|
osg::ref_ptr<osg::DrawElementsUShort> indices = new osg::DrawElementsUShort(osg::DrawElementsUShort::TRIANGLES, 0);
|
||||||
|
|
||||||
for (int i_face = 0; i_face < 6; i_face++)
|
for (int iFace = 0; iFace < 6; iFace++)
|
||||||
{
|
{
|
||||||
osg::Vec3f normale(0., 0., 0.);
|
osg::Vec3f normale(0., 0., 0.);
|
||||||
osg::Vec3f u(0., 0., 0.);
|
osg::Vec3f u(0., 0., 0.);
|
||||||
osg::Vec3f v(0., 0., 0.);
|
osg::Vec3f v(0., 0., 0.);
|
||||||
int axis = i_face / 2;
|
int axis = iFace / 2;
|
||||||
int dir = i_face % 2 == 0 ? -1 : 1;
|
int dir = iFace % 2 == 0 ? -1 : 1;
|
||||||
float float_dir = dir;
|
float floatDir = dir;
|
||||||
normale[axis] = float_dir;
|
normale[axis] = floatDir;
|
||||||
u[(axis + 1) % 3] = 1.0;
|
u[(axis + 1) % 3] = 1.0;
|
||||||
v[(axis + 2) % 3] = 1.0;
|
v[(axis + 2) % 3] = 1.0;
|
||||||
|
|
||||||
for (int i_point = 0; i_point < 4; i_point++)
|
for (int iPoint = 0; iPoint < 4; iPoint++)
|
||||||
{
|
{
|
||||||
float iu = i_point % 2 == 1
|
float iu = iPoint % 2 == 1
|
||||||
? float_dir
|
? floatDir
|
||||||
: -float_dir; // This is to get the right triangle orientation when the normal changes*
|
: -floatDir; // This is to get the right triangle orientation when the normal changes*
|
||||||
float iv = i_point / 2 == 1 ? 1.0 : -1.0;
|
float iv = iPoint / 2 == 1 ? 1.0 : -1.0;
|
||||||
osg::Vec3f point = (u * iu) + (v * iv);
|
osg::Vec3f point = (u * iu) + (v * iv);
|
||||||
point = (point + normale);
|
point = (point + normale);
|
||||||
point = point * (dim * 0.5f);
|
point = point * (dim * 0.5f);
|
||||||
vertices->push_back(point);
|
vertices->push_back(point);
|
||||||
normals->push_back(normale);
|
normals->push_back(normale);
|
||||||
}
|
}
|
||||||
int start_vertex(i_face * 4);
|
int startVertex(iFace * 4);
|
||||||
int newFace1[] = { start_vertex, start_vertex + 1, start_vertex + 2 };
|
int newFace1[] = { startVertex, startVertex + 1, startVertex + 2 };
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
indices->push_back(newFace1[i]);
|
indices->push_back(newFace1[i]);
|
||||||
}
|
}
|
||||||
int newFace2[] = { start_vertex + 2, start_vertex + 1, start_vertex + 3 };
|
int newFace2[] = { startVertex + 2, startVertex + 1, startVertex + 3 };
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
indices->push_back(newFace2[i]);
|
indices->push_back(newFace2[i]);
|
||||||
|
@ -146,7 +146,7 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
||||||
iVertex += 1;
|
iVertex += 1;
|
||||||
}
|
}
|
||||||
// bottom disk
|
// bottom disk
|
||||||
auto begin_bot = iVertex;
|
auto beginBot = iVertex;
|
||||||
for (int i = 0; i < subdiv; i++)
|
for (int i = 0; i < subdiv; i++)
|
||||||
{
|
{
|
||||||
float theta = float(i) / float(subdiv) * osg::PI * 2.;
|
float theta = float(i) / float(subdiv) * osg::PI * 2.;
|
||||||
|
@ -179,11 +179,11 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
||||||
// create triangles sides
|
// create triangles sides
|
||||||
for (int i = 0; i < subdiv; i++)
|
for (int i = 0; i < subdiv; i++)
|
||||||
{
|
{
|
||||||
auto next_vert = (i + 1) % subdiv;
|
auto nextVert = (i + 1) % subdiv;
|
||||||
auto v1 = (beginSide + 2 * i);
|
auto v1 = (beginSide + 2 * i);
|
||||||
auto v2 = (beginSide + 2 * i + 1);
|
auto v2 = (beginSide + 2 * i + 1);
|
||||||
auto v3 = (beginSide + 2 * next_vert);
|
auto v3 = (beginSide + 2 * nextVert);
|
||||||
auto v4 = (beginSide + 2 * next_vert + 1);
|
auto v4 = (beginSide + 2 * nextVert + 1);
|
||||||
indices->push_back(v1);
|
indices->push_back(v1);
|
||||||
indices->push_back(v2);
|
indices->push_back(v2);
|
||||||
indices->push_back(v4);
|
indices->push_back(v4);
|
||||||
|
@ -194,12 +194,12 @@ static void generateCylinder(osg::Geometry& geom, float radius, float height, in
|
||||||
}
|
}
|
||||||
for (int i = 0; i < subdiv; i++)
|
for (int i = 0; i < subdiv; i++)
|
||||||
{
|
{
|
||||||
auto next_vert = (i + 1) % subdiv;
|
auto nextVert = (i + 1) % subdiv;
|
||||||
auto top1 = (beginTop + i);
|
auto top1 = (beginTop + i);
|
||||||
auto top2 = (beginTop + next_vert);
|
auto top2 = (beginTop + nextVert);
|
||||||
|
|
||||||
auto bot1 = (begin_bot + i);
|
auto bot1 = (beginBot + i);
|
||||||
auto bot2 = (begin_bot + next_vert);
|
auto bot2 = (beginBot + nextVert);
|
||||||
|
|
||||||
indices->push_back(top2);
|
indices->push_back(top2);
|
||||||
indices->push_back(centerTop);
|
indices->push_back(centerTop);
|
||||||
|
|
|
@ -131,13 +131,13 @@ namespace Debug
|
||||||
prefix[0] = '[';
|
prefix[0] = '[';
|
||||||
const auto now = std::chrono::system_clock::now();
|
const auto now = std::chrono::system_clock::now();
|
||||||
const auto time = std::chrono::system_clock::to_time_t(now);
|
const auto time = std::chrono::system_clock::to_time_t(now);
|
||||||
tm time_info{};
|
tm timeInfo{};
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
(void)localtime_s(&time_info, &time);
|
(void)localtime_s(&timeInfo, &time);
|
||||||
#else
|
#else
|
||||||
(void)localtime_r(&time, &time_info);
|
(void)localtime_r(&time, &timeInfo);
|
||||||
#endif
|
#endif
|
||||||
prefixSize = std::strftime(prefix + 1, sizeof(prefix) - 1, "%T", &time_info) + 1;
|
prefixSize = std::strftime(prefix + 1, sizeof(prefix) - 1, "%T", &timeInfo) + 1;
|
||||||
char levelLetter = " EWIVD*"[int(level)];
|
char levelLetter = " EWIVD*"[int(level)];
|
||||||
const auto ms
|
const auto ms
|
||||||
= std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
= std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
||||||
|
|
|
@ -64,8 +64,8 @@ namespace ESM
|
||||||
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
|
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
|
||||||
if (mObject.mNpcStats.mIsWerewolf)
|
if (mObject.mNpcStats.mIsWerewolf)
|
||||||
{
|
{
|
||||||
constexpr int Acrobatics = 20;
|
constexpr int acrobatics = 20;
|
||||||
if (i == Acrobatics)
|
if (i == acrobatics)
|
||||||
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
|
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
|
||||||
mObject.mNpcStats.mSkills[i] = skill;
|
mObject.mNpcStats.mSkills[i] = skill;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
bool isFO3 = false;
|
bool isFO3 = false;
|
||||||
|
|
||||||
bool isMale = false;
|
bool isMale = false;
|
||||||
int curr_part = -1; // 0 = head, 1 = body, 2 = egt, 3 = hkx
|
int currPart = -1; // 0 = head, 1 = body, 2 = egt, 3 = hkx
|
||||||
std::uint32_t currentIndex = 0xffffffff;
|
std::uint32_t currentIndex = 0xffffffff;
|
||||||
|
|
||||||
while (reader.getSubRecordHeader())
|
while (reader.getSubRecordHeader())
|
||||||
|
@ -278,7 +278,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
//
|
//
|
||||||
case ESM::fourCC("NAM0"): // start marker head data /* 1 */
|
case ESM::fourCC("NAM0"): // start marker head data /* 1 */
|
||||||
{
|
{
|
||||||
curr_part = 0; // head part
|
currPart = 0; // head part
|
||||||
|
|
||||||
if (isFO3 || isFONV)
|
if (isFO3 || isFONV)
|
||||||
{
|
{
|
||||||
|
@ -319,7 +319,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData();
|
reader.skipSubRecordData();
|
||||||
}
|
}
|
||||||
else if (curr_part == 0) // head part
|
else if (currPart == 0) // head part
|
||||||
{
|
{
|
||||||
if (isMale || isTES4)
|
if (isMale || isTES4)
|
||||||
reader.getZString(mHeadParts[currentIndex].mesh);
|
reader.getZString(mHeadParts[currentIndex].mesh);
|
||||||
|
@ -328,7 +328,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
|
|
||||||
// TES5 keeps head part formid in mHeadPartIdsMale and mHeadPartIdsFemale
|
// TES5 keeps head part formid in mHeadPartIdsMale and mHeadPartIdsFemale
|
||||||
}
|
}
|
||||||
else if (curr_part == 1) // body part
|
else if (currPart == 1) // body part
|
||||||
{
|
{
|
||||||
if (isMale)
|
if (isMale)
|
||||||
reader.getZString(mBodyPartsMale[currentIndex].mesh);
|
reader.getZString(mBodyPartsMale[currentIndex].mesh);
|
||||||
|
@ -359,14 +359,14 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData();
|
reader.skipSubRecordData();
|
||||||
}
|
}
|
||||||
else if (curr_part == 0) // head part
|
else if (currPart == 0) // head part
|
||||||
{
|
{
|
||||||
if (isMale || isTES4)
|
if (isMale || isTES4)
|
||||||
reader.getZString(mHeadParts[currentIndex].texture);
|
reader.getZString(mHeadParts[currentIndex].texture);
|
||||||
else
|
else
|
||||||
reader.getZString(mHeadPartsFemale[currentIndex].texture); // TODO: check TES4
|
reader.getZString(mHeadPartsFemale[currentIndex].texture); // TODO: check TES4
|
||||||
}
|
}
|
||||||
else if (curr_part == 1) // body part
|
else if (currPart == 1) // body part
|
||||||
{
|
{
|
||||||
if (isMale)
|
if (isMale)
|
||||||
reader.getZString(mBodyPartsMale[currentIndex].texture);
|
reader.getZString(mBodyPartsMale[currentIndex].texture);
|
||||||
|
@ -384,20 +384,20 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
|
|
||||||
if (isFO3 || isFONV)
|
if (isFO3 || isFONV)
|
||||||
{
|
{
|
||||||
curr_part = 1; // body part
|
currPart = 1; // body part
|
||||||
|
|
||||||
mBodyPartsMale.resize(4);
|
mBodyPartsMale.resize(4);
|
||||||
mBodyPartsFemale.resize(4);
|
mBodyPartsFemale.resize(4);
|
||||||
}
|
}
|
||||||
else if (isTES4)
|
else if (isTES4)
|
||||||
{
|
{
|
||||||
curr_part = 1; // body part
|
currPart = 1; // body part
|
||||||
|
|
||||||
mBodyPartsMale.resize(5); // 0 = upper body, 1 = legs, 2 = hands, 3 = feet, 4 = tail
|
mBodyPartsMale.resize(5); // 0 = upper body, 1 = legs, 2 = hands, 3 = feet, 4 = tail
|
||||||
mBodyPartsFemale.resize(5); // 0 = upper body, 1 = legs, 2 = hands, 3 = feet, 4 = tail
|
mBodyPartsFemale.resize(5); // 0 = upper body, 1 = legs, 2 = hands, 3 = feet, 4 = tail
|
||||||
}
|
}
|
||||||
else // TES5
|
else // TES5
|
||||||
curr_part = 2; // for TES5 NAM1 indicates the start of EGT model
|
currPart = 2; // for TES5 NAM1 indicates the start of EGT model
|
||||||
|
|
||||||
if (isTES4)
|
if (isTES4)
|
||||||
currentIndex = 4; // FIXME: argonian tail mesh without preceeding INDX
|
currentIndex = 4; // FIXME: argonian tail mesh without preceeding INDX
|
||||||
|
@ -613,7 +613,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
|
||||||
}
|
}
|
||||||
case ESM::fourCC("NAM3"): // start of hkx model
|
case ESM::fourCC("NAM3"): // start of hkx model
|
||||||
{
|
{
|
||||||
curr_part = 3; // for TES5 NAM3 indicates the start of hkx model
|
currPart = 3; // for TES5 NAM3 indicates the start of hkx model
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ void ESM4::Reference::load(ESM4::Reader& reader)
|
||||||
break;
|
break;
|
||||||
case ESM::fourCC("NAME"):
|
case ESM::fourCC("NAME"):
|
||||||
{
|
{
|
||||||
ESM::FormId BaseId;
|
ESM::FormId baseId;
|
||||||
reader.getFormId(BaseId);
|
reader.getFormId(baseId);
|
||||||
mBaseObj = BaseId;
|
mBaseObj = baseId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::fourCC("DATA"):
|
case ESM::fourCC("DATA"):
|
||||||
|
|
|
@ -681,29 +681,29 @@ namespace ESMTerrain
|
||||||
|
|
||||||
if (mAutoUseNormalMaps)
|
if (mAutoUseNormalMaps)
|
||||||
{
|
{
|
||||||
std::string texture_ = texture;
|
std::string normalMapTexture = texture;
|
||||||
Misc::StringUtils::replaceLast(texture_, ".", mNormalHeightMapPattern + ".");
|
Misc::StringUtils::replaceLast(normalMapTexture, ".", mNormalHeightMapPattern + ".");
|
||||||
if (mVFS->exists(texture_))
|
if (mVFS->exists(normalMapTexture))
|
||||||
{
|
{
|
||||||
info.mNormalMap = std::move(texture_);
|
info.mNormalMap = std::move(normalMapTexture);
|
||||||
info.mParallax = true;
|
info.mParallax = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texture_ = texture;
|
normalMapTexture = texture;
|
||||||
Misc::StringUtils::replaceLast(texture_, ".", mNormalMapPattern + ".");
|
Misc::StringUtils::replaceLast(normalMapTexture, ".", mNormalMapPattern + ".");
|
||||||
if (mVFS->exists(texture_))
|
if (mVFS->exists(normalMapTexture))
|
||||||
info.mNormalMap = std::move(texture_);
|
info.mNormalMap = std::move(normalMapTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAutoUseSpecularMaps)
|
if (mAutoUseSpecularMaps)
|
||||||
{
|
{
|
||||||
std::string texture_ = texture;
|
std::string specularMapTexture = texture;
|
||||||
Misc::StringUtils::replaceLast(texture_, ".", mSpecularMapPattern + ".");
|
Misc::StringUtils::replaceLast(specularMapTexture, ".", mSpecularMapPattern + ".");
|
||||||
if (mVFS->exists(texture_))
|
if (mVFS->exists(specularMapTexture))
|
||||||
{
|
{
|
||||||
info.mDiffuseMap = std::move(texture_);
|
info.mDiffuseMap = std::move(specularMapTexture);
|
||||||
info.mSpecular = true;
|
info.mSpecular = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <boost/program_options/detail/config_file.hpp>
|
#include <boost/program_options/detail/config_file.hpp>
|
||||||
#include <boost/program_options/detail/convert.hpp>
|
#include <boost/program_options/detail/convert.hpp>
|
||||||
|
|
||||||
|
// NOLINTBEGIN(readability-identifier-naming)
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
|
@ -289,3 +291,5 @@ namespace Files
|
||||||
template bpo::basic_parsed_options<char> parse_config_file(
|
template bpo::basic_parsed_options<char> parse_config_file(
|
||||||
std::basic_istream<char>& is, const bpo::options_description& desc, bool allow_unregistered);
|
std::basic_istream<char>& is, const bpo::options_description& desc, bool allow_unregistered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(readability-identifier-naming)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <boost/program_options/parsers.hpp>
|
#include <boost/program_options/parsers.hpp>
|
||||||
|
|
||||||
|
// NOLINTBEGIN(readability-identifier-naming)
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -14,4 +16,6 @@ namespace Files
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(readability-identifier-naming)
|
||||||
|
|
||||||
#endif // COMPONENTS_FILES_CONFIGFILEPARSER_HPP
|
#endif // COMPONENTS_FILES_CONFIGFILEPARSER_HPP
|
|
@ -395,8 +395,8 @@ namespace Gui
|
||||||
if (one != 1)
|
if (one != 1)
|
||||||
fail(*file, fileName, "Unexpected value");
|
fail(*file, fileName, "Unexpected value");
|
||||||
|
|
||||||
char name_[284];
|
char nameBuffer[284];
|
||||||
file->read(name_, sizeof(name_));
|
file->read(nameBuffer, sizeof(nameBuffer));
|
||||||
if (!file->good())
|
if (!file->good())
|
||||||
fail(*file, fileName, "File too small to be a valid font");
|
fail(*file, fileName, "File too small to be a valid font");
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ namespace Gui
|
||||||
file.reset();
|
file.reset();
|
||||||
|
|
||||||
// Create the font texture
|
// Create the font texture
|
||||||
const std::string name(name_);
|
const std::string name(nameBuffer);
|
||||||
const std::string bitmapFilename = "fonts/" + name + ".tex";
|
const std::string bitmapFilename = "fonts/" + name + ".tex";
|
||||||
|
|
||||||
Files::IStreamPtr bitmapFile = mVFS->get(bitmapFilename);
|
Files::IStreamPtr bitmapFile = mVFS->get(bitmapFilename);
|
||||||
|
|
|
@ -172,10 +172,10 @@ namespace LuaUtil
|
||||||
std::optional<T> res = std::nullopt;
|
std::optional<T> res = std::nullopt;
|
||||||
mLua.protectedCall([&](LuaUtil::LuaView& view) {
|
mLua.protectedCall([&](LuaUtil::LuaView& view) {
|
||||||
LoadedData& data = ensureLoaded();
|
LoadedData& data = ensureLoaded();
|
||||||
auto I = data.mPublicInterfaces.get<sol::optional<sol::table>>(interfaceName);
|
auto interface = data.mPublicInterfaces.get<sol::optional<sol::table>>(interfaceName);
|
||||||
if (I)
|
if (interface)
|
||||||
{
|
{
|
||||||
auto o = I->get_or<sol::object>(identifier, sol::nil);
|
auto o = interface->get_or<sol::object>(identifier, sol::nil);
|
||||||
if (o.is<sol::function>())
|
if (o.is<sol::function>())
|
||||||
{
|
{
|
||||||
sol::object luaRes = o.as<sol::function>().call(args...);
|
sol::object luaRes = o.as<sol::function>().call(args...);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue