giants-stupid-server/giants/map.py

25 lines
597 B
Python
Raw Normal View History

import os
2019-01-22 01:30:42 +01:00
class Map:
def __init__(self, mappath):
self.mappath = mappath
2019-01-22 01:30:42 +01:00
self.checksum = None
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
self.mapname = mappath.split(".gck")[0]
self.checksum = Map.checksum(mappath)
2019-01-22 01:30:42 +01:00
@staticmethod
def checksum(mapname):
# TODO
2019-01-22 01:30:42 +01:00
return 1