--- deliantra/server/common/loader.C 2007/01/15 21:06:18 1.46 +++ deliantra/server/common/loader.C 2007/01/19 17:54:15 1.49 @@ -31,6 +31,49 @@ #include #include +// future resource loader base class +struct loader_base +{ + virtual archetype *get_arch (const char *name); + virtual void put_arch (archetype *arch); + + virtual object *get_object (const char *name); + virtual void put_object (object *op); + + virtual player *get_player (); + virtual void put_player (player *pl); + + virtual region *get_region (); + virtual void put_region (region *region); + + virtual facetile *get_face (const char *name); + virtual void put_face (facetile *face); + + virtual treasurelist *get_treasure (const char *name, bool one = false); + virtual void put_treasure (treasurelist *treasure); + + virtual animation *get_animation (const char *name); + virtual void put_animation (animation *anim); +}; + +// future generic resource loader +// handles generic stuff valid in most files, such as +// animations, treasures, faces and so on +struct loader_generic : loader_base +{ + virtual region *get_region (); + virtual void put_region (region *region); + + virtual facetile *get_face (const char *name); + virtual void put_face (facetile *face); + + virtual treasurelist *get_treasure (const char *name, bool one = false); + virtual void put_treasure (treasurelist *treasure); + + virtual animation *get_animation (const char *name); + virtual void put_animation (animation *anim); +}; + /* Maps the MOVE_* values to names */ static const char *const move_name[] = { "walk", "fly_low", "fly_high", "swim", "boat", NULL }; @@ -376,7 +419,10 @@ if (QUERY_FLAG (op, FLAG_MONSTER)) { if (op->stats.hp > op->stats.maxhp) - LOG (llevDebug, "Monster %s has hp set higher than maxhp (%d>%d)\n", op->debug_desc (), op->stats.hp, op->stats.maxhp); + { + LOG (llevDebug, "Monster %s has hp set higher than maxhp (%d>%d)\n", op->debug_desc (), op->stats.hp, op->stats.maxhp); + op->stats.maxhp = op->stats.hp; + } /* The archs just need to be updated for this */ if (op->move_type == 0) @@ -650,7 +696,7 @@ //TODO: maybe do in check_object // removed check for style maps if (op->speed < 0) - op->speed_left = op->speed_left - RANDOM () % 100 / 100.0; + op->speed_left = op->speed_left - rndm (); break;