MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Scenario_Load_Team

Function Scenario_Load_Team

src/scenario.c:410–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410static void Scenario_Load_Team(const char *key, char *settings)
411{
412 uint8 houseType, teamActionType, movementType;
413 uint16 minMembers, maxMembers;
414 char *split;
415
416 VARIABLE_NOT_USED(key);
417
418 /* The value should have 5 values separated by a ',' */
419 split = strchr(settings, ',');
420 if (split == NULL) return;
421 *split = '\0';
422
423 /* First value is the House type */
424 houseType = House_StringToType(settings);
425 if (houseType == HOUSE_INVALID) return;
426
427 /* Find the next value in the ',' separated list */
428 settings = split + 1;
429 split = strchr(settings, ',');
430 if (split == NULL) return;
431 *split = '\0';
432
433 /* Second value is the teamAction type */
434 teamActionType = Team_ActionStringToType(settings);
435 if (teamActionType == TEAM_ACTION_INVALID) return;
436
437 /* Find the next value in the ',' separated list */
438 settings = split + 1;
439 split = strchr(settings, ',');
440 if (split == NULL) return;
441 *split = '\0';
442
443 /* Third value is the movement type */
444 movementType = Unit_MovementStringToType(settings);
445 if (movementType == MOVEMENT_INVALID) return;
446
447 /* Find the next value in the ',' separated list */
448 settings = split + 1;
449 split = strchr(settings, ',');
450 if (split == NULL) return;
451 *split = '\0';
452
453 /* Fourth value is minimum amount of members in team */
454 minMembers = atoi(settings);
455
456 /* Find the next value in the ',' separated list */
457 settings = split + 1;
458 split = strchr(settings, ',');
459 if (split == NULL) return;
460 *split = '\0';
461
462 /* Fifth value is maximum amount of members in team */
463 maxMembers = atoi(settings);
464
465 Team_Create(houseType, teamActionType, movementType, minMembers, maxMembers);
466}
467

Callers

nothing calls this directly

Calls 4

House_StringToTypeFunction · 0.85
Team_ActionStringToTypeFunction · 0.85
Team_CreateFunction · 0.85

Tested by

no test coverage detected