| 1915 | } |
| 1916 | |
| 1917 | bool EnvObject::SetFromDesc(const EntityDescription& desc) { |
| 1918 | bool ret = Object::SetFromDesc(desc); |
| 1919 | if (ret) { |
| 1920 | for (const auto& field : desc.fields) { |
| 1921 | switch (field.type) { |
| 1922 | case EDF_FILE_PATH: { |
| 1923 | std::string type_file; |
| 1924 | field.ReadString(&type_file); |
| 1925 | if (!ofr.valid() || ofr->path_ != type_file) { |
| 1926 | if (Load(type_file) == false) { |
| 1927 | LOGE << "Failed to load data for EnvObject" << std::endl; |
| 1928 | ret = false; |
| 1929 | } |
| 1930 | } |
| 1931 | break; |
| 1932 | } |
| 1933 | case EDF_NO_NAVMESH: { |
| 1934 | field.ReadBool(&no_navmesh); |
| 1935 | break; |
| 1936 | } |
| 1937 | } |
| 1938 | } |
| 1939 | |
| 1940 | if (ret) { |
| 1941 | color_tint_component_.SetFromDescription(desc); |
| 1942 | ReceiveObjectMessage(OBJECT_MSG::SET_COLOR, &color_tint_component_.tint_); |
| 1943 | ReceiveObjectMessage(OBJECT_MSG::SET_OVERBRIGHT, &color_tint_component_.overbright_); |
| 1944 | |
| 1945 | const Model& model = Models::Instance()->GetModel(model_id_); |
| 1946 | vec3 min = model.min_coords; |
| 1947 | vec3 max = model.max_coords; |
| 1948 | box_.center = model.center_coords; |
| 1949 | box_.dims = max - min; |
| 1950 | } |
| 1951 | } |
| 1952 | return ret; |
| 1953 | } |
| 1954 | |
| 1955 | void EnvObject::ReceiveObjectMessageVAList(OBJECT_MSG::Type type, va_list args) { |
| 1956 | switch (type) { |
nothing calls this directly
no test coverage detected