2019-01-23 10:28:23 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
2019-01-22 01:30:42 +01:00
|
|
|
class Map:
|
2019-01-23 10:28:23 +01:00
|
|
|
def __init__(self, mappath):
|
|
|
|
self.mappath = mappath
|
2019-01-22 01:30:42 +01:00
|
|
|
self.checksum = None
|
2019-01-23 10:28:23 +01:00
|
|
|
self.mapname = "Unknown map"
|
|
|
|
self.load_map(mappath)
|
|
|
|
|
|
|
|
def load_map(self, mappath):
|
|
|
|
if not os.path.exists("maps/"+mappath):
|
|
|
|
raise Exception("Map not found: "+mappath)
|
|
|
|
|
|
|
|
if not mappath.endswith(".gck"):
|
|
|
|
raise Exception("Server only supports GCK maps")
|
2019-01-22 01:30:42 +01:00
|
|
|
|
2019-01-23 10:28:23 +01:00
|
|
|
self.mapname = mappath.split(".gck")[0]
|
|
|
|
self.checksum = Map.checksum(mappath)
|
2019-01-22 01:30:42 +01:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def checksum(mapname):
|
2019-01-23 10:28:23 +01:00
|
|
|
# TODO
|
2019-01-22 01:30:42 +01:00
|
|
|
return 1
|