mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
use size_t instead of uint8_t for hint ids
This commit is contained in:
parent
1d716a5975
commit
e841718017
4 changed files with 25 additions and 26 deletions
|
@ -40,7 +40,7 @@ const CustomMessage& HintText::GetObscure() const {
|
|||
return obscureText.size() > 0 ? RandomElement(obscureText) : clearText;
|
||||
}
|
||||
|
||||
const CustomMessage& HintText::GetObscure(uint8_t selection) const {
|
||||
const CustomMessage& HintText::GetObscure(size_t selection) const {
|
||||
if (obscureText.size() > selection) {
|
||||
return obscureText[selection];
|
||||
} else if (obscureText.size() > 0) {
|
||||
|
@ -53,7 +53,7 @@ const CustomMessage& HintText::GetAmbiguous() const {
|
|||
return ambiguousText.size() > 0 ? RandomElement(ambiguousText) : clearText;
|
||||
}
|
||||
|
||||
const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const {
|
||||
const CustomMessage& HintText::GetAmbiguous(size_t selection) const {
|
||||
if (ambiguousText.size() > selection) {
|
||||
return ambiguousText[selection];
|
||||
} else if (ambiguousText.size() > 0) {
|
||||
|
@ -62,15 +62,15 @@ const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const {
|
|||
return clearText;
|
||||
}
|
||||
|
||||
uint8_t HintText::GetAmbiguousSize() const {
|
||||
return static_cast<uint8_t>(ambiguousText.size());
|
||||
size_t HintText::GetAmbiguousSize() const {
|
||||
return ambiguousText.size();
|
||||
}
|
||||
|
||||
uint8_t HintText::GetObscureSize() const {
|
||||
return static_cast<uint8_t>(obscureText.size());
|
||||
size_t HintText::GetObscureSize() const {
|
||||
return obscureText.size();
|
||||
}
|
||||
|
||||
const CustomMessage& HintText::GetHintMessage(uint8_t selection) const {
|
||||
const CustomMessage& HintText::GetHintMessage(size_t selection) const {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
if (ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_OBSCURE)) {
|
||||
return GetObscure(selection);
|
||||
|
|
|
@ -37,12 +37,12 @@ class HintText {
|
|||
std::vector<CustomMessage> obscureText_ = {});
|
||||
const CustomMessage& GetClear() const;
|
||||
const CustomMessage& GetObscure() const;
|
||||
const CustomMessage& GetObscure(uint8_t selection) const;
|
||||
const CustomMessage& GetObscure(size_t selection) const;
|
||||
const CustomMessage& GetAmbiguous() const;
|
||||
const CustomMessage& GetAmbiguous(uint8_t selection) const;
|
||||
uint8_t GetAmbiguousSize() const;
|
||||
uint8_t GetObscureSize() const;
|
||||
const CustomMessage& GetHintMessage(uint8_t selection = 0) const;
|
||||
const CustomMessage& GetAmbiguous(size_t selection) const;
|
||||
size_t GetAmbiguousSize() const;
|
||||
size_t GetObscureSize() const;
|
||||
const CustomMessage& GetHintMessage(size_t selection = 0) const;
|
||||
const CustomMessage GetMessageCopy() const;
|
||||
bool operator==(const HintText& right) const;
|
||||
bool operator!=(const HintText& right) const;
|
||||
|
|
|
@ -174,8 +174,8 @@ void Hint::NamesChosen() {
|
|||
auto ctx = Rando::Context::GetInstance();
|
||||
std::vector<uint8_t> namesTemp = {};
|
||||
bool saveNames = false;
|
||||
uint8_t numMessages = GetNumberOfMessages();
|
||||
for (uint8_t c = 0; c < numMessages; c++) {
|
||||
size_t numMessages = GetNumberOfMessages();
|
||||
for (size_t c = 0; c < numMessages; c++) {
|
||||
uint8_t selection = GetRandomHintTextEntry(GetHintText(c));
|
||||
if (selection > 0) {
|
||||
saveNames = true;
|
||||
|
@ -187,7 +187,7 @@ void Hint::NamesChosen() {
|
|||
}
|
||||
|
||||
if (hintType == HINT_TYPE_ITEM || hintType == HINT_TYPE_ITEM_AREA) {
|
||||
for (uint8_t c = 0; c < locations.size(); c++) {
|
||||
for (size_t c = 0; c < locations.size(); c++) {
|
||||
namesTemp = {};
|
||||
saveNames = false;
|
||||
uint8_t selection = GetRandomHintTextEntry(GetItemHintText(c));
|
||||
|
@ -218,7 +218,7 @@ void Hint::NamesChosen() {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t Hint::GetNumberOfMessages() const {
|
||||
size_t Hint::GetNumberOfMessages() const {
|
||||
size_t numMessages = std::max(messages.size(), hintKeys.size());
|
||||
if (StaticData::staticHintInfoMap.contains(ownKey)) {
|
||||
numMessages = std::max(StaticData::staticHintInfoMap[ownKey].hintKeys.size(), numMessages);
|
||||
|
@ -226,20 +226,19 @@ uint8_t Hint::GetNumberOfMessages() const {
|
|||
if (numMessages == 0) {
|
||||
numMessages = 1; // RANDOTODO make std::max actually fucking work for 3 arguments
|
||||
}
|
||||
// RANDOTODO will number of messages always be u8?
|
||||
return static_cast<uint8_t>(numMessages);
|
||||
return numMessages;
|
||||
}
|
||||
|
||||
const std::vector<std::string> Hint::GetAllMessageStrings(MessageFormat format) const {
|
||||
std::vector<std::string> hintMessages = {};
|
||||
uint8_t numMessages = GetNumberOfMessages();
|
||||
for (int c = 0; c < numMessages; c++) {
|
||||
size_t numMessages = GetNumberOfMessages();
|
||||
for (size_t c = 0; c < numMessages; c++) {
|
||||
hintMessages.push_back(GetHintMessage(format, c).GetForCurrentLanguage(format));
|
||||
}
|
||||
return hintMessages;
|
||||
}
|
||||
|
||||
const HintText Hint::GetHintText(uint8_t id) const {
|
||||
const HintText Hint::GetHintText(size_t id) const {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
if (hintKeys.size() > id) {
|
||||
return StaticData::hintTextTable[hintKeys[id]];
|
||||
|
@ -284,11 +283,11 @@ const HintText Hint::GetHintText(uint8_t id) const {
|
|||
}
|
||||
}
|
||||
|
||||
const CustomMessage Hint::GetHintMessage(MessageFormat format, uint8_t id) const {
|
||||
const CustomMessage Hint::GetHintMessage(MessageFormat format, size_t id) const {
|
||||
auto ctx = Rando::Context::GetInstance();
|
||||
CustomMessage hintText = CustomMessage("");
|
||||
|
||||
uint8_t chosenMessage = 0;
|
||||
size_t chosenMessage = 0;
|
||||
if (hintTextsChosen.size() > id) {
|
||||
chosenMessage = id;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ class Hint {
|
|||
void FillGapsInData();
|
||||
void SetLocationsAsHinted() const;
|
||||
void NamesChosen();
|
||||
uint8_t GetNumberOfMessages() const;
|
||||
size_t GetNumberOfMessages() const;
|
||||
const std::vector<std::string> GetAllMessageStrings(MessageFormat format = MF_AUTO_FORMAT) const;
|
||||
const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, uint8_t id = 0) const;
|
||||
const HintText GetHintText(uint8_t id = 0) const;
|
||||
const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, size_t id = 0) const;
|
||||
const HintText GetHintText(size_t id = 0) const;
|
||||
oJson toJSON();
|
||||
void logHint(oJson& jsonData);
|
||||
const HintText GetItemHintText(uint8_t slot, bool mysterious = false) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue