public int Init() {
		// Delete the contents of the log file.
		if (logFilename != null) {
			try {
				FileOutputStream fos = new FileOutputStream(logFilename);
				fos.close();
				WriteLogMessage("initializing");
			} catch (Exception e) {
				// do nothing.
			}
		}

		switch (initMode) {
		case 0:
			return LoadMapFromFile(mapFilename);
		case 1:
			return ParseGameState(mapData);
		default:
			return 0;
		}
	}