1# -*-python-*- 2# GemRB - Infinity Engine Emulator 3# Copyright (C) 2003 The GemRB Project 4# 5# This program is free software; you can redistribute it and/or 6# modify it under the terms of the GNU General Public License 7# as published by the Free Software Foundation; either version 2 8# of the License, or (at your option) any later version. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18# 19# the place for preloading the most commonly used tables 20# helps with code deduplication, reduced log spam and tiny lookup savings 21import GemRB 22from ie_restype import RES_2DA 23 24# these two are only used in SetEncumbranceLabels, but that is called very often 25StrMod = StrModEx = None 26Classes = KitList = ClassSkills = Races = NextLevel = None 27Pdolls = SpellDisplay = Aligns = ItemType = None 28WeapProfs = CharProfs = None 29 30def Load(): 31 global Classes, KitList, ClassSkills, Races, NextLevel 32 global Pdolls, StrModEx, StrMod, SpellDisplay, Aligns 33 global ItemType, WeapProfs, CharProfs 34 35 print() # so the following output isn't appended to an existing line 36 if not Classes: 37 Classes = GemRB.LoadTable ("classes") 38 if not KitList and GemRB.HasResource("kitlist", RES_2DA): 39 KitList = GemRB.LoadTable ("kitlist") 40 if not ClassSkills: 41 ClassSkills= GemRB.LoadTable ("clskills") 42 if not Races: 43 Races = GemRB.LoadTable ("races") 44 if not NextLevel: 45 NextLevel = GemRB.LoadTable ("xplevel") 46 if not Pdolls and GemRB.HasResource("pdolls", RES_2DA): 47 Pdolls = GemRB.LoadTable ("pdolls") 48 if not StrMod: 49 StrMod = GemRB.LoadTable ("strmod") 50 StrModEx = GemRB.LoadTable ("strmodex") 51 if not SpellDisplay: 52 SpellDisplay = GemRB.LoadTable ("spldisp") 53 if not Aligns and GemRB.HasResource("aligns", RES_2DA): 54 Aligns = GemRB.LoadTable ("aligns") 55 if not ItemType: 56 ItemType = GemRB.LoadTable ("itemtype") 57 if not WeapProfs and GemRB.HasResource("weapprof", RES_2DA): 58 WeapProfs = GemRB.LoadTable ("weapprof") 59 if not CharProfs and GemRB.HasResource("charprof", RES_2DA): 60 CharProfs = GemRB.LoadTable ("charprof") 61