--- deliantra/server/common/map.C 2006/08/31 17:54:14 1.18 +++ deliantra/server/common/map.C 2006/09/03 22:45:55 1.21 @@ -1,6 +1,6 @@ /* * static char *rcsid_map_c = - * "$Id: map.C,v 1.18 2006/08/31 17:54:14 root Exp $"; + * "$Id: map.C,v 1.21 2006/09/03 22:45:55 root Exp $"; */ /* @@ -484,14 +484,8 @@ op->head = tmp; op->map = m; last->more = op; - if (tmp->name != op->name) { - if (op->name) free_string(op->name); - op->name = add_string(tmp->name); - } - if (tmp->title != op->title) { - if (op->title) free_string(op->title); - op->title = add_string(tmp->title); - } + op->name = tmp->name; + op->title = tmp->title; /* we could link all the parts onto tmp, and then just * call insert_ob_in_map once, but the effect is the same, * as insert_ob_in_map will call itself with each part, and @@ -511,20 +505,14 @@ */ void load_objects (mapstruct *m, object_thawer &fp, int mapflags) { - int i,j,bufstate=LO_NEWFILE; + int i,j; int unique; object *op, *prev=NULL,*last_more=NULL, *otmp; op=get_object(); op->map = m; /* To handle buttons correctly */ - while((i = load_object (fp, op, bufstate, mapflags))) { - /* Since the loading of the map header does not load an object - * anymore, we need to pass LO_NEWFILE for the first object loaded, - * and then switch to LO_REPEAT for faster loading. - */ - bufstate = LO_REPEAT; - + while((i = load_object (fp, op, mapflags))) { /* if the archetype for the object is null, means that we * got an invalid object. Don't do anything with it - the game * or editor will not be able to do anything with it either. @@ -620,12 +608,9 @@ */ mapstruct *get_linked_map(void) { - mapstruct *map=(mapstruct *) calloc(1,sizeof(mapstruct)); + mapstruct *map = new mapstruct; mapstruct *mp; - if(map==NULL) - fatal(OUT_OF_MEMORY); - for(mp=first_map;mp!=NULL&&mp->next!=NULL;mp=mp->next); if(mp==NULL) first_map=map; @@ -890,7 +875,7 @@ else if (!strcmp(key,"oid")) { fp.get (m, atoi(value)); } else if (!strcmp(key, "attach")) { - m->attach = add_string (value); + m->attach = value; } else if (!strcmp(key,"hp") || !strcmp(key, "enter_x")) { m->enter_x = atoi(value); } else if (!strcmp(key,"sp") || !strcmp(key, "enter_y")) { @@ -1181,7 +1166,6 @@ m->in_memory=MAP_LOADING; if (m->tmpname == NULL) /* if we have loaded unique items from */ delete_unique_items(m); /* original map before, don't duplicate them */ - load_object(thawer, NULL, LO_NOREAD,0); load_objects (m, thawer, 0); m->in_memory=MAP_IN_MEMORY; @@ -1395,18 +1379,6 @@ free_object(op); } } -#ifdef MANY_CORES - /* I see periodic cores on metalforge where a map has been swapped out, but apparantly - * an item on that map was not saved - look for that condition and die as appropriate - - * this leaves more of the map data intact for better debugging. - */ - for (op=objects; op!=NULL; op=op->next) { - if (!QUERY_FLAG(op, FLAG_REMOVED) && op->map == m) { - LOG(llevDebug,"free_all_objects: object %s still on map after it should have been freed\n", op->name); - abort(); - } - } -#endif } /* @@ -1496,7 +1468,7 @@ else last->next = m->next; - free (m); + delete m; } @@ -1549,8 +1521,13 @@ else LOG(llevDebug, "Trying to load map %s.\n", create_pathname(name)); + //0.427459955215454 /var/crossfire/players/Saladon/_scorn_apartment_apartments + //0.414906024932861 + //0.427063941955566 + eval_pv ("$x = Event::time", 1);//D if (!(m = load_original_map(name, (flags & MAP_PLAYER_UNIQUE)))) return (NULL); + eval_pv ("warn \"LOAD \", Event::time - $x", 1);//D fix_auto_apply(m); /* Chests which open as default */