jadijadi / riverraidrust

A text based river raid clone in Rust; streamed
GNU General Public License v3.0
94 stars 28 forks source link

River goes too much left after a while ( does not go right ) #61

Closed ghost closed 7 months ago

ghost commented 7 months ago

River goes too much left after a while and never goes to the right again which may be an annoying experience i think i've found the origin check this code snippet :

    // draw the map
    for l in 0..world.map.len() {
        sc.queue(MoveTo(0, l as u16))?
            .queue(Print("+".repeat(world.map[l].0 as usize)))?
            .queue(MoveTo(world.map[l].1, l as u16))?
            .queue(Print("+".repeat((world.maxc - world.map[l].1) as usize)))?;
    }

i think the line : .queue(Print("+".repeat((world.maxc - world.map[l].1) as usize)))?; causes this behavior.