示例#1
0
func init() {
	var cfg config.Config
	cfg.Load()

	Settings = cfg.Entities
	Races = make([]Race, len(cfg.Race), len(cfg.Race))
	for name, params := range cfg.Race {
		Races[params.Id] = Race{params.Id, name, Color{params.Red, params.Green, params.Blue}}
	}
}
示例#2
0
func init() {
	var cfg config.Config
	cfg.Load()
	db.InitPool(cfg.Database.Host, cfg.Database.Port, 13)
	conn := db.Pool.Get()
	defer conn.Close()

	conn.Do("FLUSHDB")
	testServer = NewServer(
		cfg.Server.Host,
		7013,
	)

	go testServer.Start()
	for !testServer.isRunning {
		time.Sleep(100 * time.Millisecond)
	}
}