MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / PltCopyKeyConfig

Function PltCopyKeyConfig

Descent3/pilot.cpp:2014–2045  ·  view source on GitHub ↗

/////////////////////////////////////////////////// Copies the key/joy config of a pilot to another (src must exist!) (Keep up to date with Read/Write file) this will also save out the dest, so make sure its filled in before calling function

Source from the content-addressed store, hash-verified

2012// Copies the key/joy config of a pilot to another (src must exist!) (Keep up to date with Read/Write file)
2013// this will also save out the dest, so make sure its filled in before calling function
2014bool PltCopyKeyConfig(pilot *src, pilot *dest) {
2015 // check to make sure src exists
2016 ASSERT(src);
2017 ASSERT(dest);
2018
2019 char pname[PILOT_STRING_SIZE];
2020 src->get_name(pname);
2021
2022 if ((pname[0] != 0) && (strlen(pname) > 0) && (strcmp(pname, " ") != 0)) {
2023 int i;
2024 for (i = 0; i < NUM_CONTROLLER_FUNCTIONS; i++) {
2025 dest->controls[i].id = src->controls[i].id;
2026 dest->controls[i].type[0] = src->controls[i].type[0];
2027 dest->controls[i].type[1] = src->controls[i].type[1];
2028 dest->controls[i].value = src->controls[i].value;
2029 dest->controls[i].flags[0] = src->controls[i].flags[0];
2030 dest->controls[i].flags[1] = src->controls[i].flags[1];
2031 }
2032 for (i = 0; i < N_MOUSE_AXIS; i++) {
2033 dest->mouse_sensitivity[i] = src->mouse_sensitivity[i];
2034 }
2035 for (i = 0; i < N_JOY_AXIS; i++) {
2036 dest->joy_sensitivity[i] = src->joy_sensitivity[i];
2037 }
2038 dest->key_ramping = src->key_ramping;
2039 dest->read_controller = src->read_controller;
2040 dest->mouselook_control = src->mouselook_control;
2041
2042 return true;
2043 } else
2044 return false;
2045}
2046
2047/*
2048 ************************************************************************

Callers 2

PilotSelectFunction · 0.85
PilotCopyDefaultControlsFunction · 0.85

Calls 1

get_nameMethod · 0.45

Tested by

no test coverage detected