@@ -405,7 +405,12 @@ void MapCache::writeCacheINI( Bool userDir )
405405 fprintf (fp, " extentMin = X:%2.2f Y:%2.2f Z:%2.2f\n " , md.m_extent .lo .x , md.m_extent .lo .y , md.m_extent .lo .z );
406406 fprintf (fp, " extentMax = X:%2.2f Y:%2.2f Z:%2.2f\n " , md.m_extent .hi .x , md.m_extent .hi .y , md.m_extent .hi .z );
407407
408+ // BAD AND NOW UNUSED: the mapcache.ini should not contain localized data... using the lookup tag instead
409+ #if RTS_GENERALS
408410 fprintf (fp, " displayName = %s\n " , UnicodeStringToQuotedPrintable (md.m_displayName ).str ());
411+ #else
412+ fprintf (fp, " nameLookupTag = %s\n " , md.m_nameLookupTag .str ());
413+ #endif
409414
410415 Coord3D pos;
411416 WaypointMap::iterator itw = md.m_waypoints .begin ();
@@ -645,6 +650,31 @@ Bool MapCache::addMap( AsciiString dirName, AsciiString fname, FileInfo *fileInf
645650 if ((md.m_filesize == filesize) &&
646651 (md.m_CRC != 0 ))
647652 {
653+ // Force a lookup so that we don't display the English localization in all builds.
654+ if (md.m_nameLookupTag .isEmpty ())
655+ {
656+ // unofficial maps or maps without names
657+ AsciiString tempdisplayname;
658+ tempdisplayname = fname.reverseFind (' \\ ' ) + 1 ;
659+ (*this )[lowerFname].m_displayName .translate (tempdisplayname);
660+ if (md.m_numPlayers >= 2 )
661+ {
662+ UnicodeString extension;
663+ extension.format (L" (%d)" , md.m_numPlayers );
664+ (*this )[lowerFname].m_displayName .concat (extension);
665+ }
666+ }
667+ else
668+ {
669+ // official maps with name tags
670+ (*this )[lowerFname].m_displayName = TheGameText->fetch (md.m_nameLookupTag );
671+ if (md.m_numPlayers >= 2 )
672+ {
673+ UnicodeString extension;
674+ extension.format (L" (%d)" , md.m_numPlayers );
675+ (*this )[lowerFname].m_displayName .concat (extension);
676+ }
677+ }
648678// DEBUG_LOG(("MapCache::addMap - found match for map %s", lowerFname.str()));
649679 return FALSE ; // OK, it checks out.
650680 }
@@ -676,6 +706,7 @@ Bool MapCache::addMap( AsciiString dirName, AsciiString fname, FileInfo *fileInf
676706
677707 Bool exists = false ;
678708 AsciiString munkee = worldDict.getAsciiString (TheKey_mapName, &exists);
709+ md.m_nameLookupTag = munkee;
679710 if (!exists || munkee.isEmpty ())
680711 {
681712 DEBUG_LOG ((" Missing TheKey_mapName!" ));
@@ -766,13 +797,15 @@ Int populateMapListboxNoReset( GameWindow *listbox, Bool useSystemMaps, Bool isM
766797 const Image *easyImage = NULL ;
767798 const Image *mediumImage = NULL ;
768799 const Image *brutalImage = NULL ;
800+ const Image *maxBrutalImage = NULL ;
769801 SkirmishBattleHonors *battleHonors = NULL ;
770802 Int w = 10 , h = 10 ;
771803 if (numColumns > 1 )
772804 {
773805 easyImage = TheMappedImageCollection->findImageByName (" Star-Bronze" );
774806 mediumImage = TheMappedImageCollection->findImageByName (" Star-Silver" );
775807 brutalImage = TheMappedImageCollection->findImageByName (" Star-Gold" );
808+ maxBrutalImage = TheMappedImageCollection->findImageByName (" RedYell_Star" );
776809 battleHonors = new SkirmishBattleHonors;
777810
778811 w = (brutalImage)?brutalImage->getImageWidth ():10 ;
@@ -843,6 +876,16 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter;
843876 }
844877 */
845878
879+ #if RTS_ZEROHOUR
880+ // Patch 1.03 -- Purposely filter out these broken maps that exist in Generals.
881+ if ( !asciiMapName.compare ( " maps\\ armored fury\\ armored fury.map" ) ||
882+ !asciiMapName.compare ( " maps\\ scorched earth\\ scorched earth.map" ) )
883+ {
884+ ++tempit;
885+ continue ;
886+ }
887+ #endif
888+
846889 DEBUG_ASSERTCRASH (it != TheMapCache->end (), (" Map %s not found in map cache." , tempit->str ()));
847890 if (it->first .startsWithNoCase (mapDir.str ()) && isMultiplayer == it->second .m_isMultiplayer && !it->second .m_displayName .isEmpty ())
848891 {
@@ -857,8 +900,17 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter;
857900 Int numBrutal = battleHonors->getEnduranceMedal (it->first .str (), SLOT_BRUTAL_AI);
858901 if (numBrutal)
859902 {
860- imageItemData = 3 ;
861- index = GadgetListBoxAddEntryImage ( listbox, brutalImage, index, 0 , w, h, TRUE );
903+ int maxBrutalSlots = it->second .m_numPlayers - 1 ;
904+ if (maxBrutalImage != NULL && numBrutal == maxBrutalSlots)
905+ {
906+ index = GadgetListBoxAddEntryImage ( listbox, maxBrutalImage, index, 0 , w, h, TRUE );
907+ imageItemData = 4 ;
908+ }
909+ else
910+ {
911+ index = GadgetListBoxAddEntryImage ( listbox, brutalImage, index, 0 , w, h, TRUE );
912+ imageItemData = 3 ;
913+ }
862914 }
863915 else if (numMedium)
864916 {
@@ -984,6 +1036,39 @@ AsciiString getDefaultMap( Bool isMultiplayer )
9841036 return AsciiString::TheEmptyString;
9851037}
9861038
1039+
1040+ AsciiString getDefaultOfficialMap ()
1041+ {
1042+ if (!TheMapCache)
1043+ return AsciiString::TheEmptyString;
1044+ TheMapCache->updateCache ();
1045+
1046+ MapCache::iterator it = TheMapCache->begin ();
1047+ while (it != TheMapCache->end ())
1048+ {
1049+ if (it->second .m_isMultiplayer && it->second .m_isOfficial )
1050+ {
1051+ return it->first ;
1052+ }
1053+ ++it;
1054+ }
1055+ return AsciiString::TheEmptyString;
1056+ }
1057+
1058+
1059+ Bool isOfficialMap ( AsciiString mapName )
1060+ {
1061+ if (!TheMapCache || mapName.isEmpty ())
1062+ return FALSE ;
1063+ TheMapCache->updateCache ();
1064+ mapName.toLower ();
1065+ MapCache::iterator it = TheMapCache->find (mapName);
1066+ if (it != TheMapCache->end ())
1067+ return it->second .m_isOfficial ;
1068+ return FALSE ;
1069+ }
1070+
1071+
9871072const MapMetaData *MapCache::findMap (AsciiString mapName)
9881073{
9891074 mapName.toLower ();
0 commit comments