tomassedovic / tcod-rs

Rust bindings for libtcod 1.6.3 (the Doryen library/roguelike toolkit)
Do What The F*ck You Want To Public License
229 stars 45 forks source link

Fix the with and height asserts in Console::rect #229

Closed tomassedovic closed 7 years ago

tomassedovic commented 7 years ago

The upstream docs are wrong on this one: x + width can be equal to the console's width as well. It would be impossible to have a rect that ends at the right edge of the console. And the same goes for height.

In addition, I've split the conditions each into its own assert. When it fires, it's useful to know which condition in particular failed (was it the x or the y check?). This generates much more useful error messages.

tomassedovic commented 7 years ago

The linux and windows jobs passed and the osx ones will fail unrelated to the change here (see #230), so I'm merging this.