ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.C
(Generate patch)

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.82 by root, Mon Oct 29 23:55:54 2012 UTC vs.
Revision 1.85 by root, Sat Nov 17 23:40:02 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
108 } 109 }
109 110
110 return shstr (buf); 111 return shstr (buf);
111} 112}
112 113
113noinline SV * 114ecb_noinline SV *
114random_map_params::opt_sv (const char *option) const 115random_map_params::opt_sv (const char *option) const
115{ 116{
116 SV **he = hv_fetch (hv, option, strlen (option), 0); 117 SV **he = hv_fetch (hv, option, strlen (option), 0);
117 118
118 return he ? *he : 0; 119 return he ? *he : 0;
119} 120}
120 121
121noinline const_utf8_string 122ecb_noinline const_utf8_string
122random_map_params::get_str (const char *option, const_utf8_string fallback) const 123random_map_params::get_str (const char *option, const_utf8_string fallback) const
123{ 124{
124 SV *sv = opt_sv (option); 125 SV *sv = opt_sv (option);
125 return sv ? cfSvPVutf8_nolen (sv) : fallback; 126 return sv ? cfSvPVutf8_nolen (sv) : fallback;
126} 127}
127 128
128noinline IV 129ecb_noinline IV
129random_map_params::get_iv (const char *option, IV fallback) const 130random_map_params::get_iv (const char *option, IV fallback) const
130{ 131{
131 SV *sv = opt_sv (option); 132 SV *sv = opt_sv (option);
132 return sv ? SvIV (sv) : fallback; 133 return sv ? SvIV (sv) : fallback;
133} 134}
134 135
135noinline UV 136ecb_noinline UV
136random_map_params::get_uv (const char *option, UV fallback) const 137random_map_params::get_uv (const char *option, UV fallback) const
137{ 138{
138 SV *sv = opt_sv (option); 139 SV *sv = opt_sv (option);
139 return sv ? SvUV (sv) : fallback; 140 return sv ? SvUV (sv) : fallback;
140} 141}
141 142
142noinline NV 143ecb_noinline NV
143random_map_params::get_nv (const char *option, NV fallback) const 144random_map_params::get_nv (const char *option, NV fallback) const
144{ 145{
145 SV *sv = opt_sv (option); 146 SV *sv = opt_sv (option);
146 return sv ? SvNV (sv) : fallback; 147 return sv ? SvNV (sv) : fallback;
147} 148}
148 149
149noinline void 150ecb_noinline void
150random_map_params::set (const char *option, SV *value) const 151random_map_params::set (const char *option, SV *value) const
151{ 152{
152 int len = strlen (option); 153 int len = strlen (option);
153 154
154 if (value) 155 if (value)
155 hv_store (hv, option, len, value, 0); 156 hv_store (hv, option, len, value, 0);
156 else 157 else
157 hv_delete (hv, option, len, G_DISCARD); 158 hv_delete (hv, option, len, G_DISCARD);
158} 159}
159 160
160noinline void 161ecb_noinline void
161random_map_params::set (const char *option, const_utf8_string value) const 162random_map_params::set (const char *option, const_utf8_string value) const
162{ 163{
163 set (option, value && *value ? newSVpvn_utf8 (value, strlen (value), 1) : 0); 164 set (option, value && *value ? newSVpvn_utf8 (value, strlen (value), 1) : 0);
164} 165}
165 166

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines