function p.render(wid)
    ga_win_set_background_default(wid)

    local price = ga_get_i("temp.xar.ent.pay_toll.price")
    ga_win_txt_center(wid, 0.75, "Press ENTER")
    ga_win_txt_center(wid, 0.65, "to pay ^x00ff00" .. tostring(price) .. "^! gold")
    ga_win_txt_center(wid, 0.55, "to open the toll door")

    ga_win_set_char_size(wid, 0.015, 0.03)
    ga_win_txt_center(wid, 0.30, "It will remain open forever")

    -- local gold = ga_get_i("xar.player.gold.amount")
    -- ga_win_txt_center(wid, 0.9, "GOLD IN INVENTORY = " .. gold)

    ga_win_set_char_size(wid, 0.02, 0.04)
    ga_win_txt_center(wid, 0.06, "Go Back (ESC or F)")
end

function p.process_input(wid)
    if( ga_win_key_pressed(wid, "ESC") or
        ga_win_key_pressed(wid, "F") or
        ga_win_mouse_pressed(wid, true) )
    then
        ga_play_sound("menu_back")
        ga_window_pop()
    end

    if game_key.pressed_or_spammed(wid, "ENTER") then
        p.remove_door()
        ga_window_pop()
    end
end

function p.remove_door()
    --Dealing with gold.
    local price = ga_get_i("temp.xar.ent.pay_toll.price")
    local gold_in_inv = ga_get_i("xar.player.gold.amount")
    if( gold_in_inv < price ) then
        ga_play_sound("error")
        return
    end
    ga_play_sound("toll_door")
    gold_in_inv = gold_in_inv - price
    ga_set_i("xar.player.gold.amount", gold_in_inv)
    
    local level = ga_get_i("temp.xar.ent.pay_toll.level")
    local x = ga_get_i("temp.xar.ent.pay_toll.bp.x")
    local y = ga_get_i("temp.xar.ent.pay_toll.bp.y")
    local z = ga_get_i("temp.xar.ent.pay_toll.bp.z")
    local bp = std.bp(x,y,z)
    --
    local vcp = std.bp_to_vcp(bp)

    for xi = 0,15 do
    for yi = 0,15 do
    for zi = 0,15 do
        local lbp = std.bp(xi,yi,zi)
        local bp2 = std.lbp_to_bp(vcp, lbp)
        --
        local block_type = ga_block_get(level, bp2)
        if( block_type == "TOLL_DOOR" ) then
            --Removing the block.
            ga_block_change_perm(level, bp2, "EMPTY_BORING")
        end
        --
        local bent_type = ga_bent_get_type(level, bp2)
        if( bent_type == "bent_pay_toll" ) then
            --Removing the box used to pay the toll.
            ga_bent_remove_perm(level, bp2)
        end
    end end end
end
