X-Git-Url: http://git.draconx.ca/gitweb/upkg.git/blobdiff_plain/6df203a00536662101ec4a4275ec84baa7527d79..45969066e2f26f8b28787560c0b70d1c119982d7:/src/engine/palette.gob diff --git a/src/engine/palette.gob b/src/engine/palette.gob index 4c15c71..79712a6 100644 --- a/src/engine/palette.gob +++ b/src/engine/palette.gob @@ -1,23 +1,27 @@ %alltop{ /* - * upkg: tool for manipulating Unreal Tournament packages. - * Copyright © 2011 Nick Bowler + * upkg: tool for manipulating Unreal Tournament packages. + * Copyright © 2011, 2020, 2022 Nick Bowler * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ %} +%ctop{ +#include +%} + %{ #include #include @@ -33,7 +37,7 @@ typedef unsigned char engine_palette_rgba[4]; class Engine:Palette from U:Object (dynamic) { public unsigned entries = 0; - public engine_palette_rgba *rgba = NULL; + public engine_palette_rgba *rgba = NULL destroywith free; override (U:Object) int deserialize(U:Object *uo) { @@ -51,7 +55,8 @@ class Engine:Palette from U:Object (dynamic) return -1; self->entries = entries; - upkg_export_seek(f, rc, SEEK_SET); + if (upkg_export_seek(f, rc, SEEK_SET) != 0) + return -1; buflen = entries * sizeof self->rgba[0]; self->rgba = malloc(buflen); if (!self->rgba) @@ -63,7 +68,6 @@ class Engine:Palette from U:Object (dynamic) return -1; } - printf("palette: %u entries\n", self->entries); return 0; } }