1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-20 14:15:23 +00:00

common: convert objLookupRaw into a struct (#108)

Ain't noone got time for that :)

So, we automated it:

a.sh: script automating the work
a.go: tool to pretty print the parsed ObjectLookups
b.go: output of a.go
c.go: compare before and after rewrite to ensure they are identical

a.go: https://play.golang.org/p/P8G1byhzMtY
b.go: output of `go run a.go`
c:go: https://play.golang.org/p/q8LXBbBhkp5

a.sh contents follows below:

	#!/bin/bash

	# go get golang.org/x/tools/cmd/goimports
	# go get github.com/mewkiz/cmd/sar

	echo -n -e "//+build ignore\n\npackage common\n\nvar ObjectLookups = " > b.go
	go run a.go >> b.go

	sar -i '[A-Za-z_][A-Za-z0-9_]*:[\"][\"],' '' b.go
	sar -i 'Type:1,' 'Type:ObjectTypeCharacter,' b.go
	sar -i 'Type:2,' 'Type:ObjectTypeItem,' b.go
	sar -i 'common.ObjectLookupRecord' 'ObjectLookupRecord' b.go
	goimports -w b.go
This commit is contained in:
Robin Eklind 2019-11-10 00:29:34 -06:00 committed by Tim Sarbin
parent b0ca8138bd
commit 44a6a5672c
2 changed files with 7894 additions and 7943 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,6 @@ func CreateEngine() *Engine {
common.LoadUniqueItems(result)
common.LoadMissiles(result)
common.LoadSounds(result)
common.LoadObjectLookups()
common.LoadAnimationData(result)
common.LoadMonStats(result)
result.SoundManager = sound.CreateManager(result)