mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
- bugfix: Average column in laptop->profiles was not correct calculated
- feature: Moved Auto save to option screen - feature: German.Items.xml can now use "Umlaute". It is now correct displayed in the game git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@592 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+64
-64
@@ -29,72 +29,72 @@ BOOLEAN PerformTimeLimitedCheck();
|
||||
* Modified this routine to eliminate recursion and to avoid infinite
|
||||
* expansion of string when newpiece contains oldpiece. --Byron
|
||||
*/
|
||||
char *Replace(char *string, char *oldpiece, char *newpiece) {
|
||||
|
||||
int str_index, newstr_index, oldpiece_index, end,
|
||||
|
||||
new_len, old_len, cpy_len;
|
||||
char *c;
|
||||
static char newstring[MAXLINE];
|
||||
|
||||
if ((c = (char *) strstr(string, oldpiece)) == NULL)
|
||||
|
||||
return string;
|
||||
|
||||
new_len = strlen(newpiece);
|
||||
old_len = strlen(oldpiece);
|
||||
end = strlen(string) - old_len;
|
||||
oldpiece_index = c - string;
|
||||
|
||||
|
||||
newstr_index = 0;
|
||||
str_index = 0;
|
||||
while(str_index <= end && c != NULL)
|
||||
{
|
||||
|
||||
/* Copy characters from the left of matched pattern occurence */
|
||||
cpy_len = oldpiece_index-str_index;
|
||||
strncpy(newstring+newstr_index, string+str_index, cpy_len);
|
||||
newstr_index += cpy_len;
|
||||
str_index += cpy_len;
|
||||
|
||||
/* Copy replacement characters instead of matched pattern */
|
||||
strcpy(newstring+newstr_index, newpiece);
|
||||
newstr_index += new_len;
|
||||
str_index += old_len;
|
||||
|
||||
/* Check for another pattern match */
|
||||
if((c = (char *) strstr(string+str_index, oldpiece)) != NULL)
|
||||
oldpiece_index = c - string;
|
||||
|
||||
|
||||
}
|
||||
/* Copy remaining characters from the right of last matched pattern */
|
||||
strcpy(newstring+newstr_index, string+str_index);
|
||||
|
||||
return newstring;
|
||||
}
|
||||
//char *Replace(char *string, char *oldpiece, char *newpiece)
|
||||
//{
|
||||
// int str_index, newstr_index, oldpiece_index, end,
|
||||
//
|
||||
// new_len, old_len, cpy_len;
|
||||
// char *c;
|
||||
// static char newstring[MAXLINE];
|
||||
//
|
||||
// if ((c = (char *) strstr(string, oldpiece)) == NULL)
|
||||
//
|
||||
// return string;
|
||||
//
|
||||
// new_len = strlen(newpiece);
|
||||
// old_len = strlen(oldpiece);
|
||||
// end = strlen(string) - old_len;
|
||||
// oldpiece_index = c - string;
|
||||
//
|
||||
//
|
||||
// newstr_index = 0;
|
||||
// str_index = 0;
|
||||
// while(str_index <= end && c != NULL)
|
||||
// {
|
||||
//
|
||||
// //Copy characters from the left of matched pattern occurence
|
||||
// cpy_len = oldpiece_index-str_index;
|
||||
// strncpy(newstring+newstr_index, string+str_index, cpy_len);
|
||||
// newstr_index += cpy_len;
|
||||
// str_index += cpy_len;
|
||||
//
|
||||
// //Copy replacement characters instead of matched pattern
|
||||
// strcpy(newstring+newstr_index, newpiece);
|
||||
// newstr_index += new_len;
|
||||
// str_index += old_len;
|
||||
//
|
||||
// //Check for another pattern match
|
||||
// if((c = (char *) strstr(string+str_index, oldpiece)) != NULL)
|
||||
// oldpiece_index = c - string;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// // Copy remaining characters from the right of last matched pattern
|
||||
// strcpy(newstring+newstr_index, string+str_index);
|
||||
//
|
||||
// return newstring;
|
||||
//}
|
||||
|
||||
// WANNE: Replaces german specific characters
|
||||
char *ReplaceGermanSpecialCharacters(char *text)
|
||||
{
|
||||
// ä
|
||||
text = Replace(text, "ä", "ä");
|
||||
// Ä
|
||||
text = Replace(text, "Ä", "Ä");
|
||||
// ö
|
||||
text = Replace(text, "ö", "ö");
|
||||
// Ö
|
||||
text = Replace(text, "Ö", "Ö");
|
||||
// ü
|
||||
text = Replace(text, "ü", "ü");
|
||||
// Ü
|
||||
text = Replace(text, "Ü", "Ü");
|
||||
// ß
|
||||
text = Replace(text, "ß", "ß");
|
||||
|
||||
return text;
|
||||
}
|
||||
//char *ReplaceGermanSpecialCharacters(char *text)
|
||||
//{
|
||||
// // ä
|
||||
// text = Replace(text, "ä", "ä");
|
||||
// // Ä
|
||||
// text = Replace(text, "Ä", "Ä");
|
||||
// // ö
|
||||
// text = Replace(text, "ö", "ö");
|
||||
// // Ö
|
||||
// text = Replace(text, "Ö", "Ö");
|
||||
// // ü
|
||||
// text = Replace(text, "ü", "ü");
|
||||
// // Ü
|
||||
// text = Replace(text, "Ü", "Ü");
|
||||
// // ß
|
||||
// text = Replace(text, "ß", "ß");
|
||||
//
|
||||
// return text;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user