fejoa wrote
I've been scratching around in the script engine and the database today, the goal being to move the gwterrains and owterrains into script files. Not much luck after having created a rat's nest of code. I pulled it all out again by stashing it. I really wish the devs had implemented a lua script engine or some such, instead of the bespoke "traction engine" we have serving us today...
No apologies for the double post, but I feel that I have cracked the problem at the eleventh hour (or the twelfth, it's 12am here).
I woke up today with a feeling like I shouldn't have been rooting around in script.cpp after all, so I rolled back those changes, and focused on making the world terrains resemble level terrains.
I had a patch where it wasn't compiling beyond database.cpp, but I figured out to add "wterra.h" to "dataset.cpp" and I was away and racing. Suddenly it was a clear path to compiling, but then opening the application and starting a new game resulted in a crash. I blocked out changes to wterras.cpp and wterras.h and I was able to load the world map! But then entering a dungeon suddenly caused a crash! Loaded up again and tried to see what I could do using the command system while in the world map... not much it turns out... until I tried to save the game. Another seg fault! But a healthy clue. Two problems, one of not being able to save, and the earlier problem of the game picking up the BitmapPos of the owterrain, but seemingly unwilling to place it on the worldmap without crashing...
Hours of searching and messing around, until something subtle catches my eye: Every level terrain has a function which initializes some of the data. I decided to chuck it into wterra.cpp, just for the gwterrains and owterrains, and for completeness. What do you know? To my complete surprise it stops crashing when I save, enter a new area, leave it again, and load. What's more, the BitmapPos is being picked up from either owterra.dat or gwterra.dat!
Happy day.
So, reasons this is getting us where we want to go:
Contributers will want to create their own dungeons. Unfortunately, a world map location is not always where the start point of a dungeon is located. Think of the underwater tunnel exit.
Contributers will want to create their own graphics for their new world map locations; and so on. Therefore we need to represent the owterrains in data files. Plus I want to add climate data to each gwterrain, and I feel the best way to test it out would be using a data file, where I don't have to compile each time.