| 110 | |
| 111 | |
| 112 | bool soar_interface::get_vec3(Symbol* id, const string& attr, vec3& val) |
| 113 | { |
| 114 | vec3 res; |
| 115 | |
| 116 | // First find the vec3 wme |
| 117 | wme* vec3_wme; |
| 118 | if (!find_child_wme(id, attr.c_str(), vec3_wme)) |
| 119 | { |
| 120 | return false; |
| 121 | } |
| 122 | Symbol* vec3_root = get_wme_val(vec3_wme); |
| 123 | |
| 124 | // Then find each dimension to make up the vec3 |
| 125 | const char* dims[] = { "x", "y", "z" }; |
| 126 | for (int d = 0; d < 3; d++) |
| 127 | { |
| 128 | wme* dim_wme; |
| 129 | double dim_val = 0.0; |
| 130 | if (!find_child_wme(vec3_root, dims[d], dim_wme) |
| 131 | || !get_symbol_value(get_wme_val(dim_wme), dim_val)) |
| 132 | { |
| 133 | return false; |
| 134 | } |
| 135 | res[d] = dim_val; |
| 136 | } |
| 137 | val = res; |
| 138 | return true; |
| 139 | } |
| 140 | |
| 141 | |
| 142 | bool soar_interface::find_child_wme(Symbol* id, const string& attr, wme*& w) |
no test coverage detected