[Igarden-commit] Garden/source/SourceMaterialDB SourceMaterialFile.cpp, 1.22.2.3, 1.22.2.4
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-12-29 04:28:18
|
Update of /cvsroot/igarden/Garden/source/SourceMaterialDB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv16122 Modified Files: Tag: Release_branch_v1 SourceMaterialFile.cpp Log Message: Fix SourceMaterialFile date handling Index: SourceMaterialFile.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/SourceMaterialDB/SourceMaterialFile.cpp,v retrieving revision 1.22.2.3 retrieving revision 1.22.2.4 diff -C2 -d -r1.22.2.3 -r1.22.2.4 *** SourceMaterialFile.cpp 19 Dec 2006 12:52:23 -0000 1.22.2.3 --- SourceMaterialFile.cpp 29 Dec 2006 04:28:17 -0000 1.22.2.4 *************** *** 69,78 **** FSRef ref; FSCatalogInfo info; ! DateTimeRec dtr; FSpMakeFSRef(&macSpec, &ref); FSGetCatalogInfo(&ref, kFSCatInfoContentMod, &info, NULL, NULL, NULL); ! SecondsToDate (info.contentModDate.lowSeconds, &dtr); ! _fileModDate.SetYMD(dtr.year, dtr.month, dtr.day); #else #error TO_BE_PORTED --- 69,84 ---- FSRef ref; FSCatalogInfo info; ! LongDateRec dtr; ! LocalDateTime localDateTime; ! LongDateCvt dateTime; FSpMakeFSRef(&macSpec, &ref); FSGetCatalogInfo(&ref, kFSCatInfoContentMod, &info, NULL, NULL, NULL); ! ::ConvertUTCToLocalDateTime(&info.contentModDate, &localDateTime); ! ! dateTime.hl.lHigh = localDateTime.highSeconds; ! dateTime.hl.lLow = localDateTime.lowSeconds; ! LongSecondsToDate (&dateTime.c, &dtr); ! _fileModDate = dtr; #else #error TO_BE_PORTED *************** *** 589,593 **** --- 595,601 ---- if(mat != NULL) { + refFound = mat->GetLatestDatedReference(kFieldSuppliers, date); + if(!refFound || date.GetDouble() < xmlModDate.GetDouble()) { *************** *** 597,605 **** xmlModDate.LongDateStr(shortDate, fileDateStr); date.LongDateStr(shortDate, objDateStr); ! ! printf("Material '%s' File is %s object is %s\n", ! mat->GetDisplayName(kUsePreferencesSetting).c_str(), ! fileDateStr.c_str(), (refFound ? objDateStr.c_str() : "<not found>")); #endif if(mat->GetSpeciesObj()->NumItems(kFlowerColor) == 1) { --- 605,615 ---- xmlModDate.LongDateStr(shortDate, fileDateStr); date.LongDateStr(shortDate, objDateStr); ! ! printf("Material '%s' File is %s %d:%d:%d object is %s %d:%d:%d\n", ! mat->GetDisplayName(kUsePreferencesSetting).c_str(), ! fileDateStr.c_str(), xmlModDate.hour(), xmlModDate.minute(), xmlModDate.second(), ! (refFound ? objDateStr.c_str() : "<not found>"), date.hour(), date.minute(), date.second()); #endif + if(mat->GetSpeciesObj()->NumItems(kFlowerColor) == 1) { *************** *** 662,665 **** --- 672,676 ---- mat->SetLastModified(uid, lastModDate); } + } *************** *** 691,696 **** if(variant != NULL) { ! variant->GetLatestDatedReference(kFieldSuppliers, date); ! if(date.GetDouble() < xmlModDate.GetDouble()) { #if TEST_LOAD_BEHAVIOR --- 702,709 ---- if(variant != NULL) { ! refFound = variant->GetLatestDatedReference(kFieldSuppliers, date); ! if(!refFound) ! refFound = mat->GetLatestDatedReference(kFieldSuppliers, date); ! if(!refFound || date.GetDouble() < xmlModDate.GetDouble()) { #if TEST_LOAD_BEHAVIOR *************** *** 714,718 **** { #if TEST_LOAD_BEHAVIOR ! printf("Have valid material, skipping\n"); #endif done = true; --- 727,731 ---- { #if TEST_LOAD_BEHAVIOR ! printf("Have valid variety, skipping\n"); #endif done = true; *************** *** 726,730 **** --- 739,762 ---- variant = new Variant(this, uid); variant->ParseXML(sub3, context); + mat->AddVariant(variant); + } + + + if(((mat->GetMaterialType() & kMajorMaterialType) == kMaterialTypePlant) && mat->isEmpty(kPlantSpread)) + { + UInt32 i, count; + Variant *var; + + count = mat->NumVariants(); + for(i = 0; i < count; i++) + { + var = mat->GetIndexedVariant(i); + if(var->isEmpty(kPlantSpread)) + printf("Missing spread on '%s' (ld)\n", mat->GetDisplayName(kPreferBoth).c_str(), i); + } + if(count == 0) + printf("Missing spread on '%s'\n", mat->GetDisplayName(kPreferBoth).c_str()); } + sub3 = sub3->GetSibling(); } |