#==============================================================================
#  Ex
#------------------------------------------------------------------------------
# g@\̒`B
#
# @\ꗗ
#T14-019 NEW--->
#   }bvf[^ɑΉ퓬wi̎擾
#   Ex.get_auto_battlebk( tileset, x, y )
#
#   }bvf[^ɑΉ퓬wi̐ݒ
#   Ex.set_auto_battlebk( tileset, x, y, name )
#<--------------
#
#==============================================================================

module Ex
  
  #--------------------------------------------------------------------------
  #  萔lꗗ
  #--------------------------------------------------------------------------
  #T14-019 NEW--->
  #ϐ
  ENV_BATTLEBK_AUTO = "BattleBkList"
  
  #퓬wiɎIɕύX邽߂̉
  BATTLEBK_AUTO = ":battlebk_auto:"
  #<--------------
  
  #T14-019 NEW--->
  #--------------------------------------------------------------------------
  #  }bvf[^ɑΉ퓬wi̎擾
  #     tileset : ^CZbg("A"`"E")
  #     x       : ^CZbgXW(1`8)
  #     y       : ^CZbgYW(1`32)
  #--------------------------------------------------------------------------
  def self.get_auto_battlebk( tileset, x, y )
    #퓬wiXg̒o
    list = $game_system.get_env( ENV_BATTLEBK_AUTO )
    return if list == nil
    
    #W͈̔̓`FbN
    return nil if (x < 1) or (x > 8)
    return nil if (y < 1) or (y > 32)

    #퓬wi̒o
    param = sprintf( "%s%02d%02d", tileset, x, y )
    result = list[param]
    return result
  end
  #<--------------
  
  #T14-019 NEW--->
  #--------------------------------------------------------------------------
  #  }bvf[^ɑΉ퓬wi̐ݒ
  #     tileset : ^CZbg("A"`"E")
  #     x       : ^CZbgXW(1`8)
  #     y       : ^CZbgYW(1`32)
  #     name    : 퓬wĩt@C(gqsv)
  #--------------------------------------------------------------------------
  def self.set_auto_battlebk( tileset, x, y, name )
    #퓬wiXg̒o
    list = $game_system.get_env( ENV_BATTLEBK_AUTO )
    if list == nil
      #Xg܂\zĂȂꍇ͐VK쐬
      list = {}
      $game_system.set_env( ENV_BATTLEBK_AUTO, list )
    end
    
    #W͈̔̓`FbN
    return if (x < 1) or (x > 8)
    return if (y < 1) or (y > 32)
    
    #퓬wi̍XV
    list[sprintf( "%s%02d%02d", tileset, x, y )] = name
  end
  #<--------------
end