Jump to content

Ideas for cross-platform modding code simplification


cmorgan

Recommended Posts

Original question from Miloch:

Is it just me or does it seem exceedingly primitive to maintain 2-3 separate sections of code just based on minor platform differences? For example, a lot of the differences in my file between Tutu and BGT just have to do with the underscore being present on some files in Tutu, but it ends up being a 6000+ line TP2 instead of a 2000-line file or less. I'd be great if WeiDU could simply choose the correct filename based on platform, possibly from an external file where those names are listed, and perhaps just refer to variables in the TP2. Or just concatenate the filename by inserting a '_' at the beginning in the case of Tutu. Or something just a little more efficient - every time I tweak one parameter I have to grep for it in three different sections of the code.

 

Well in the meantime, if we're reduced to this kind of language, I looked up some area files that are more or less unique to the installations (as far as I can tell):

ACTION_IF FILE_EXISTS_IN_GAME
~FW0100.ARE~ THEN BEGIN //Tutu
 ~FW2003.ARE~ THEN BEGIN //Tutu+TotSC
~AR7200.ARE~ THEN BEGIN //BGT
~AR0100.ARE~ THEN BEGIN //BG1
 ~AR2003.ARE~ THEN BEGIN //BG1+TotSC
~AR0083.ARE~ THEN BEGIN //BG2-SoA
 ~AR6200.ARE~ THEN BEGIN //BG2-ToB
ELSE BEGIN //Error (BG not present)

The only exception is the BG2 areas are probably also present in BGT and Tutu, but by the time you've gotten that far, you've already ruled out those options (assuming your mod is compatible with that many platforms). The problem with cmorgan's example (FW1500.ARE) is that, although it is unique to Tutu-TotSC, its equivalent in BG1 is not (there is a separate AR1500.ARE in BG2/BGT). And I haven't yet coded an 'anti-idiot message' (ELSE BEGIN //Error) if someone tries to install on the wrong platform, but I guess it'd be a good idea.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...