Hopson97 / Asciimon

Pokemon-inspired game created using Rust for terminals which support ANSI escape commands.
124 stars 11 forks source link

Replace i32 with u32 #28

Closed dmitmel closed 6 years ago

dmitmel commented 6 years ago

Support for negative coordinates has been removed in commit a0e23a3, but a lot of functions and constants still use signed integers for coordinates (e.g.: why do you need signed integers in layout constants?). So, I've replaced all i32s with u32s where it's possible.

This PR consists of one large commit because if you change an argument type in one function, everything breaks. So, here are notes about changes in each file (skip means that a file contains insignificant changes that can be skipped during review):

dmitmel commented 6 years ago

@Hopson97 I've opened this PR a week ago, but there's no changes/discussion about it. So here are some questions:

  1. Have you seen this PR?
  2. If so, do you think it is relevant now? (I can prove this if you want, but I'm not being forceful, feel free to disagree)
  3. If it is relevant, should I rebase it onto master?
Hopson97 commented 6 years ago

I understand the motivation for making i32 into uxx, but I don't see the advantage of doing this.

While i32 can be negative, uxx is able to underflow, so that is still an issue.

u32 allows for a greater range of numbers, but I doubt I'll be using over 2 billion coordinates. 😄

dmitmel commented 6 years ago

@Hopson97 Ok, but this PR contains some refactors for chunk rendering logic to work with unsigned types. I'll open a new PR just for that.