Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ for arg in "$@"; do
BUILD_GEN=1
SOMETHING=1
;;
--win | -w)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not grasping why this is here. I build for Windows all the time and this is not needed. Specifically, the -s option disables symbols in the output and the -w option disables DWARF generation. Both of those should only be on the command line when building for a release. By setting them, you're making debugging harder for yourself.

If you're doing this because of some oddity in your particular setup (I believe you were the one having tons of difficulty compiling on Windows for some reason), it's unclear why this would help. It shouldn't have any effect with regards to that... and if it does, it just indicates there is something fundamentally wrong in your setup.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to say, I'm very new to GO. I assumed the -w was a windows flag. I tried just -s and just -w and either and both was ok. Neither and it can't launch as an .exe for me.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into this myself after updating one of my machines to Windows 11 (previously, I had only ever built on a Windows 10 or earlier machine). Unclear why that would make a difference, or if there is something else that changed compared to my older machine that is the actual issue and not Windows 11 itself.

Regardless, one of the recent changes was to the build.sh file to get around this anomaly.

EXTRA_LD_FLAGS="-s -w"
BUILD_GO=1
SOMETHING=1
;;
--help | -h)
echo "$0 [options]"
echo " -a, --all Equivalent to --gen --go --lint --race"
Expand All @@ -67,6 +72,7 @@ for arg in "$@"; do
echo " -l, --lint Run the linters"
echo " -r, --race Run the tests with race-checking enabled"
echo " -t, --test Run the tests"
echo " -w, --win Force Build for Windows"
echo " -h, --help This help text"
exit 0
;;
Expand Down
1 change: 1 addition & 0 deletions model/gurps/sheet_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type SheetSettingsData struct {
ExcludeUnspentPointsFromTotal bool `json:"exclude_unspent_points_from_total,omitempty"`
ShowLiftingSTDamage bool `json:"show_lifting_st_damage,omitempty"`
ShowIQBasedDamage bool `json:"show_iq_based_damage,omitempty"`
UseSkillTrees bool `json:"use_skill_trees,omitempty"`
}

// SheetSettings holds sheet settings.
Expand Down
44 changes: 31 additions & 13 deletions model/gurps/skill.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,11 @@ func (s *Skill) DefaultSkill() *Skill {
if e == nil {
return nil
}
requirePoints := !e.SheetSettings.UseSkillTrees
if s.IsTechnique() {
return s.BaseSkill(e, s.TechniqueDefault, true)
return s.BaseSkill(e, s.TechniqueDefault, requirePoints)
}
return s.BaseSkill(e, s.DefaultedFrom, true)
return s.BaseSkill(e, s.DefaultedFrom, requirePoints)
}

// HasDefaultTo returns true if the set of possible defaults includes the other skill.
Expand Down Expand Up @@ -728,8 +729,13 @@ func (s *Skill) DecrementSkillLevel() {
func (s *Skill) CalculateLevel(excludes map[string]bool) Level {
points := s.AdjustedPoints(nil)
if s.IsTechnique() {
return CalculateTechniqueLevel(EntityFromNode(s), s.Replacements, s.NameWithReplacements(),
s.SpecializationWithReplacements(), s.Tags, s.TechniqueDefault, s.Difficulty.Difficulty, points, true,
e := EntityFromNode(s)
Comment thread
NocTempre marked this conversation as resolved.
requirePoints := true
if e != nil {
requirePoints = !e.SheetSettings.UseSkillTrees
}
return CalculateTechniqueLevel(e, s.Replacements, s.NameWithReplacements(),
s.SpecializationWithReplacements(), s.Tags, s.TechniqueDefault, s.Difficulty.Difficulty, points, requirePoints,
s.TechniqueLimitModifier, excludes)
}
return CalculateSkillLevel(EntityFromNode(s), s.NameWithReplacements(), s.SpecializationWithReplacements(), s.Tags,
Expand Down Expand Up @@ -826,7 +832,7 @@ func CalculateTechniqueLevel(e *Entity, replacements map[string]string, name, sp
}
} else {
// Take the modifier back out, as we wanted the base, not the final value.
level = def.SkillLevelFast(e, replacements, true, nil, false) - def.Modifier
level = def.SkillLevelFast(e, replacements, requirePoints, nil, false) - def.Modifier
}
if level != fxp.Min {
baseLevel := level
Expand Down Expand Up @@ -889,16 +895,18 @@ func (s *Skill) bestDefaultWithPoints(excluded *SkillDefault) *SkillDefault {
}

func (s *Skill) bestDefault(excluded *SkillDefault) *SkillDefault {
if EntityFromNode(s) == nil || len(s.Defaults) == 0 {
e := EntityFromNode(s)
if e == nil || len(s.Defaults) == 0 {
return nil
}
requirePoints := !e.SheetSettings.UseSkillTrees
excludes := make(map[string]bool)
excludes[s.String()] = true
var bestDef *SkillDefault
best := fxp.Min
for _, def := range s.resolveToSpecificDefaults() {
// For skill-based defaults, prune out any that already use a default that we are involved with
if def.Equivalent(s.Replacements, excluded) || s.inDefaultChain(def, make(map[*Skill]bool)) {
if def.Equivalent(s.Replacements, excluded) || (s.inDefaultChain(def, make(map[*Skill]bool)) && requirePoints) {
continue
}
if level := s.calcSkillDefaultLevel(def, excludes); best < level {
Expand All @@ -912,11 +920,15 @@ func (s *Skill) bestDefault(excluded *SkillDefault) *SkillDefault {

func (s *Skill) calcSkillDefaultLevel(def *SkillDefault, excludes map[string]bool) fxp.Int {
e := EntityFromNode(s)
level := def.SkillLevel(e, s.Replacements, true, excludes, !s.IsTechnique())
if def.SkillBased() {
requirePoints := true
if e != nil {
requirePoints = !e.SheetSettings.UseSkillTrees
}
level := def.SkillLevel(e, s.Replacements, requirePoints, excludes, !s.IsTechnique())
if def.SkillBased() && e != nil {
defName := def.NameWithReplacements(s.Replacements)
defSpec := def.SpecializationWithReplacements(s.Replacements)
if other := e.BestSkillNamed(defName, defSpec, true, excludes); other != nil {
if other := e.BestSkillNamed(defName, defSpec, requirePoints, excludes); other != nil {
level -= e.SkillBonusFor(defName, defSpec, s.Tags, nil)
}
}
Expand All @@ -928,8 +940,9 @@ func (s *Skill) inDefaultChain(def *SkillDefault, lookedAt map[*Skill]bool) bool
if e == nil || def == nil || !def.SkillBased() {
return false
}
requirePoints := !e.SheetSettings.UseSkillTrees
for _, one := range e.SkillNamed(def.NameWithReplacements(s.Replacements),
def.SpecializationWithReplacements(s.Replacements), true, nil) {
def.SpecializationWithReplacements(s.Replacements), requirePoints, nil) {
if one == s {
return true
}
Expand All @@ -950,8 +963,9 @@ func (s *Skill) resolveToSpecificDefaults() []*SkillDefault {
if e == nil || def == nil || !def.SkillBased() {
result = append(result, def)
} else {
requirePoints := !e.SheetSettings.UseSkillTrees
for _, one := range e.SkillNamed(def.NameWithReplacements(s.Replacements),
def.SpecializationWithReplacements(s.Replacements), true,
def.SpecializationWithReplacements(s.Replacements), requirePoints,
map[string]bool{s.String(): true}) {
local := *def
local.Name = one.NameWithReplacements()
Expand All @@ -969,6 +983,9 @@ func (s *Skill) TechniqueSatisfied(tooltip *xbytes.InsertBuffer, prefix string)
return true
}
e := EntityFromNode(s)
if e != nil && e.SheetSettings.UseSkillTrees {
return true
Comment thread
NocTempre marked this conversation as resolved.
}
sk := e.BestSkillNamed(s.TechniqueDefault.NameWithReplacements(s.Replacements),
s.TechniqueDefault.SpecializationWithReplacements(s.Replacements), false, nil)
satisfied := sk != nil && (sk.IsTechnique() || sk.Points > 0)
Expand Down Expand Up @@ -1123,7 +1140,8 @@ func (s *Skill) SwapDefaults() {
def := s.DefaultedFrom
s.DefaultedFrom = nil
if e := EntityFromNode(s); e != nil {
if baseSkill := s.BaseSkill(e, s.bestDefault(nil), true); baseSkill != nil {
requirePoints := !e.SheetSettings.UseSkillTrees
if baseSkill := s.BaseSkill(e, s.bestDefault(nil), requirePoints); baseSkill != nil {
s.DefaultedFrom = s.bestDefaultWithPoints(def)
baseSkill.UpdateLevel()
s.UpdateLevel()
Expand Down
1 change: 1 addition & 0 deletions ux/pageref_name_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ var PageRefKeyNameMappings = map[string]string{
"PU7:": "Power-Ups 7: Wildcard Skills",
"PU8:": "Power-Ups 8: Limitations",
"PU9:": "Power-Ups 9: Alternate Attributes",
"PU10:": "Power-Ups 10: Skill Trees",
"PW": "Powers: The Weird",
"PY#:": "Pyramid 3 issues (replace # with the issue number, but leave out the leading \"3-\")",
"PY4-#:": "Pyramid 4 issues (replace # with the issue number)",
Expand Down
7 changes: 7 additions & 0 deletions ux/sheet_settings_dockable.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type sheetSettingsDockable struct {
useHalfStatDefaults *unison.CheckBox
showLiftingSTDamage *unison.CheckBox
showIQBasedDamage *unison.CheckBox
useSkillTrees *unison.CheckBox
lengthUnitsPopup *unison.PopupMenu[fxp.LengthUnit]
weightUnitsPopup *unison.PopupMenu[fxp.WeightUnit]
userDescDisplayPopup *unison.PopupMenu[display.Option]
Expand Down Expand Up @@ -227,6 +228,11 @@ func (d *sheetSettingsDockable) createOptions(content *unison.Panel) {
d.settings().ShowIQBasedDamage = d.showIQBasedDamage.State == check.On
d.syncSheet(false)
})
d.useSkillTrees = d.addCheckBoxWithLink(panel, i18n.Text("Use Skill Trees"), "PU10:4",
s.UseSkillTrees, func() {
d.settings().UseSkillTrees = d.useSkillTrees.State == check.On
d.syncSheet(false)
})
content.AddChild(panel)
}

Expand Down Expand Up @@ -488,6 +494,7 @@ func (d *sheetSettingsDockable) sync() {
d.showTitleInsteadOfNameInPageFooter.State = check.FromBool(s.UseTitleInFooter)
d.showLiftingSTDamage.State = check.FromBool(s.ShowLiftingSTDamage)
d.showIQBasedDamage.State = check.FromBool(s.ShowIQBasedDamage)
d.useSkillTrees.State = check.FromBool(s.UseSkillTrees)
d.useMultiplicativeModifiers.State = check.FromBool(s.UseMultiplicativeModifiers)
d.useHalfStatDefaults.State = check.FromBool(s.UseHalfStatDefaults)
d.useModifyDicePlusAdds.State = check.FromBool(s.UseModifyingDicePlusAdds)
Expand Down