mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
minor fix for the last commit
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@118 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
75d5ad8882
commit
5c523995bb
@ -23,15 +23,49 @@
|
||||
|
||||
module terrain.terrain;
|
||||
|
||||
import terrain.generator;
|
||||
import std.stdio;
|
||||
import std.file;
|
||||
import monster.util.string;
|
||||
|
||||
char[] cacheDir = "cache/terrain/";
|
||||
|
||||
void initTerrain(bool doGen)
|
||||
{
|
||||
if(doGen)
|
||||
generate();
|
||||
terr_genData();
|
||||
|
||||
terr_setupRendering();
|
||||
}
|
||||
|
||||
// Move elsewhere, make part of the general cache system later
|
||||
void makeDir(char[] pt)
|
||||
{
|
||||
if(exists(pt))
|
||||
{
|
||||
if(!isdir(pt))
|
||||
fail(pt ~ " is not a directory");
|
||||
}
|
||||
else
|
||||
mkdir(pt);
|
||||
}
|
||||
|
||||
void fail(char[] msg)
|
||||
{
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
void makePath(char[] pt)
|
||||
{
|
||||
assert(!pt.begins("/"));
|
||||
foreach(int i, char c; pt)
|
||||
if(c == '/')
|
||||
makeDir(pt[0..i]);
|
||||
|
||||
if(!pt.ends("/"))
|
||||
makeDir(pt);
|
||||
}
|
||||
|
||||
extern(C):
|
||||
void terr_setCacheDir(char *dir);
|
||||
void terr_genData();
|
||||
void terr_setupRendering();
|
||||
|
Loading…
Reference in New Issue
Block a user