forked from github/server
deprecate report_kampfstatus and implement a replacement function.
This commit is contained in:
parent
61cee2606b
commit
e23a7fc87d
7
s/build
7
s/build
|
@ -4,7 +4,6 @@ while [ ! -d $ROOT/.git ]; do
|
|||
ROOT=`dirname $ROOT`
|
||||
done
|
||||
|
||||
[ -z "$CC" ] && CC=clang
|
||||
[ -z "$BUILD" ] && BUILD=Debug
|
||||
|
||||
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
|
||||
|
@ -14,11 +13,15 @@ JOBS=`distcc -j`
|
|||
if [ -z "$JOBS" ] ; then
|
||||
JOBS=1
|
||||
elif [ $JOBS -gt 1 ] ; then
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
CC="$DISTCC $CC"
|
||||
MAKEOPTS=-j$JOBS
|
||||
fi
|
||||
fi
|
||||
echo "Building with CC=$CC and $JOBS jobs"
|
||||
echo "Building with $JOBS jobs"
|
||||
|
||||
if [ ! -d $ROOT/$BUILD ]; then
|
||||
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
|
||||
|
|
|
@ -10,7 +10,7 @@ done
|
|||
|
||||
[ -z $BUILD ] && BUILD=Debug
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
|
|
|
@ -11,6 +11,7 @@ done
|
|||
DEST=$(dirname $ROOT)/server
|
||||
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
|
|
|
@ -120,29 +120,36 @@ const char *combatstatus[] = {
|
|||
"status_avoid", "status_flee"
|
||||
};
|
||||
|
||||
const char *report_kampfstatus(const unit * u, const struct locale *lang)
|
||||
size_t report_status(const unit * u, const struct locale *lang, char *fsbuf, size_t buflen)
|
||||
{
|
||||
static char fsbuf[64]; // FIXME: static return value
|
||||
const char * status = LOC(lang, combatstatus[u->status]);
|
||||
size_t len = 0;
|
||||
|
||||
if (!status) {
|
||||
const char *lname = locale_name(lang);
|
||||
struct locale *wloc = get_or_create_locale(lname);
|
||||
log_error("no translation for combat status %s in %s", combatstatus[u->status], lname);
|
||||
locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]);
|
||||
strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf));
|
||||
len = strlcpy(fsbuf, combatstatus[u->status], buflen);
|
||||
}
|
||||
else {
|
||||
strlcpy(fsbuf, status, sizeof(fsbuf));
|
||||
len = strlcpy(fsbuf, status, buflen);
|
||||
}
|
||||
if (fval(u, UFL_NOAID)) {
|
||||
strcat(fsbuf, ", ");
|
||||
strcat(fsbuf, LOC(lang, "status_noaid"));
|
||||
len += strlcat(fsbuf+len, ", ", buflen-len);
|
||||
len += strlcat(fsbuf+len, LOC(lang, "status_noaid"), buflen-len);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
const char * report_kampfstatus(const unit * u, const struct locale *lang) {
|
||||
static char fsbuf[64]; // FIXME: static variable.
|
||||
report_status(u, lang, fsbuf, sizeof(fsbuf));
|
||||
return fsbuf;
|
||||
}
|
||||
|
||||
|
||||
const char *hp_status(const unit * u)
|
||||
{
|
||||
double p;
|
||||
|
@ -564,6 +571,7 @@ size_t size)
|
|||
const char *c = hp_status(u);
|
||||
c = c ? LOC(f->locale, c) : 0;
|
||||
bufp = STRLCPY(bufp, ", ", size);
|
||||
// FIXME: use report_status
|
||||
bufp = STRLCPY(bufp, report_kampfstatus(u, f->locale), size);
|
||||
if (c || fval(u, UFL_HUNGER)) {
|
||||
bufp = STRLCPY(bufp, " (", size);
|
||||
|
|
|
@ -85,8 +85,10 @@ extern "C" {
|
|||
|
||||
const char *trailinto(const struct region *r,
|
||||
const struct locale *lang);
|
||||
size_t report_status(const struct unit *u,
|
||||
const struct locale *lang, char *buf, size_t siz);
|
||||
const char *report_kampfstatus(const struct unit *u,
|
||||
const struct locale *lang);
|
||||
const struct locale *lang); // FIXME: kill this (static variable)
|
||||
|
||||
void register_reports(void);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
* Spionage des Spions */
|
||||
void spy_message(int spy, const unit * u, const unit * target)
|
||||
{
|
||||
const char *str = report_kampfstatus(target, u->faction->locale);
|
||||
const char *str = report_kampfstatus(target, u->faction->locale); // FIXME: use report_status instead
|
||||
|
||||
ADDMSG(&u->faction->msgs, msg_message("spyreport", "spy target status", u,
|
||||
target, str));
|
||||
|
|
Loading…
Reference in New Issue