5 * Created by Alyssa Milburn on Thu Dec 29 2005.
6 * Copyright (c) 2005 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #include "renderable.h"
23 //#include "CompoundPart.h"
24 bool renderablezorder::operator ()(const renderable
*s1
, const renderable
*s2
) const {
25 // TODO: There's got to be a less stupid way to do this. - fuzzie
26 if (s1
->getZOrder() == s2
->getZOrder()) {
27 const CompoundPart
*p1
= dynamic_cast<const CompoundPart
*>(s1
);
28 const CompoundPart
*p2
= dynamic_cast<const CompoundPart
*>(s2
);
30 return p1
->id
< p2
->id
;
33 return s1
->getZOrder() < s2
->getZOrder();
36 void renderable::zapZOrder() {
38 world
.renders
.erase(renders_iter
);
42 void renderable::addZOrder() {
44 renders_iter
= world
.renders
.insert(this);
48 renderable::~renderable() {
50 world
.renders
.erase(renders_iter
);