X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=server%2Futils.py;h=f7128916f37abbef0fb4136c9123c450fc233740;hb=refs%2Ftags%2Ftce;hp=22acb0dec6564eda7729be8b918e2e85ee9232a6;hpb=f8865085362ad23898ac4b6a00db3b915226d9d3;p=plomrogue diff --git a/server/utils.py b/server/utils.py index 22acb0d..f712891 100644 --- a/server/utils.py +++ b/server/utils.py @@ -84,19 +84,27 @@ def prep_library(): def c_pointer_to_bytearray(ba): """Return C char * pointer to ba.""" - type = ctypes.c_char * len(ba) - return type.from_buffer(ba) + ty = ctypes.c_char * len(ba) + return ty.from_buffer(ba) + + +def c_pointer_to_string(string): + """Return C char * pointer to string.""" + p = ctypes.c_char_p(string.encode("ascii")) + return p def parse_command_line_arguments(): """Return settings values read from command line arguments.""" import argparse parser = argparse.ArgumentParser() + parser.add_argument('-n', dest='new', action='store_true') parser.add_argument('-s', nargs='?', type=int, dest='replay', const=1, action='store') parser.add_argument('-l', nargs="?", const="save", dest='savefile', action="store") - parser.add_argument('-w', type=str, default="confserver/world", + parser.add_argument('-w', type=str, + default="confserver/TheCrawlingEater", dest='worldconf', action='store') parser.add_argument('-v', dest='verbose', action='store_true') opts, unknown = parser.parse_known_args()