Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/oif/resource_oif.cc

Last change on this file was 10314, checked in by patrick, 18 years ago

merged branche mount_point to trunk. this will add mount point abilities, bsp transparency fix and some other smaller stuff to this trunk

File size: 1.7 KB
RevLine 
[10059]1/*
2   orxonox - the future of 3D-vertical-scrollers
[10051]3
[10059]4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific
12   main-programmer: Patrick Boenzli patrick@orxonox.net
13   co-programmer:
14*/
15
[10051]16#include "resource_oif.h"
17
18#include "substring.h"
19#include "multi_type.h"
20#include "debug.h"
21
22
[10052]23ResourceOIF::ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel)
[10051]24    : Resource(&ResourceOIF::type)
25{
[10052]26  Resources::StorePointer* ptr = this->acquireResource(fileName);
[10051]27
[10314]28
[10051]29  if (ptr)
30  {
[10314]31    PRINTF(5)("FOUND OIF: %s\n", fileName.c_str());
32    this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
[10051]33  }
34  else
35  {
[10314]36    PRINTF(5)("NOT FOUND OIF: %s\n", fileName.c_str());
37    std::string fullName = this->Resource::locateFile(fileName);
38    PRINTF(5)("trying loading of: %s\n", fullName.c_str());
39    this->load(fullName);
40    this->Resource::addResource(new ResourceOIF::OIFResourcePointer(fileName, keepLevel, this->ObjectInformationFile::dataPointer()));
[10051]41  }
42
43}
44
45ResourceOIF ResourceOIF::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
46{
47  SubString loadValues(loadString, ',');
[10052]48  std::string fileName;
[10051]49  if (loadValues.size() > 0)
[10052]50    fileName = loadValues[0];
[10051]51
[10052]52  return ResourceOIF(fileName);
[10051]53}
54
55
56
57Resources::tType<ResourceOIF> ResourceOIF::type("OIF");
58
59
60
61
62
63ResourceOIF::OIFResourcePointer::OIFResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const OIFData::Pointer& data)
64    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
65{}
66
67
Note: See TracBrowser for help on using the repository browser.