renaming some variables, various cleanup tasks
This commit is contained in:
		
							parent
							
								
									428cd668f3
								
							
						
					
					
						commit
						02903b57da
					
				|  | @ -1,3 +1,4 @@ | |||
| zig-cache/ | ||||
| zig-out/ | ||||
| .zig-cache/ | ||||
| oracle-data/* | ||||
|  |  | |||
							
								
								
									
										2129
									
								
								output.pdf
								
								
								
								
							
							
						
						
									
										2129
									
								
								output.pdf
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -1,4 +1,3 @@ | |||
| //TODO: change references to "HeightMayVary" to "constantHeight" | ||||
| //TODO: add loyalty for planeswalkers | ||||
| //TODO: print mana cost beside each name for dual-faced cards | ||||
| //TODO: consider eliminating the TextCard struct | ||||
|  | @ -69,7 +68,7 @@ const pageWidth = fullWidthSpacer.len; | |||
| //values that may vary depending on user-supplied arguments | ||||
| var oracleFileName = "oracle-data/oracle-cards-20240701090158.json"; | ||||
| var listFileName: []const u8 = undefined;   //the name of the file with the list of cards to print | ||||
| var heightMayVary = true;                   //whether or not cards must have a constant height | ||||
| var constantHeight = true;                   //whether or not cards must have a constant height | ||||
| 
 | ||||
| test "Check constants" { | ||||
|     var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | ||||
|  | @ -98,9 +97,9 @@ pub fn main() !void { | |||
|     } else { | ||||
|       return error.ExpectedArgument; | ||||
|     } | ||||
|     //TODO (FIXME): passing "false" currently causes the program to hang and then crash | ||||
|     //TODO (FIXME): passing "true" currently causes the program to hang and then crash | ||||
|     if(res.args.constant) |choice| { | ||||
|         heightMayVary = stringToBool(choice); | ||||
|         constantHeight = std.mem.eql(u8, choice, "true"); | ||||
|     } | ||||
| 
 | ||||
|     const oracleFile = try cwd.openFile(oracleFileName, .{}); | ||||
|  | @ -224,7 +223,8 @@ fn card( | |||
| } | ||||
| 
 | ||||
| fn wrongCardHeight(length: usize) bool { | ||||
|     return (!heightMayVary and length < cardHeight) or length < minCardHeight; | ||||
|     print("{d}\n", .{length}); | ||||
|     return (constantHeight and length < cardHeight) or length < minCardHeight; | ||||
| } | ||||
| 
 | ||||
| const linesList = std.MultiArrayList(cardRow); | ||||
|  | @ -274,6 +274,3 @@ const cardRow = struct { | |||
|     } | ||||
| }; | ||||
| 
 | ||||
| fn stringToBool(str: ?[]const u8) bool { | ||||
|     return std.mem.eql(u8, (str orelse "false"), "true"); | ||||
| } | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue