… | |
… | |
242 | change_attr_value (living *stats, int attr, sint8 value) |
242 | change_attr_value (living *stats, int attr, sint8 value) |
243 | { |
243 | { |
244 | stats->stat (attr) += value; |
244 | stats->stat (attr) += value; |
245 | } |
245 | } |
246 | |
246 | |
247 | sint8 & |
|
|
248 | living::stat (int index) |
|
|
249 | { |
|
|
250 | switch (index) |
|
|
251 | { |
|
|
252 | case STR: return Str; |
|
|
253 | case DEX: return Dex; |
|
|
254 | case CON: return Con; |
|
|
255 | case INT: return Int; |
|
|
256 | case WIS: return Wis; |
|
|
257 | case POW: return Pow; |
|
|
258 | case CHA: return Cha; |
|
|
259 | } |
|
|
260 | |
|
|
261 | LOG (llevError | logBacktrace, "living.stat() called with out-of-range stat index"); |
|
|
262 | static sint8 dummy; |
|
|
263 | return dummy; |
|
|
264 | } |
|
|
265 | |
|
|
266 | sint8 |
|
|
267 | living::stat (int index) const |
|
|
268 | { |
|
|
269 | switch (index) |
|
|
270 | { |
|
|
271 | case STR: return Str; |
|
|
272 | case DEX: return Dex; |
|
|
273 | case CON: return Con; |
|
|
274 | case INT: return Int; |
|
|
275 | case WIS: return Wis; |
|
|
276 | case POW: return Pow; |
|
|
277 | case CHA: return Cha; |
|
|
278 | } |
|
|
279 | |
|
|
280 | LOG (llevError | logBacktrace, "living.stat() called with out-of-range stat index"); |
|
|
281 | static sint8 dummy; |
|
|
282 | return dummy; |
|
|
283 | } |
|
|
284 | |
|
|
285 | /* |
247 | /* |
286 | * Ensures that all stats (str/dex/con/wis/cha/int) are within the |
248 | * Ensures that all stats (str/dex/con/wis/cha/int) are within the |
287 | * 1-30 stat limit. |
249 | * 1-30 stat limit. |
288 | */ |
250 | */ |
289 | void |
251 | void |