hedgewars/uSound.pas
changeset 14938 873dda2325c1
parent 14936 ba5fd934f49b
child 14945 8b848c2939da
equal deleted inserted replaced
14937:ff4003a90ff8 14938:873dda2325c1
   334             );
   334             );
   335 
   335 
   336 
   336 
   337 function  AskForVoicepack(name: shortstring): Pointer;
   337 function  AskForVoicepack(name: shortstring): Pointer;
   338 var i: Longword;
   338 var i: Longword;
   339     tmp, langName, path: shortstring;
   339     tmp, nameStart, langName, path: shortstring;
   340 begin
   340 begin
       
   341     nameStart:= name;
   341     i:= 0;
   342     i:= 0;
   342 
   343 
   343     { Adjust for language suffix: Voicepacks can have an optional language suffix.
   344     { Adjust for language suffix: Voicepacks can have an optional language suffix.
   344     It's an underscore followed by an ISO 639-1 or ISO 639-2 language code.
   345     It's an underscore followed by an ISO 639-1 or ISO 639-2 language code.
   345     The suffix “_qau” is special, it will enable automatic language selection
   346     The suffix “_qau” is special, it will enable automatic language selection
   366                 end
   367                 end
   367         end;
   368         end;
   368 
   369 
   369     path:= cPathz[ptVoices] + '/' + name;
   370     path:= cPathz[ptVoices] + '/' + name;
   370 
   371 
   371     // Fallback to Default if voicepack can't be found at all
   372     // Fallback to localized Default if voicepack can't be found at all
   372     if (name <> 'Default') and (not pfsExists(path)) then
   373     if (nameStart <> 'Default_qau') and (not pfsExists(path)) then
   373         begin
   374         exit(AskForVoicepack('Default_qau'));
   374         path:= cPathz[ptVoices] + '/Default';
       
   375         if pfsExists(path) then
       
   376             exit(AskForVoicepack('Default'));
       
   377         end;
       
   378 
   375 
   379     while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') and (i < cMaxTeams) do
   376     while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') and (i < cMaxTeams) do
   380         begin
   377         begin
   381         inc(i);
   378         inc(i);
   382         //TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true)
   379         //TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true)