Last change
on this file since 9784 was
9784,
checked in by bensch, 18 years ago
|
orxonox/new_class_id: new Resources stuff
|
File size:
1.5 KB
|
Rev | Line | |
---|
[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 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. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[7195] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[7195] | 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING |
---|
[1853] | 17 | |
---|
[7193] | 18 | #include "resource.h" |
---|
[1853] | 19 | |
---|
[9718] | 20 | ObjectListDefinition(Resource); |
---|
[1853] | 21 | |
---|
[1856] | 22 | |
---|
[3245] | 23 | /** |
---|
[4838] | 24 | * standard constructor |
---|
[3245] | 25 | */ |
---|
[9784] | 26 | Resource::Resource () |
---|
| 27 | : _pointer(NULL) |
---|
[3365] | 28 | { |
---|
[9718] | 29 | this->registerObject(this, Resource::_objectList); |
---|
[4320] | 30 | |
---|
[3365] | 31 | } |
---|
[1853] | 32 | |
---|
[3245] | 33 | /** |
---|
[4838] | 34 | * standard deconstructor |
---|
[7195] | 35 | */ |
---|
[7193] | 36 | Resource::~Resource () |
---|
[3543] | 37 | { |
---|
| 38 | // delete what has to be deleted here |
---|
| 39 | } |
---|
[9783] | 40 | |
---|
| 41 | |
---|
| 42 | |
---|
[9784] | 43 | Resource::Pointer* Resource::acquireResource(Resource::Type& resourceType, const std::string& loadString) |
---|
| 44 | { |
---|
| 45 | if(resourceType.id() == -1) |
---|
| 46 | { |
---|
| 47 | Resource::_resourceTypes.push_back(&resourceType); |
---|
| 48 | resourceType.setID(Resource::_resourceTypes.size()); |
---|
| 49 | } |
---|
| 50 | const Resource::Type* const type = Resource::_resourceTypes[resourceType.id()]; |
---|
[9783] | 51 | |
---|
[9784] | 52 | for (unsigned int i = 0; i < type->storedResources().size(); ++i) |
---|
| 53 | if (type->storedResources()[i]->_pointer->loadString() == loadString) |
---|
| 54 | return type->storedResources()[i]->_pointer; |
---|
[9783] | 55 | |
---|
[9784] | 56 | return NULL; |
---|
| 57 | } |
---|
[9783] | 58 | |
---|
| 59 | |
---|
| 60 | |
---|
[9784] | 61 | |
---|
| 62 | |
---|
| 63 | |
---|
[9783] | 64 | void Resource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name) |
---|
| 65 | { |
---|
| 66 | if (_keepLevelName.size() <= level) |
---|
| 67 | _keepLevelName.resize(level+1); |
---|
| 68 | _keepLevelName[level] = name; |
---|
| 69 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.