247 |
namespace |
namespace |
248 |
{ |
{ |
249 |
class Gradient : public Floor { |
class Gradient : public Floor { |
250 |
CLONEOBJ(Gradient); |
//CLONEOBJ(Gradient); |
251 |
|
Object *clone() { return new Gradient(get_type()); } |
252 |
|
void dispose() { delete this; } |
253 |
public: |
public: |
254 |
Gradient(); |
Gradient(int type=MINTYPE); |
255 |
private: |
private: |
256 |
int get_type() const; |
int get_type() const; |
257 |
enum { MINTYPE=1, MAXTYPE=24 }; |
enum { MINTYPE=1, MAXTYPE=24 }; |
264 |
}; |
}; |
265 |
} |
} |
266 |
|
|
267 |
Gradient::Gradient() |
Gradient::Gradient(int type) |
268 |
: Floor("fl-gradient", 4, 2) |
: Floor("fl-gradient", 4, 2) |
269 |
{ |
{ |
270 |
set_attrib("type", Value(MINTYPE)); |
set_attrib("type", Value(type)); |
271 |
} |
} |
272 |
|
|
273 |
int Gradient::get_type() const |
int Gradient::get_type() const |
3696 |
ObjectRepos(); |
ObjectRepos(); |
3697 |
~ObjectRepos(); |
~ObjectRepos(); |
3698 |
void add_templ(Object *o); |
void add_templ(Object *o); |
3699 |
|
void add_templ (const string &name, Object *o); |
3700 |
bool has_templ(const string &name); |
bool has_templ(const string &name); |
3701 |
Object *make(const string &name); |
Object *make(const string &name); |
3702 |
Object *get_template(const string &name); |
Object *get_template(const string &name); |
3715 |
add_templ(new Abyss); |
add_templ(new Abyss); |
3716 |
add_templ(new Water); |
add_templ(new Water); |
3717 |
add_templ(new Bridge); |
add_templ(new Bridge); |
3718 |
|
|
3719 |
add_templ(new Gradient); |
add_templ(new Gradient); |
3720 |
|
|
3721 |
|
add_templ("fl-gradient1", new Gradient(1)); |
3722 |
|
add_templ("fl-gradient2", new Gradient(2)); |
3723 |
|
add_templ("fl-gradient3", new Gradient(3)); |
3724 |
|
add_templ("fl-gradient4", new Gradient(4)); |
3725 |
|
add_templ("fl-gradient5", new Gradient(5)); |
3726 |
|
add_templ("fl-gradient6", new Gradient(6)); |
3727 |
|
add_templ("fl-gradient7", new Gradient(7)); |
3728 |
|
add_templ("fl-gradient8", new Gradient(8)); |
3729 |
|
add_templ("fl-gradient9", new Gradient(9)); |
3730 |
|
add_templ("fl-gradient10", new Gradient(10)); |
3731 |
|
add_templ("fl-gradient11", new Gradient(11)); |
3732 |
|
add_templ("fl-gradient12", new Gradient(12)); |
3733 |
|
add_templ("fl-gradient13", new Gradient(22)); |
3734 |
|
add_templ("fl-gradient14", new Gradient(21)); |
3735 |
|
add_templ("fl-gradient15", new Gradient(24)); |
3736 |
|
add_templ("fl-gradient16", new Gradient(13)); |
3737 |
|
|
3738 |
// Stones |
// Stones |
3739 |
add_templ(new BlackStone); |
add_templ(new BlackStone); |
3740 |
add_templ(new BlackStone2); |
add_templ(new BlackStone2); |
3816 |
px::delete_map(objmap.begin(), objmap.end()); |
px::delete_map(objmap.begin(), objmap.end()); |
3817 |
} |
} |
3818 |
|
|
3819 |
|
|
3820 |
|
void |
3821 |
|
ObjectRepos::add_templ (const string &kind, Object *o) |
3822 |
|
{ |
3823 |
|
if (has_templ(kind)) |
3824 |
|
enigma::Log << "add_templ: redefinition of object `" <<kind<< "'.\n"; |
3825 |
|
else |
3826 |
|
objmap.insert(kind, o); |
3827 |
|
} |
3828 |
|
|
3829 |
// Add an new Object template to `objmap'. |
// Add an new Object template to `objmap'. |
3830 |
void |
void |
3831 |
ObjectRepos::add_templ(Object *o) |
ObjectRepos::add_templ(Object *o) |
3832 |
{ |
{ |
3833 |
string kind = o->get_kind(); |
string kind = o->get_kind(); |
3834 |
if (!has_templ(kind)) |
if (has_templ(kind)) |
3835 |
// cerr << "add_templ: redefinition of object `" <<kind<< "'.\n"; |
enigma::Log << "add_templ: redefinition of object `" <<kind<< "'.\n"; |
3836 |
// else |
else |
3837 |
objmap.insert(kind, o); |
objmap.insert(kind, o); |
3838 |
} |
} |
3839 |
|
|
3926 |
return dynamic_cast<Stone*>(MakeObject(kind)); |
return dynamic_cast<Stone*>(MakeObject(kind)); |
3927 |
} |
} |
3928 |
|
|
3929 |
|
Actor * |
3930 |
|
world::MakeActor (const char *kind) |
3931 |
|
{ |
3932 |
|
return dynamic_cast<Actor*>(MakeObject(kind)); |
3933 |
|
} |
3934 |
|
|
3935 |
void |
void |
3936 |
world::DisposeObject(Object *o) |
world::DisposeObject(Object *o) |