On Tue, 2 Dec 1997, Erwin S. Andreasen wrote: >> Even better than versioning is to just tack values onto the end of the >> line. Then have the server check how many arguments it actually read >> (sscanf). If it didn't get all of them, just fill in a default. > >No, possibly in THIS case where the original poster wanted to add one >number, but definitely not generally. No, not generally, but in the case of simple expansion it is the best. >You can't add non-integer values doing that, like strings, words. You >can't remove values, say you have a format that looks like: You can add non-integer without a whole lot of work. Read the line, test if the first character is a number otherwise parse a string. You can get fancier to make sure you don't get them mixed up on accident but that's the basic concept. >useless-integer useless-integer 4 useless-integer > >which you want to be > >4 > >MERC area files are like that; lots of useless stuff from Diku if (sscanf("%d %d %d %d\n", &a, &b, &c, &d) != 4)) { c = a; b = a = d = 0; } You still have the value you wanted in 'c'. >Plus, versioning can be used not only to change area file format, but to >modify all existing mobs - say you want to change from a 1-40 to 1-100 >level MUD and want to adjust all mobs but only once (nothing I would ever >really recommend doing, but I couldn't find a better example). Modifying mobs is one thing you can't do this way. (Unless you test for how many values you read on a line and set a flag that then says to do conversion.) -- George Greer - Me@Null.net | Genius may have its limitations, but stupidity http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST