Browse Source

Added image for unrecognized items

Nick Loose 13 years ago
parent
commit
b7a628d6fa
3 changed files with 15 additions and 3 deletions
  1. 11 3
      Classes/IJInventoryItem.m
  2. BIN
      Images/blockNotFound.png
  3. 4 0
      InsideJob.xcodeproj/project.pbxproj

+ 11 - 3
Classes/IJInventoryItem.m

@@ -62,6 +62,8 @@
 	NSUInteger itemsPerRow = 9;
 	NSUInteger pixelsPerColumn = 36;
 	NSUInteger pixelsPerRow = 56;
+	NSImage *atlas;
+	BOOL notFound = FALSE; 
 	
 	int index = 0;
 	
@@ -93,7 +95,9 @@
 	else
 	{
 		NSLog(@"%s error: unrecognized item id %d", __PRETTY_FUNCTION__, itemId);
-		return nil;
+		index = 0;
+		atlasOffset = NSMakePoint(1, 30);
+		notFound = TRUE;
 	}
 	
 	atlasOffset.x += pixelsPerColumn * (index % itemsPerRow);
@@ -101,8 +105,12 @@
 	
 	NSRect atlasRect = NSMakeRect(atlasOffset.x, atlasOffset.y, itemImageSize.width, itemImageSize.height);
 	
-	
-	NSImage *atlas = [NSImage imageNamed:@"DataValuesV110Transparent.png"];
+	if (notFound != TRUE) {
+		atlas = [NSImage imageNamed:@"DataValuesV110Transparent.png"];
+	}else {
+		atlas = [NSImage imageNamed:@"blockNotFound.png"];
+	}
+
 	NSImage *output = [[NSImage alloc] initWithSize:itemImageSize];
 	
 	atlasRect.origin.y = atlas.size.height - atlasRect.origin.y;

BIN
Images/blockNotFound.png


+ 4 - 0
InsideJob.xcodeproj/project.pbxproj

@@ -28,6 +28,7 @@
 		8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
 		8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
 		8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+		BA24598B1297428900F8B9C2 /* blockNotFound.png in Resources */ = {isa = PBXBuildFile; fileRef = BA24598A1297428900F8B9C2 /* blockNotFound.png */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -68,6 +69,7 @@
 		66BCFE61125FCEC6005A23F4 /* DataValuesV110Transparent.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DataValuesV110Transparent.png; sourceTree = "<group>"; };
 		8D1107310486CEB800E47090 /* InsideJob-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "InsideJob-Info.plist"; sourceTree = "<group>"; };
 		8D1107320486CEB800E47090 /* Inside Job.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Inside Job.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+		BA24598A1297428900F8B9C2 /* blockNotFound.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blockNotFound.png; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -218,6 +220,7 @@
 		66BC07711262823E005A23F4 /* Images */ = {
 			isa = PBXGroup;
 			children = (
+				BA24598A1297428900F8B9C2 /* blockNotFound.png */,
 				66BCFE61125FCEC6005A23F4 /* DataValuesV110Transparent.png */,
 				66BCFC35125EA53E005A23F4 /* InsideJob.icns */,
 			);
@@ -284,6 +287,7 @@
 				66BCFC36125EA53E005A23F4 /* InsideJob.icns in Resources */,
 				66BCFE62125FCEC6005A23F4 /* DataValuesV110Transparent.png in Resources */,
 				66BC077312628257005A23F4 /* ItemPropertiesView.xib in Resources */,
+				BA24598B1297428900F8B9C2 /* blockNotFound.png in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};