| 34 | } |
| 35 | |
| 36 | CelData* read_celdata(std::istream& is, SubObjectsIO* subObjects, bool setId) |
| 37 | { |
| 38 | ObjectId id = read32(is); |
| 39 | int x = read32(is); |
| 40 | int y = read32(is); |
| 41 | int opacity = read8(is); |
| 42 | ObjectId imageId = read32(is); |
| 43 | UserData userData = read_user_data(is); |
| 44 | |
| 45 | ImageRef image(subObjects->getImageRef(imageId)); |
| 46 | if (!image) |
| 47 | return nullptr; |
| 48 | |
| 49 | std::unique_ptr<CelData> celdata(new CelData(image)); |
| 50 | celdata->setPosition(x, y); |
| 51 | celdata->setOpacity(opacity); |
| 52 | celdata->setUserData(userData); |
| 53 | if (setId) |
| 54 | celdata->setId(id); |
| 55 | return celdata.release(); |
| 56 | } |
| 57 | |
| 58 | } |
no test coverage detected