String Regression

Reporter: RobertBColton  |  Status: closed  |  Last Modified: July 20, 2019, 07:40:12 PM

A regression with the string macro came about in e64a792 and effects Wild Racing and SONIGMA. Neither game will compile now.

From Wild Racing:

C:/Users/Owner/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:362:87: error: 'split2' was not declared in this scope
  362 |     return string(mins)+ ":"+ string(sec1)+ string(sec2)+ ":"+ string(split1)+ string(split2);
      |                                                                                       ^~~~~~
Universal_System/var4.h:266:30: note: in definition of macro 'string'
  266 | #define string(...) toString(__VA_ARGS__)
      |                              ^~~~~~~~~~~

We can see clearly from the codegen that we aren't attaching var access to the non-object version of the script.

variant _SCR_time_text(variant argument0, variant argument1, variant argument2, variant argument3, variant argument4, variant argument5, variant argument6, variant argument7, variant argument8, variant argument9, variant argument10, variant argument11, variant argument12, variant argument13, variant argument14, variant argument15)
{
  
  {
    var mins;
    mins = argument0 div 60;
    enigma::varaccess_secs(int(self))= floor(argument0 - mins * 60);
    enigma::varaccess_sec1(int(self))=(enigma::varaccess_secs(int(self))div 10)mod 10;
    enigma::varaccess_sec2(int(self))=(enigma::varaccess_secs(int(self))- enigma::varaccess_sec1(int(self))* 10)mod 10;
    enigma::varaccess_split(int(self))=(argument0 - mins * 60 - enigma::varaccess_secs(int(self)))* 100;
    enigma::varaccess_split1(int(self))=(enigma::varaccess_split(int(self))div 10)mod 10;
    enigma::varaccess_split2(int(self))= floor(enigma::varaccess_split(int(self))- enigma::varaccess_split1(int(self))* 10)mod 10;
    return string(mins)+ ":"+ string(sec1)+ string(sec2)+ ":"+ string(split1)+ string(split2);
    
  }
  ;
  
  return 0;
}

variant enigma::OBJ_obj_cam::_SCR_time_text(variant argument0)
{
  var mins;
  mins = argument0 div 60;
  secs = floor(argument0 - mins * 60);
  sec1 =(secs div 10)mod 10;
  sec2 =(secs - sec1 * 10)mod 10;
  split =(argument0 - mins * 60 - secs)* 100;
  split1 =(split div 10)mod 10;
  split2 = floor(split - split1 * 10)mod 10;
  return string(mins)+ ":"+ string(sec1)+ string(sec2)+ ":"+ string(split1)+ string(split2);
  ;
  
  return 0;
}
RobertBColton  
@JoshDreamland why do we codegen two versions of scripts!?
RobertBColton  

Closing as resolved by #1820 since SONIGMA and Wild Racing build again on master with no other additional regressions discovered.
Please sign in to post comments, or you can view this issue on GitHub.