⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapinfo.pas

📁 这是千年外挂的源代码
💻 PAS
字号:
unit MapInfo;

interface

uses Windows,SysUtils,Classes,Dialogs;

type
    TMapHeader = record                                    //千年地图文件头 28字节
    Width  : dword;
    Height : dword;
    end;

type
    TMapInfor = class (Tobject)
    private
        MapWidth,MapHeight : integer;
    public
        MapData  : array of array of byte;
        function LoadMap      (FileName:string) :bool;              //加载地图文件。获取数据
        function GetMapHeight ():integer;                           //获取地图宽度
        function GetMapWidth  ():integer;                           //获取地图长度
        constructor Create;
        Destructor  Destroy  ; override;
    end;

implementation

constructor TMapInfor.Create;
begin
    inherited Create;
end;

Destructor TmapInfor.Destroy;
begin
end;
///////////////////////////////////////////////////////////
//函数:LoadMap
//功能:提取千年地图信息
//参数:地图文件名  string
//返回:true 成功  false 失败
//说明:千年地图数据格式为 40 * 40
//      从左到右 从上到下 如一个 200 * 200 的地图存储如下
//      1   2   3   4   5
//
//      6   7   8   9   10
//
//      11  12  13  14  15
//
//      16  17  18  19  20
//
//      21  22  23  24  25
//
//      每格之间用20个字节的0 组成
///////////////////////////////////////////////////////////
Function Tmapinfor.LoadMap ( FileName:string ):bool;
var
  MapHeader : TMapHeader;
  MapFile   : File;
  Size: integer;
begin
   if FileName <> '' then
      begin
      try
      AssignFile (MapFile,FileName);                      //建立文件关联
      Reset      (MapFile,1);                             //打开文件
      Seek       (MapFile,0);                             //移动指针
      Blockread  (MapFile,MapHeader,8,size);             //read map header information
      if Size <> 8 then
              begin
              ShowMessage ('读取文件头出错,请检查文件的有效性!');
              LoadMap := False;
              exit;
              end
      else        
      MapWidth := MapHeader.Width;
      MapHeight:= MapHeader.Height;
      Finally
      CloseFile (MapFile);
      end;
  end;
end;

function Tmapinfor.GetMapWidth :integer;
begin
    GetMapWidth := MapWidth;
end;

function Tmapinfor.GetMapHeight :integer;
begin
    GetMapHeight:= MapHeight;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -