editor.rb
# 0 for undo, 1 for redo
0 for undo, 1 for redo
0 for undo 1 for redo
def do_history_action(index)
  if (@editor_history_index > -1)
    actions = @editor_history[@editor_history_index]
    i = actions.size - 1
    while (i >= 0)
      type = actions[i][0]
      case type
      when "tile"
        tile = actions[i][index + 1]
        if (tile.image_index < 0)
          remove_tile(tile.x, tile.y, false)
        else
          set_tile(tile.x, tile.y, tile.image_index, tile.rotation)
        end
      when "checkpoint"
        checkpoint = actions[i][1]
        arr_index = actions[i][2]
        if (!remove_checkpoint(checkpoint, false))
          add_checkpoint_to_index(checkpoint, arr_index, false)
        end
      when "car"
        ii = (index == 0) ? i : (@editor_actions.size - 1 - i)
        car = actions[ii][index + 1]
        x = car[0]
        y = car[1]
        angle = car[2]
        place_car(x, y, angle, false)
      end
      i -= 1
    end
    update_minimap()
  end
end
def do_history_action ( index ) if ( @editor_history_index > - 1 ) actions = @editor_history [ @editor_history_index ] i = actions . size - 1 while ( i >= 0 ) type = actions [ i ] [ 0 ] case type when "tile" tile = actions [ i ] [ index + 1 ] if ( tile . image_index < 0 ) remove_tile ( tile . x , tile . y , false ) else set_tile ( tile . x , tile . y , tile . image_index , tile . rotation ) end when "checkpoint" checkpoint = actions [ i ] [ 1 ] arr_index = actions [ i ] [ 2 ] if ( ! remove_checkpoint ( checkpoint , false ) ) add_checkpoint_to_index ( checkpoint , arr_index , false ) end when "car" ii = ( index == 0 ) ? i : ( @editor_actions . size - 1 - i ) car = actions [ ii ] [ index + 1 ] x = car [ 0 ] y = car [ 1 ] angle = car [ 2 ] place_car ( x , y , angle , false ) end i -= 1 end update_minimap ( ) end end
0 for undo, 1 for redo
0 for undo 1 for redo
index
<not_specific>