Skip to content

Commit

Permalink
Prepare config options help
Browse files Browse the repository at this point in the history
Most entries must still be written. ;)
Make restoring equipped items active for all and non-configurable Attnam#406
Remove redundant messages from auto map notes Attnam#505
  • Loading branch information
red-kangaroo committed Nov 15, 2019
1 parent c5c4eb3 commit 9a79677
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 92 deletions.
13 changes: 7 additions & 6 deletions FeLib/Include/config.h
Expand Up @@ -57,20 +57,21 @@ class configsystem

struct configoption
{
configoption(cchar*, cchar*);
configoption(cchar*, cchar*, cchar*);
virtual ~configoption() = default;
virtual void SaveValue(std::ofstream&) const = 0;
virtual void LoadValue(inputfile&) = 0;
virtual truth ActivateChangeInterface() = 0;
virtual void DisplayValue(festring&) const = 0;
cchar* Name;
cchar* Description;
cchar* HelpInfo;
festring fsCategory;
};

struct stringoption : public configoption
{
stringoption(cchar*, cchar*, cfestring&,
stringoption(cchar*, cchar*, cchar*, cfestring&,
void (*)(const stringoption*, festring&)
= &configsystem::NormalStringDisplayer,
truth (*)(stringoption*)
Expand All @@ -91,7 +92,7 @@ struct stringoption : public configoption

struct numberoption : public configoption
{
numberoption(cchar*, cchar*, long,
numberoption(cchar*, cchar*, cchar*, long,
void (*)(const numberoption*, festring&)
= &configsystem::NormalNumberDisplayer,
truth (*)(numberoption*)
Expand All @@ -112,7 +113,7 @@ struct numberoption : public configoption

struct scrollbaroption : public numberoption
{
scrollbaroption(cchar*, cchar*, long,
scrollbaroption(cchar*, cchar*, cchar*, long,
void (*)(const numberoption*, festring&),
truth (*)(numberoption*),
void (*)(numberoption*, long)
Expand All @@ -123,7 +124,7 @@ struct scrollbaroption : public numberoption

struct truthoption : public configoption
{
truthoption(cchar*, cchar*, truth,
truthoption(cchar*, cchar*, cchar*, truth,
void (*)(const truthoption*, festring&)
= &configsystem::NormalTruthDisplayer,
truth (*)(truthoption*)
Expand All @@ -144,7 +145,7 @@ struct truthoption : public configoption

struct cycleoption : public configoption
{
cycleoption(cchar*, cchar*, long, long,
cycleoption(cchar*, cchar*, cchar*, long, long,
void (*)(const cycleoption*, festring&)
= &configsystem::NormalCycleDisplayer,
truth (*)(cycleoption*)
Expand Down
30 changes: 15 additions & 15 deletions FeLib/Source/config.cpp
Expand Up @@ -34,59 +34,58 @@ void configsystem::NormalTruthChanger(truthoption* O, truth What)
void configsystem::NormalCycleChanger(cycleoption* O, long What)
{ O->Value = What; }

configoption::configoption(cchar* Name, cchar* Description)
: Name(Name), Description(Description) { }
configoption::configoption(cchar* Name, cchar* Description, cchar* HelpInfo)
: Name(Name), Description(Description), HelpInfo(HelpInfo) { }

stringoption::stringoption(cchar* Name, cchar* Desc,
cfestring& Value,
cchar* HelpInfo, cfestring& Value,
void (*ValueDisplayer)(const stringoption*,
festring&),
truth (*ChangeInterface)(stringoption*),
void (*ValueChanger)(stringoption*,
cfestring&))
: configoption(Name, Desc),
: configoption(Name, Desc, HelpInfo),
Value(Value), ValueDisplayer(ValueDisplayer),
ChangeInterface(ChangeInterface),
ValueChanger(ValueChanger) { }

numberoption::numberoption(cchar* Name, cchar* Desc, long Value,
numberoption::numberoption(cchar* Name, cchar* Desc, cchar* HelpInfo, long Value,
void (*ValueDisplayer)(const numberoption*,
festring&),
truth (*ChangeInterface)(numberoption*),
void (*ValueChanger)(numberoption*, long))
: configoption(Name, Desc),
: configoption(Name, Desc, HelpInfo),
Value(Value), ValueDisplayer(ValueDisplayer),
ChangeInterface(ChangeInterface),
ValueChanger(ValueChanger) { }

scrollbaroption::scrollbaroption(cchar* Name,
cchar* Desc, long Value,
scrollbaroption::scrollbaroption(cchar* Name, cchar* Desc, cchar* HelpInfo, long Value,
void (*ValueDisplayer)(const numberoption*,
festring&),
truth (*ChangeInterface)(numberoption*),
void (*ValueChanger)(numberoption*, long),
void (*BarHandler)(long))
: numberoption(Name, Desc, Value, ValueDisplayer,
: numberoption(Name, Desc, HelpInfo, Value, ValueDisplayer,
ChangeInterface, ValueChanger),
BarHandler(BarHandler) { }

truthoption::truthoption(cchar* Name, cchar* Desc, truth Value,
truthoption::truthoption(cchar* Name, cchar* Desc, cchar* HelpInfo, truth Value,
void (*ValueDisplayer)(const truthoption*, festring&),
truth (*ChangeInterface)(truthoption*),
void (*ValueChanger)(truthoption*, truth))
: configoption(Name, Desc),
: configoption(Name, Desc, HelpInfo),
Value(Value), ValueDisplayer(ValueDisplayer),
ChangeInterface(ChangeInterface),
ValueChanger(ValueChanger) { }

cycleoption::cycleoption(cchar* Name, cchar* Desc,
cycleoption::cycleoption(cchar* Name, cchar* Desc, cchar* HelpInfo,
long Value, long CycleCount,
void (*ValueDisplayer)(const cycleoption*,
festring&),
truth (*ChangeInterface)(cycleoption*),
void (*ValueChanger)(cycleoption*,
long))
: configoption(Name, Desc),
: configoption(Name, Desc, HelpInfo),
Value(Value), CycleCount(CycleCount),
ValueDisplayer(ValueDisplayer),
ChangeInterface(ChangeInterface),
Expand Down Expand Up @@ -139,7 +138,7 @@ void configsystem::Show(void (*BackGroundDrawer)(),
int Chosen;
truth TruthChange = false;

felist List(CONST_S("Which setting do you wish to configure? (* - req. restart)"));
felist List(CONST_S("Which setting do you wish to configure? (* requires restart)"));

List.AddDescription(CONST_S(""));
List.AddDescription(CONST_S("Setting Value"));
Expand Down Expand Up @@ -172,7 +171,8 @@ void configsystem::Show(void (*BackGroundDrawer)(),
}

List.AddEntry(Entry, LIGHT_GRAY);
List.SetLastEntryHelp(Option[c]->Description); //TODO show all possible values, and each value could have more details, may require cycling thru them all to get all texts...
// TODO: help should show all possible values with details, may require cycling thru them
List.SetLastEntryHelp(festring() << Option[c]->Description << "\n\n" << Option[c]->HelpInfo);
}

if(SlaveScreen && ListAttributeInitializer)
Expand Down
13 changes: 9 additions & 4 deletions Main/Source/char.cpp
Expand Up @@ -4484,10 +4484,15 @@ void character::ShowNewPosInfo() const

if(GetLSquareUnder()->HasEngravings())
{
if(CanRead())
ADD_MESSAGE("Something has been engraved here: \"%s\"", GetLSquareUnder()->GetEngraved());
else
ADD_MESSAGE("Something has been engraved here.");
cchar* Text = GetLSquareUnder()->GetEngraved();

if(Text[0] != '#') // Prevent displaying map notes.
{
if(CanRead())
ADD_MESSAGE("Something has been engraved here: \"%s\"", Text);
else
ADD_MESSAGE("Something has been engraved here.");
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Main/Source/cmdcraft.cpp
Expand Up @@ -2749,7 +2749,7 @@ void updateCraftDesc(){
craftRecipes.EmptyDescription();

float fSkill=craftcore::CraftSkill(PLAYER); //TODO should this dynamic value show too where stats are?
festring fsSkill="\nCrafting Proficiency: "; // It's actually different from skills, so don't call it a skill.
festring fsSkill="Crafting Proficiency: "; // It's actually different from skills, so don't call it a skill.
static char cSkill[20];
sprintf(cSkill, "%.1f",fSkill);
fsSkill<<cSkill;
Expand Down Expand Up @@ -2900,7 +2900,7 @@ truth craftcore::Craft(character* Char) //TODO currently this is an over simplif
bool bInitRecipes = vrpAllRecipes.size()==0;

if(bInitRecipes){
craftRecipes.AddEntry(festring()+"Suspended crafting actions.", LIGHT_GRAY, 20, 0, true);
craftRecipes.AddEntry(festring()+"Suspended crafting actions", LIGHT_GRAY, 20, 0, true);
craftRecipes.SetLastEntryHelp("Resume or remove already started crafting actions.");
}

Expand Down

0 comments on commit 9a79677

Please sign in to comment.