subdirectories work for real this time
This commit is contained in:
parent
2edea049bd
commit
df953ef20f
24
Engine.cc
24
Engine.cc
@ -68,9 +68,10 @@ static void normalize(dVector3 vec)
|
|||||||
static vector<string> split(const string & str, char delim)
|
static vector<string> split(const string & str, char delim)
|
||||||
{
|
{
|
||||||
vector<string> ret;
|
vector<string> ret;
|
||||||
ssize_t begin = 0, pos;
|
ssize_t begin = 0, len = str.length();
|
||||||
int len = str.length();
|
size_t pos;
|
||||||
while ((pos = str.find(delim)) != string::npos && begin < len)
|
while ((pos = str.find(delim)) != string::npos
|
||||||
|
&& begin < len)
|
||||||
{
|
{
|
||||||
ret.push_back(string(str, begin, pos - begin));
|
ret.push_back(string(str, begin, pos - begin));
|
||||||
begin = pos + 1;
|
begin = pos + 1;
|
||||||
@ -578,11 +579,11 @@ int Engine::clearEventHandler(lua_State * L)
|
|||||||
int Engine::loadModel(const string & name, bool is_static, bool is_reference,
|
int Engine::loadModel(const string & name, bool is_static, bool is_reference,
|
||||||
bool enable_blending, float scale)
|
bool enable_blending, float scale)
|
||||||
{
|
{
|
||||||
size_t pos = name.find_first_not_of(FILENAME_SAFE_CHARS);
|
string path = name;
|
||||||
if (pos == string::npos)
|
if (validatePath(path))
|
||||||
{
|
{
|
||||||
FileLoader::Path model_path("", name + ".obj");
|
FileLoader::Path model_path("", path + ".obj");
|
||||||
FileLoader::Path phys_path("", name + ".phy");
|
FileLoader::Path phys_path("", path + ".phy");
|
||||||
|
|
||||||
WFObj * obj = new WFObj(*m_fileLoader, m_textureCache);
|
WFObj * obj = new WFObj(*m_fileLoader, m_textureCache);
|
||||||
|
|
||||||
@ -608,10 +609,10 @@ int Engine::loadModel(const string & name, bool is_static, bool is_reference,
|
|||||||
|
|
||||||
int Engine::loadSound(const string & name)
|
int Engine::loadSound(const string & name)
|
||||||
{
|
{
|
||||||
size_t pos = name.find_first_not_of(FILENAME_SAFE_CHARS);
|
string nm = name;
|
||||||
if (pos == string::npos)
|
if (validatePath(nm))
|
||||||
{
|
{
|
||||||
FileLoader::Path path("", name);
|
FileLoader::Path path("", nm);
|
||||||
|
|
||||||
refptr<AV::Sound> avs = m_av.createSound();
|
refptr<AV::Sound> avs = m_av.createSound();
|
||||||
|
|
||||||
@ -640,8 +641,7 @@ void Engine::exit()
|
|||||||
bool Engine::import(const char * name)
|
bool Engine::import(const char * name)
|
||||||
{
|
{
|
||||||
string nm(name);
|
string nm(name);
|
||||||
size_t pos = nm.find_first_not_of(FILENAME_SAFE_CHARS);
|
if (validatePath(nm))
|
||||||
if (pos == string::npos)
|
|
||||||
{
|
{
|
||||||
string file_path = locateResource(nm + ".lua");
|
string file_path = locateResource(nm + ".lua");
|
||||||
if (file_path != "")
|
if (file_path != "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user