MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / LoadGameTimeConfigs

Function LoadGameTimeConfigs

internal/gametime/gametimedata.go:94–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94func LoadGameTimeConfigs() {
95
96 start := time.Now()
97
98 path := string(configs.GetFilePathsConfig().DataFiles) + `/gametime.yaml`
99
100 bytes, err := util.ReadFile(path)
101 if err != nil {
102 panic(errors.Wrap(err, `filepath: `+path))
103 }
104
105 err = yaml.Unmarshal(bytes, &gameTimeData)
106 if err != nil {
107 panic(errors.Wrap(err, `filepath: `+path))
108 }
109
110 if gameTimeData.Calendars == nil {
111 gameTimeData.Calendars = make(map[string]CalendarConfig)
112 }
113
114 if _, ok := gameTimeData.Calendars[`default`]; !ok {
115 gameTimeData.Calendars[`default`] = failoverConfig
116 }
117
118 for name, cfg := range gameTimeData.Calendars {
119 applyCalendarConfig(name, cfg)
120 }
121
122 mudlog.Info("...LoadGameTimeConfigs()", "loadedCount", len(gameTimeData.Calendars), "Time Taken", time.Since(start))
123}
124
125// applyCalendarConfig pre-computes all derived constants from c and stores them
126// in activeCalendar[name]. It also resets the round-date cache when the "default"

Callers 1

loadAllDataFilesFunction · 0.92

Calls 5

GetFilePathsConfigFunction · 0.92
ReadFileFunction · 0.92
InfoFunction · 0.92
applyCalendarConfigFunction · 0.85
WrapMethod · 0.80

Tested by

no test coverage detected