giants-stupid-server/giants/map.py

25 lines
597 B
Python

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