1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00
OpenDiablo2/d2core/d2records/level_maze_loader.go
gravestench 271673851a
Added RecordManager implementation to remove d2datadict singletons (#736)
* Added RecordManager implementation to remove d2datadict singletons

* fix object lookup test
2020-09-19 14:33:40 -04:00

35 lines
751 B
Go

package d2records
import (
"log"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
func levelMazeDetailsLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(LevelMazeDetails)
for d.Next() {
record := &LevelMazeDetailsRecord{
Name: d.String("Name"),
LevelID: d.Number("Level"),
NumRoomsNormal: d.Number("Rooms"),
NumRoomsNightmare: d.Number("Rooms(N)"),
NumRoomsHell: d.Number("Rooms(H)"),
SizeX: d.Number("SizeX"),
SizeY: d.Number("SizeY"),
}
records[record.LevelID] = record
}
if d.Err != nil {
return d.Err
}
log.Printf("Loaded %d LevelMazeDetails records", len(records))
r.Level.Maze = records
return nil
}