filename is local here, eg: "strings/german/obj.str" return is either NULL for good else error message to display...
| 925 | // return is either NULL for good else error message to display... |
| 926 | // |
| 927 | const char *SE_Load( const char *psFileName, SE_BOOL bLoadDebug = SE_TRUE, SE_BOOL bFailIsCritical = SE_TRUE ) |
| 928 | { |
| 929 | //////////////////////////////////////////////////// |
| 930 | // |
| 931 | // ingame here tends to pass in names without paths, but I expect them when doing a language load, so... |
| 932 | // |
| 933 | char sTemp[1000]={0}; |
| 934 | if (!strchr(psFileName,'/')) |
| 935 | { |
| 936 | strcpy(sTemp,sSE_STRINGS_DIR); |
| 937 | strcat(sTemp,"/"); |
| 938 | if (se_language) |
| 939 | { |
| 940 | strcat(sTemp,se_language->string); |
| 941 | strcat(sTemp,"/"); |
| 942 | } |
| 943 | } |
| 944 | strcat(sTemp,psFileName); |
| 945 | COM_DefaultExtension( sTemp, sizeof(sTemp), sSE_INGAME_FILE_EXTENSION); |
| 946 | psFileName = &sTemp[0]; |
| 947 | // |
| 948 | //////////////////////////////////////////////////// |
| 949 | |
| 950 | |
| 951 | const char *psErrorMessage = SE_Load_Actual( psFileName, bLoadDebug, SE_FALSE ); |
| 952 | |
| 953 | // check for any corresponding / overriding .STE files and load them afterwards... |
| 954 | // |
| 955 | if ( !psErrorMessage ) |
| 956 | { |
| 957 | char sFileName[ iSE_MAX_FILENAME_LENGTH ]; |
| 958 | strncpy( sFileName, psFileName, sizeof(sFileName)-1 ); |
| 959 | sFileName[ sizeof(sFileName)-1 ] = '\0'; |
| 960 | char *p = strrchr( sFileName, '.' ); |
| 961 | if (p && strlen(p) == strlen(sSE_EXPORT_FILE_EXTENSION)) |
| 962 | { |
| 963 | strcpy( p, sSE_EXPORT_FILE_EXTENSION ); |
| 964 | |
| 965 | psErrorMessage = SE_Load_Actual( sFileName, bLoadDebug, SE_TRUE ); |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | if (psErrorMessage) |
| 970 | { |
| 971 | if (bFailIsCritical) |
| 972 | { |
| 973 | // TheStringPackage.Clear(TRUE); // Will we want to do this? Any errors that arise should be fixed immediately |
| 974 | Com_Error( ERR_DROP, "SE_Load(): Couldn't load \"%s\"!\n\nError: \"%s\"\n", psFileName, psErrorMessage ); |
| 975 | } |
| 976 | else |
| 977 | { |
| 978 | Com_DPrintf(S_COLOR_YELLOW "SE_Load(): Couldn't load \"%s\"!\n", psFileName ); |
| 979 | } |
| 980 | } |
| 981 | |
| 982 | return psErrorMessage; |
| 983 | } |
| 984 |
no test coverage detected