Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (555)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Solved] Reading world from a file  (Read 331 times)
0 Members and 1 Guest are viewing this topic.
Offline CopyableCougar4

Senior Member


Medals: 7
Exp: 1 year



« Posted 2014-07-09 00:58:13 »

Hi

For my current project a read
Block
objects from a file. While I am doing this, the first block is read completely, but the other blocks don't seem to be read? I know this is specific to my project, and I don't know if I provided enough code, but I was wondering if someone could help me out with this issue, as the plan is to have many blocks read from this file, and there must be a lot of files if only one block can be read from a file. Hope somebody can help Smiley

WorldReader constructor pastebin: http://pastebin.java-gaming.org/aa3543c1d001b

CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Online Longarmx
« Reply #1 - Posted 2014-07-09 01:16:44 »

Have you tried printing out the size of your array?

What is in your readFileToList() function?

Offline CopyableCougar4

Senior Member


Medals: 7
Exp: 1 year



« Reply #2 - Posted 2014-07-09 01:18:21 »

Hi

The readFileToList just constructs a buffered reader for the file, and the arrays of both tiles and the list of file lines both have the expected number of spaces, it's just that for two of the blocks all the Tile objects in the arrays are null.

CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CopyableCougar4

Senior Member


Medals: 7
Exp: 1 year



« Reply #3 - Posted 2014-07-09 01:24:13 »

Hi

I feel stupid looking back at my code... I just didn't reset the y value every section, and I had a try-catch for the
ArrayIndexOutOfBoundsException
, so I didn't see the error.

CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Offline BurntPizza
« Reply #4 - Posted 2014-07-09 01:28:11 »

Never catch bounds errors, or if you do, at least print the trace. Always print/log errors.
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (13 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (27 views)
2014-08-22 19:31:30

atombrot (40 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (34 views)
2014-08-16 06:22:17

Tekkerue (24 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!