14 #include "../clib/cfgelem.h" 15 #include "../clib/rawtypes.h" 25 :
Region( elem, id ), nocast_( elem.remove_bool(
"nocast", false ) )
38 "NoCastRegion Region" );
55 "LightRegion Region" );
61 weathertype( static_cast<
u8>( elem.remove_ushort(
62 "WeatherType", 255 ) ) ),
63 severity( static_cast<
u8>( elem.remove_ushort(
"WeatherSeverity", 0 ) ) ),
64 aux( static_cast<
u8>( elem.remove_ushort(
"WeatherAux", 0 ) ) ),
65 lightoverride( elem.remove_int(
"LightOverride", -1 ) )
79 unsigned int gridwidth = realm->width() /
ZONE_SIZE;
80 unsigned int gridheight = realm->height() /
ZONE_SIZE;
84 for (
unsigned int i = 0; i < gridwidth; i++ )
87 for (
unsigned int j = 0; j < gridheight; j++ )
100 unsigned int gridwidth = realmregion.first->width() /
ZONE_SIZE;
102 for (
unsigned int i = 0; i < gridwidth; i++ )
103 delete[] realmregion.second[i];
104 delete[] realmregion.second;
114 unsigned int gridwidth = realm.first->width() /
ZONE_SIZE;
129 for (
unsigned int i = 0; i < gridwidth; i++ )
131 for (
unsigned int j = 0; j < gridheight; j++ )
140 unsigned short ynorth,
unsigned short xeast,
143 if ( xwest >= realm->
width() )
144 xwest = static_cast<unsigned short>( realm->
width() ) - 1;
145 if ( xeast >= realm->
width() )
146 xeast = static_cast<unsigned short>( realm->
width() ) - 1;
147 if ( ynorth >= realm->
height() )
148 ynorth = static_cast<unsigned short>( realm->
height() ) - 1;
149 if ( ysouth >= realm->
height() )
150 ysouth = static_cast<unsigned short>( realm->
height() ) - 1;
153 if ( regionname && regionname[0] )
156 if ( rgn ==
nullptr )
159 unsigned zone_xwest, zone_ynorth, zone_xeast, zone_ysouth;
161 std::tie( zone_xwest, zone_ynorth ) =
XyToZone( xwest, ynorth );
162 std::tie( zone_xeast, zone_ysouth ) =
XyToZone( xeast, ysouth );
164 for (
auto zx = zone_xwest; zx <= zone_xeast; ++zx )
166 for (
auto zy = zone_ynorth; zy <= zone_ysouth; ++zy )
174 unsigned zone_xwest, zone_ynorth, zone_xeast, zone_ysouth;
175 std::tie( zone_xwest, zone_ynorth ) =
XyToZone( xwest, ynorth );
176 std::tie( zone_xeast, zone_ysouth ) =
XyToZone( xeast, ysouth );
178 for (
auto zx = zone_xwest; zx <= zone_xeast; ++zx )
180 for (
auto zy = zone_ynorth; zy <= zone_ysouth; ++zy )
194 "WeatherRegion Region" );
virtual size_t estimateSize() const POL_OVERRIDE
void read_region_data(RegionGroupBase &grp, const char *preferred_filename, const char *other_filename, const char *tags_expected)
virtual size_t estimateSize() const POL_OVERRIDE
bool assign_zones_to_region(const char *regionname, unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, Realms::Realm *realm)
RegionId regionid() const
LightRegion(Clib::ConfigElem &elem, RegionId id)
void update_all_weatherregions()
int lightlevel(unsigned short x, unsigned short y)
std::pair< unsigned, unsigned > XyToZone(xcoord x, ycoord y)
void read_weather_zones()
virtual size_t estimateSize() const POL_OVERRIDE
virtual size_t estimateSize() const
std::vector< Realms::Realm * > Realms
virtual size_t estimateSize() const
unsigned short height() const
RegionRealms regionrealms
WeatherDef(const char *name)
Region * getregion_byname(const std::string ®ionname)
NoCastRegion(Clib::ConfigElem &elem, RegionId id)
WeatherRegion(Clib::ConfigElem &elem, RegionId id)
RegionGroup< LightRegion > LightDef
unsigned short width() const
const std::string & name() const
RegionGroup< NoCastRegion > NoCastDef
virtual size_t estimateSize() const POL_OVERRIDE
RegionRealms default_regionrealms
void copy_default_regions()