Imported Upstream version 2008.1+svn1553
[opeanno-debian-packaging.git] / game / entities.py
blob0c8f5fa079c534f9fb5d8b95e2d356c79fee3a9d
1 # ###################################################
2 # Copyright (C) 2008 The OpenAnno Team
3 # team@openanno.org
4 # This file is part of OpenAnno.
6 # OpenAnno 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 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the
18 # Free Software Foundation, Inc.,
19 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 # ###################################################
22 from game.world.building import BuildingClass
23 from game.world.units import UnitClass
24 from game.world.ground import GroundClass
25 import game.main
26 from game.util import livingObject
28 class Entities(livingObject):
29 """Class that stores all the special classes for buildings, grounds etc. Stores class objects, not instances."""
30 def begin(self):
31 super(Entities, self).begin()
33 self.grounds = {}
34 for (ground_id,) in game.main.db("SELECT rowid FROM data.ground"):
35 self.grounds[ground_id] = GroundClass(ground_id)
37 self.buildings = {}
38 for (building_id,) in game.main.db("SELECT rowid FROM data.building"):
39 self.buildings[building_id] = BuildingClass(building_id)
41 self.units = {}
42 for (unit_id,) in game.main.db("SELECT rowid FROM data.unit"):
43 self.units[unit_id] = UnitClass(unit_id)