Files
cheesy-arena-lite/main.go

42 lines
670 B
Go
Raw Normal View History

2014-05-24 00:39:22 -07:00
// Copyright 2014 Team 254. All Rights Reserved.
// Author: pat@patfairbank.com (Patrick Fairbank)
package main
import (
"log"
2014-05-25 17:21:42 -07:00
"math/rand"
"time"
2014-05-24 00:39:22 -07:00
)
2014-06-07 02:02:12 -07:00
const eventDbPath = "./event.db"
var db *Database
2014-06-06 21:26:55 -07:00
var eventSettings *EventSettings
2014-05-24 00:39:22 -07:00
func main() {
2014-05-25 17:21:42 -07:00
rand.Seed(time.Now().UnixNano())
2014-06-07 02:02:12 -07:00
initDb()
2014-07-04 16:55:29 -07:00
go ServeWebInterface()
listener, err := DsPacketListener()
checkErr(err)
go ListenForDsPackets(listener)
mainArena.Setup()
mainArena.Run()
2014-06-07 02:02:12 -07:00
}
func initDb() {
2014-06-06 21:26:55 -07:00
var err error
2014-06-07 02:02:12 -07:00
db, err = OpenDatabase(eventDbPath)
2014-06-06 21:26:55 -07:00
checkErr(err)
eventSettings, err = db.GetEventSettings()
checkErr(err)
2014-05-24 00:39:22 -07:00
}
func checkErr(err error) {
if err != nil {
log.Fatalln("Error: ", err)
}
}