• R/O
  • SSH

dwaddle: Commit

Main Dwaddle repository


Commit MetaInfo

Revisionaa0222d105cacaf6a179bf6980c67fede1e51bbd (tree)
Time2021-06-19 14:25:22
AuthorRemilia Scarlet <remilia@post...>
CommiterRemilia Scarlet

Log Message

Fix some logic in level detection, and add the #empty? method to the
WadFile class.

Change Summary

Incremental Difference

diff -r 5a6229b242ba -r aa0222d105ca src/wadfile.cr
--- a/src/wadfile.cr Tue May 25 23:57:19 2021 -0600
+++ b/src/wadfile.cr Fri Jun 18 23:25:22 2021 -0600
@@ -332,6 +332,11 @@
332332 @entries.size.to_u32!
333333 end
334334
335+ # Returns `true` if this wad is empty, or `false` otherwise.
336+ def empty? : Bool
337+ size == 0
338+ end
339+
335340 # Appends a new lump onto the wad.
336341 def <<(lmp : Lump)
337342 @entries << lmp
@@ -761,15 +766,14 @@
761766
762767 # Search through all wad lumps starting at startIdx, seeing if we have all
763768 # of the of the correct lumps in the correct order.
764- (self.size - startIdx).times do |idx|
769+ (startIdx...self.size).each do |idx|
765770 # Check to make sure we don't go off the edge
766771 if idx + lumpTable.size < self.size
767772 valid = true
768773
769774 lumpTable.size.times do |offset|
770- # Stop searching if the next lump does not match the next vanilla
771- # lump
772- unless self[idx + offset + 1].name == lumpTable[offset].gsub("{{marker}}", self[idx].name)
775+ # Stop searching if the next lump does not match the next lump in the table
776+ unless self[idx + offset].name == lumpTable[offset].gsub("{{marker}}", self[idx].name)
773777 valid = false
774778 break
775779 end
Show on old repository browser