Thread: mapdata help

Results 1 to 2 of 2
  1. #1 mapdata help 
    Registered Member dutch helper's Avatar
    Join Date
    Oct 2009
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    can some 1 help me please?

    where must i put this in my mapdata.java

    ("./data/mapdata/Mapdata.dat"));

    http://www.rune-server.org/showthread.php?t=177197 used this tut

    package net.com.codeusa.world.mapdata;

    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.HashMap;
    import net.com.codeusa.util.*;



    private static HashMap<Integer, int[]> mapRegions;
    private static int mapId;

    public int mapData[] = new int[4];

    public int[] getMapData(int region) {
    return mapRegions.get(region);
    }

    public void loadRegions() {
    try {
    DataInputStream in = new DataInputStream(new FileInputStream("./data/mapdata/Mapdata.dat"));
    while (in.available() != 0) {
    mapId = in.readShort();
    for (int data = 0; data < 4; data++) {
    mapData[data] = in.readInt();
    }
    mapRegions.put(mapId, new int[]{mapData[0], mapData[1], mapData[2], mapData[3]});
    }
    in.close();
    in = null;
    }
    catch (IOException ioe) {
    ioe.printStackTrace();
    }
    }

    static {
    mapId = 0;
    mapRegions = new HashMap<Integer, int[]>();
    }

    }
    Reply With Quote  
     

  2. #2  
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    30
    Posts
    1,132
    Thanks given
    10
    Thanks received
    8
    Rep Power
    330
    Code Tags plz,

    and You did it already? u only had to look is it was .dat and not .txt

    package net.com.codeusa.world.mapdata;

    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.HashMap;
    import net.com.codeusa.util.*;



    private static HashMap<Integer, int[]> mapRegions;
    private static int mapId;

    public int mapData[] = new int[4];

    public int[] getMapData(int region) {
    return mapRegions.get(region);
    }

    public void loadRegions() {
    try {
    DataInputStream in = new DataInputStream(new FileInputStream("./data/mapdata/Mapdata.dat"));
    while (in.available() != 0) {
    mapId = in.readShort();
    for (int data = 0; data < 4; data++) {
    mapData[data] = in.readInt();
    }
    mapRegions.put(mapId, new int[]{mapData[0], mapData[1], mapData[2], mapData[3]});
    }
    in.close();
    in = null;
    }
    catch (IOException ioe) {
    ioe.printStackTrace();
    }
    }

    static {
    mapId = 0;
    mapRegions = new HashMap<Integer, int[]>();
    }

    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •