project_files/frontlib/net/netprotocol.c
changeset 7482 d70a5b0d1190
parent 7338 1ed603a54ebd
child 7497 7e1d72fc03c7
equal deleted inserted replaced
7479:c8c552ee3acb 7482:d70a5b0d1190
    73 	}
    73 	}
    74 	flib_team_destroy(tmpTeam);
    74 	flib_team_destroy(tmpTeam);
    75 	return result;
    75 	return result;
    76 }
    76 }
    77 
    77 
    78 flib_scheme *flib_netmsg_to_cfg(flib_metascheme *meta, char **parts) {
    78 flib_scheme *flib_scheme_from_netmsg(flib_metascheme *meta, char **parts) {
    79 	flib_scheme *result = flib_scheme_create(meta, parts[0]);
    79 	flib_scheme *result = flib_scheme_create(meta, parts[0]);
    80 	if(result) {
    80 	if(result) {
    81 		for(int i=0; i<meta->modCount; i++) {
    81 		for(int i=0; i<meta->modCount; i++) {
    82 			result->mods[i] = !strcmp(parts[i+1], "true");
    82 			result->mods[i] = !strcmp(parts[i+1], "true");
    83 		}
    83 		}
    86 		}
    86 		}
    87 	}
    87 	}
    88 	return result;
    88 	return result;
    89 }
    89 }
    90 
    90 
    91 flib_map *flib_netmsg_to_map(char **parts) {
    91 flib_map *flib_map_from_netmsg(char **parts) {
    92 	flib_map *result = flib_map_create_named(parts[3], parts[0]);
    92 	flib_map *result = flib_map_create_named(parts[3], parts[0]);
    93 	if(result) {
    93 	if(result) {
    94 		result->mapgen = atoi(parts[1]);
    94 		result->mapgen = atoi(parts[1]);
    95 		result->mazeSize = atoi(parts[2]);
    95 		result->mazeSize = atoi(parts[2]);
    96 		result->templateFilter = atoi(parts[4]);
    96 		result->templateFilter = atoi(parts[4]);
    97 	}
    97 	}
    98 	return result;
    98 	return result;
    99 }
    99 }
   100 
   100 
   101 int flib_netmsg_to_drawnmapdata(char *netmsg, uint8_t** outbuf, size_t *outlen) {
   101 int flib_drawnmapdata_from_netmsg(char *netmsg, uint8_t** outbuf, size_t *outlen) {
   102 	int result = -1;
   102 	int result = -1;
   103 
   103 
   104 	// First step: base64 decoding
   104 	// First step: base64 decoding
   105 	char *base64decout = NULL;
   105 	char *base64decout = NULL;
   106 	size_t base64declen;
   106 	size_t base64declen;