View Single Post
  #58  
Old June 29th, 2005, 12:29 AM
Cainehill's Avatar

Cainehill Cainehill is offline
Lieutenant General
 
Join Date: Mar 2004
Location: Albuquerque New Mexico
Posts: 2,997
Thanks: 0
Thanked 0 Times in 0 Posts
Cainehill is on a distinguished road
Default Re: Gauging interest in a Dominions Roguelike...


If you just format the text files properly, they're actually _very_ easy to parse. Either of two ways will suffice - delimitted fields, where each piece of information is separated by a rare/unused character ( for instance, the pipe symbol '|') or where each field is always a fixed width. Having done a lot of work with both, I suggest the delimitter, and an iostream extraction class that does conversion and error checking on the contents (this is vital in either case).

Either way, place the responsibility for data on the people editting it : if the formatting is wrong, bail out, preferably with an appropriate and useful error message showing the line of data, and the specific field / data that caused the error.

Otherwise, you write thousands of lines of code to compensate for user error, which is an incredible waste of programming time / effort if you aren't going to have tens of thousands of users.
__________________
Wormwood and wine, and the bitter taste of ashes.
Reply With Quote