switch string to ifelseif

This commit is contained in:
Teddy Stoddard 2017-10-16 12:17:29 -04:00
parent 399815525f
commit 9b2d30b4d5

View File

@ -1600,40 +1600,30 @@ void WSRequestHandler::HandleSetSceneItemProperties(WSRequestHandler* req) {
obs_data_t* req_bounds = obs_data_get_obj(req->data, "bounds"); obs_data_t* req_bounds = obs_data_get_obj(req->data, "bounds");
if (obs_data_has_user_value(req_bounds, "type")) { if (obs_data_has_user_value(req_bounds, "type")) {
const char* new_bounds_type = obs_data_get_string(req_bounds, "type"); const char* new_bounds_type = obs_data_get_string(req_bounds, "type");
switch(new_bounds_type) { if (new_bounds_type == "none") {
case "none": {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_NONE); obs_sceneitem_set_bounds_type(OBS_BOUNDS_NONE);
break;
} }
case "stretch": { else if (new_bounds_type == "stretch") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_STRETCH); obs_sceneitem_set_bounds_type(OBS_BOUNDS_STRETCH);
break;
} }
case "inner": { else if (new_bounds_type == "inner") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_INNER); obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_INNER);
break;
} }
case "outer": { else if (new_bounds_type == "outer") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_OUTER); obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_OUTER);
break;
} }
case "width": { else if (new_bounds_type == "width") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_TO_WIDTH); obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_TO_WIDTH);
break;
} }
case "height": { else if (new_bounds_type == "height") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_TO_HEIGHT); obs_sceneitem_set_bounds_type(OBS_BOUNDS_SCALE_TO_HEIGHT);
break;
} }
case "max": { else if (new_bounds_type == "max") {
obs_sceneitem_set_bounds_type(OBS_BOUNDS_MAX_ONLY); obs_sceneitem_set_bounds_type(OBS_BOUNDS_MAX_ONLY);
break;
} }
default: { else {
// Is this the right course of action? // Is this the right course of action?
// Should we just append an error to the response for a bad bounds type? // Should we just append an error to the response for a bad bounds type?
break;
}
} }
} }
vec2 old_bounds; vec2 old_bounds;