--- deliantra/server/common/material.C 2009/11/10 16:02:06 1.6 +++ deliantra/server/common/material.C 2010/04/28 19:49:50 1.13 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -112,7 +112,7 @@ if (!op->is_armor ()) return; - if (op->material == &material_null) + if (op->material == MATERIAL_NULL) return; if (op->material != change->material) @@ -134,7 +134,7 @@ void select_material (object *op, int difficulty) { - if (op->material != &material_null || !op->materials) + if (op->material != MATERIAL_NULL || !op->materials) return; materialtype_t *lmt = 0; @@ -192,21 +192,17 @@ //-GPL void -load_materials (void) +load_materials () { - char filename[MAX_BUF]; - - sprintf (filename, "%s/materials", settings.datadir); - LOG (llevDebug, "Reading material type data from %s...\n", filename); - //TODO: somehow free old materials, or update them in-place + // currently we effectively leak them. material_null.next = 0; materialt = &material_null; - object_thawer thawer (filename); + object_thawer thawer (settings.datadir, "materials"); if (!thawer) { - LOG (llevError, "Cannot open %s for reading\n", filename); + LOG (llevError, "Cannot open %s for reading\n", thawer.name); goto done; } @@ -299,7 +295,7 @@ goto done; default: - if (!thawer.parse_error ("materials file", "materials")) + if (!thawer.parse_error ("materials file")) goto done; break; }