2010-08-08 10:06:34 +02:00
|
|
|
/*
|
2015-01-30 22:10:29 +01:00
|
|
|
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
2015-01-30 20:37:14 +01:00
|
|
|
Katja Zedel <katze@felidae.kn-bremen.de
|
|
|
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <platform.h>
|
|
|
|
#include <kernel/config.h>
|
|
|
|
#include "equipment.h"
|
|
|
|
|
|
|
|
/* kernel includes */
|
2018-05-11 21:30:26 +02:00
|
|
|
#include "callbacks.h"
|
2012-05-25 08:50:27 +02:00
|
|
|
#include "faction.h"
|
2018-05-11 21:30:26 +02:00
|
|
|
#include "item.h"
|
2010-08-08 10:06:34 +02:00
|
|
|
#include "race.h"
|
2016-09-24 17:29:55 +02:00
|
|
|
#include "spell.h"
|
2018-05-11 21:30:26 +02:00
|
|
|
#include "unit.h"
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
/* util includes */
|
2017-01-26 17:41:21 +01:00
|
|
|
#include <selist.h>
|
2017-09-08 22:24:17 +02:00
|
|
|
#include <critbit.h>
|
2017-09-17 20:42:43 +02:00
|
|
|
#include <util/log.h>
|
2010-08-08 10:06:34 +02:00
|
|
|
#include <util/rand.h>
|
|
|
|
#include <util/rng.h>
|
2017-12-28 18:29:40 +01:00
|
|
|
#include <util/strings.h>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
/* libc includes */
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
2014-03-15 19:29:11 +01:00
|
|
|
#include <stdlib.h>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2018-05-11 21:30:26 +02:00
|
|
|
bool equip_unit(struct unit *u, const char *eqname)
|
2010-08-08 10:06:34 +02:00
|
|
|
{
|
2018-05-11 21:30:26 +02:00
|
|
|
return equip_unit_mask(u, eqname, EQUIP_ALL);
|
2010-08-08 10:06:34 +02:00
|
|
|
}
|
|
|
|
|
2018-05-11 21:30:26 +02:00
|
|
|
bool equip_unit_mask(struct unit *u, const char *eqname, int mask)
|
2010-08-08 10:06:34 +02:00
|
|
|
{
|
2018-05-11 21:30:26 +02:00
|
|
|
if (callbacks.equip_unit) {
|
|
|
|
return callbacks.equip_unit(u, eqname, mask);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|