Welcome to the Builder Academy

Question World "Re-Factoring"

More
11 Aug 2012 03:25 #635 by Vatiken
Replied by Vatiken on topic Re: World "Re-Factoring"
Zones to keep:
0, 1, 2, 3, 12

Core Changes:
The easiest way of going about massive changes to the world files is to do a back-up of your world, and then have them altered upon loading. There are many examples in the loading of mobiles and objects where a conversion has taken place.
Code:
if (((retval = sscanf(line, "%s %s %s %s %s %s %s %s %d %c", f1, f2, f3, f4, f5, f6, f7, f8, t + 2, &letter)) != 10) && (bitwarning == TRUE)) { /* Let's make the implementor read some, before converting his world files. */ log("WARNING: Conventional mobile files detected. See config.c."); exit(1); } else if ((retval == 4) && (bitwarning == FALSE)) { log("Converting mobile #%d to 128bits..", nr); MOB_FLAGS(mob_proto + i)[0] = asciiflag_conv(f1); MOB_FLAGS(mob_proto + i)[1] = 0; MOB_FLAGS(mob_proto + i)[2] = 0; MOB_FLAGS(mob_proto + i)[3] = 0; check_bitvector_names(MOB_FLAGS(mob_proto + i)[0], action_bits_count, buf2, "mobile"); AFF_FLAGS(mob_proto + i)[0] = asciiflag_conv_aff(f2); AFF_FLAGS(mob_proto + i)[1] = 0; AFF_FLAGS(mob_proto + i)[2] = 0; AFF_FLAGS(mob_proto + i)[3] = 0; GET_ALIGNMENT(mob_proto + i) = atoi(f3); /* Make some basic checks. */ REMOVE_BIT_AR(AFF_FLAGS(mob_proto + i), AFF_CHARM); REMOVE_BIT_AR(AFF_FLAGS(mob_proto + i), AFF_POISON); REMOVE_BIT_AR(AFF_FLAGS(mob_proto + i), AFF_GROUP); REMOVE_BIT_AR(AFF_FLAGS(mob_proto + i), AFF_SLEEP); if (MOB_FLAGGED(mob_proto + i, MOB_AGGRESSIVE) && MOB_FLAGGED(mob_proto + i, MOB_AGGR_GOOD)) REMOVE_BIT_AR(MOB_FLAGS(mob_proto + i), MOB_AGGR_GOOD); if (MOB_FLAGGED(mob_proto + i, MOB_AGGRESSIVE) && MOB_FLAGGED(mob_proto + i, MOB_AGGR_NEUTRAL)) REMOVE_BIT_AR(MOB_FLAGS(mob_proto + i), MOB_AGGR_NEUTRAL); if (MOB_FLAGGED(mob_proto + i, MOB_AGGRESSIVE) && MOB_FLAGGED(mob_proto + i, MOB_AGGR_EVIL)) REMOVE_BIT_AR(MOB_FLAGS(mob_proto + i), MOB_AGGR_EVIL); check_bitvector_names(AFF_FLAGS(mob_proto + i)[0], affected_bits_count, buf2, "mobile affect"); /* This is necessary, since if we have conventional world files, &letter is * loaded into f4 instead of the letter characters. So what we do, is copy * f4 into letter. Disadvantage is that &letter cannot be longer then 128 * characters, but this shouldn't occur anyway. */ letter = *f4; if(bitsavetodisk) { add_to_save_list(zone_table[real_zone_by_thing(nr)].number, 0); converting =TRUE; } log(" done.");
If I were for example doubling stats on mobiles, I would just put a x2 on everything after loading the mobile and then add the mob zone data to the save list.

On another note, I took a look into the loading code and it wouldn't be too much hassle to add VERSION # following the vnum of a mob/obj/room etc.. This might make upgrading/changing mobs/obj/etc a little easier for developers.

Example:
Code:
.. parse mobile code if (version != CURRENT_MOB_VERSION) { int former_version = version; switch (version) { case 1: version = upgrade_to_version_2(mob); case 2: version = upgrade_to_version_3(mob); case 3: version = upgrade_to_version_4(mob); break; } mudlog(CMP, TRUE, LVL_GOD, "Upgraded vnum %d from version %d to version %d.", vnum, former_version, version); }

tbaMUD developer/programmer
The following user(s) said Thank You: bakarus, zusuk

Please Log in or Create an account to join the conversation.

More
11 Aug 2012 18:00 #645 by zusuk
Replied by zusuk on topic Re: World "Re-Factoring"
That would load the mobs with the correct adjustments, but I would have to force a save somehow then remove that code before the next load?

Would it be better to do the opposite, and instead of loading it with the adjustments, save it with the adjustments?

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

More
11 Aug 2012 23:40 #648 by Vatiken
Replied by Vatiken on topic Re: World "Re-Factoring"
By adding the corrected zone to the save table you'll be able to do a mass save with "saveall", then just remove the "convert()" function, compile, copyover/reboot and done. There are other ways to go about it, but after writing the initial convert() function, it takes all of 2 minutes to change the files.

Just remember to back-up in case you mess something up.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

Time to create page: 0.201 seconds