simplification to rdwr-functions June 29, 2010, 05:52:28 pm A rather simple patch that removes the second argument from most of the rdwr-methods in the load_save-cl****. The char-array provided was not used at all (I guess some syntax from the past).Additionally I have split up the load_save-methods into save- and load-methods, because I thought that it is easier to understand something like===================================save_byte(){ if (xml) write_to_file_as_xml else write_to_file_as_binary}load_byte(){ if (xml) read_from_file_as_xml else read_from_file_as_binary}rdwr_byte(){ if(saving) save_byte; else load_byte;}=================================================instead of=================================================rdwr_byte(){ if (xml) { if(saving) write_to_file_as_xml else read_from_file_as_xml } else { if (saving) write_to_file_as_binary else read_from_file_as_binary }}=================The improvement by last change is of course arguable. Just a suggestion, and I could well accept if you were not interested.Klaus Quote Selected
Re: simplification to rdwr-functions Reply #1 – June 29, 2010, 07:03:41 pm The rdwr function have the advantage, that for most stuff nothing needs to take care if it is saved or loaded. The idea is, that the reading and loading is done at the same place in the same order. Using the same function is a good way to avoid errors.The superflous second parameter stems from the very old text/binary savegame format, which was broken anyway since several versions. This should indeed go. Quote Selected
Re: simplification to rdwr-functions Reply #2 – June 29, 2010, 09:30:38 pm I don't mean necessarily to remove the rdrw-functions, if you want you could even declare the new methods private, and just use them internally in the loadsave-cl****. Within this file, I certainly believe that they increase readability, but up to you...Klaus Quote Selected
Re: simplification to rdwr-functions Reply #3 – July 03, 2010, 09:17:23 am ok, here is a new version of the patch, where I did not split up the rdwr_methods in loadsagegame.cc, but I only removed the last argument of all of these methods.Klaus Quote Selected
Re: simplification to rdwr-functions Reply #4 – July 27, 2010, 02:43:40 pm thank you. incorporated in 3560. Quote Selected