forked from github/server
bugfixes to make things compile on linux
This commit is contained in:
parent
2e9e7f1e23
commit
8656d93555
|
@ -302,7 +302,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
|
||||||
dh = 0;
|
dh = 0;
|
||||||
if (u->faction == f || telepath_see) {
|
if (u->faction == f || telepath_see) {
|
||||||
for (sk = 0; sk != MAXSKILLS; sk++) {
|
for (sk = 0; sk != MAXSKILLS; sk++) {
|
||||||
bufp += spskill(bufp, f->locale, u, sk, &dh, 1);
|
bufp += spskill(bufp, sizeof(buf)-(bufp-buf), f->locale, u, sk, &dh, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,41 +597,41 @@ bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days)
|
spskill(char * buffer, size_t siz, const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days)
|
||||||
{
|
{
|
||||||
char * pbuf = buffer;
|
char * bufp = buffer;
|
||||||
int i, effsk;
|
int i, effsk;
|
||||||
|
|
||||||
if (!u->number) return 0;
|
if (!u->number) return 0;
|
||||||
|
|
||||||
if (!has_skill(u, sk)) return 0;
|
if (!has_skill(u, sk)) return 0;
|
||||||
|
|
||||||
pbuf += strlcpy(pbuf, ", ", sizeof(buf));
|
bufp += strlcpy(bufp, ", ", siz);
|
||||||
|
|
||||||
if (!*dh) {
|
if (!*dh) {
|
||||||
pbuf += strlcpy(pbuf, LOC(lang, "nr_skills"), sizeof(buf)-(bufp-buf));
|
bufp += strlcpy(bufp, LOC(lang, "nr_skills"), siz-(bufp-buffer));
|
||||||
pbuf += strlcpy(pbuf, ": ", sizeof(buf)-(bufp-buf));
|
bufp += strlcpy(bufp, ": ", sizeof(buf)-(bufp-buf));
|
||||||
*dh = 1;
|
*dh = 1;
|
||||||
}
|
}
|
||||||
pbuf += strlcpy(pbuf, skillname(sk, lang), sizeof(buf)-(bufp-buf));
|
bufp += strlcpy(bufp, skillname(sk, lang), siz-(bufp-buffer));
|
||||||
strcpy(pbuf++, " ");
|
strcpy(bufp++, " ");
|
||||||
|
|
||||||
if (sk == SK_MAGIC){
|
if (sk == SK_MAGIC){
|
||||||
if (find_magetype(u) != M_GRAU){
|
if (find_magetype(u) != M_GRAU){
|
||||||
pbuf += strlcpy(pbuf, LOC(lang, mkname("school", magietypen[find_magetype(u)])), sizeof(buf)-(bufp-buf));
|
bufp += strlcpy(bufp, LOC(lang, mkname("school", magietypen[find_magetype(u)])), siz-(bufp-buffer));
|
||||||
strcpy(pbuf++, " ");
|
strcpy(bufp++, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sk == SK_STEALTH) {
|
if (sk == SK_STEALTH) {
|
||||||
i = u_geteffstealth(u);
|
i = u_geteffstealth(u);
|
||||||
if(i>=0) {
|
if(i>=0) {
|
||||||
pbuf += sprintf(pbuf, "%d/", i);
|
bufp += sprintf(bufp, "%d/", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
effsk = effskill(u, sk);
|
effsk = effskill(u, sk);
|
||||||
pbuf += sprintf(pbuf, "%d", effsk);
|
bufp += sprintf(bufp, "%d", effsk);
|
||||||
|
|
||||||
if(u->faction->options & Pow(O_SHOWSKCHANGE)) {
|
if(u->faction->options & Pow(O_SHOWSKCHANGE)) {
|
||||||
skill *skill = get_skill(u, sk);
|
skill *skill = get_skill(u, sk);
|
||||||
|
@ -646,10 +646,10 @@ spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_
|
||||||
diff = effsk - oldeff;
|
diff = effsk - oldeff;
|
||||||
|
|
||||||
if(diff != 0) {
|
if(diff != 0) {
|
||||||
pbuf += sprintf(pbuf, " (%s%d)", (diff>0)?"+":"", diff);
|
bufp += sprintf(bufp, " (%s%d)", (diff>0)?"+":"", diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pbuf-buffer;
|
return bufp-buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern int read_datenames(const char *filename);
|
||||||
void sparagraph(struct strlist ** SP, const char *s, int indent, char mark);
|
void sparagraph(struct strlist ** SP, const char *s, int indent, char mark);
|
||||||
void lparagraph(struct strlist ** SP, char *s, int indent, char mark);
|
void lparagraph(struct strlist ** SP, char *s, int indent, char mark);
|
||||||
const char *hp_status(const struct unit * u);
|
const char *hp_status(const struct unit * u);
|
||||||
extern size_t spskill(char * pbuf, const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days); /* mapper */
|
extern size_t spskill(char * pbuf, size_t siz, const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days); /* mapper */
|
||||||
extern void spunit(struct strlist ** SP, const struct faction * f, const struct unit * u, int indent, int mode);
|
extern void spunit(struct strlist ** SP, const struct faction * f, const struct unit * u, int indent, int mode);
|
||||||
|
|
||||||
extern int reports(void);
|
extern int reports(void);
|
||||||
|
|
|
@ -12,7 +12,6 @@ SOURCES =
|
||||||
#<dl>malloc.c
|
#<dl>malloc.c
|
||||||
attrib.c
|
attrib.c
|
||||||
base36.c
|
base36.c
|
||||||
bsdstring.c
|
|
||||||
command.c
|
command.c
|
||||||
crmessage.c
|
crmessage.c
|
||||||
cvector.c
|
cvector.c
|
||||||
|
@ -38,4 +37,8 @@ SOURCES =
|
||||||
xml.c
|
xml.c
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if $(NO_INLINE) {
|
||||||
|
SOURCES += bsdstring.c ;
|
||||||
|
}
|
||||||
|
|
||||||
Library util : $(SOURCES) ;
|
Library util : $(SOURCES) ;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "bsdstring.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "bsdstring.h"
|
||||||
|
|
||||||
#if !defined(HAVE_STRLCPY)
|
#if !defined(HAVE_STRLCPY)
|
||||||
INLINE_FUNCTION size_t
|
INLINE_FUNCTION size_t
|
||||||
|
|
|
@ -46,6 +46,11 @@ extern "C" {
|
||||||
# include <mpatrol.h>
|
# include <mpatrol.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __GNUC__
|
||||||
|
# define HAVE_INLINE
|
||||||
|
# define INLINE_FUNCTION __inline
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DMALLOC
|
#ifdef DMALLOC
|
||||||
# ifndef MALLOCDBG
|
# ifndef MALLOCDBG
|
||||||
# define MALLOCDBG 1
|
# define MALLOCDBG 1
|
||||||
|
@ -245,6 +250,9 @@ extern char * strdup(const char *s);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INLINE_FUNCTION
|
||||||
|
# define INLINE_FUNCTION
|
||||||
|
#endif
|
||||||
/* this function must be implemented in a .o file */
|
/* this function must be implemented in a .o file */
|
||||||
extern char * strnzcpy(char * dst, const char *src, size_t len);
|
extern char * strnzcpy(char * dst, const char *src, size_t len);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -896,7 +896,7 @@ mapper_spunit(dbllist ** SP, unit * u, int indent)
|
||||||
|
|
||||||
dh = 0;
|
dh = 0;
|
||||||
for (sk = 0; sk != MAXSKILLS; sk++)
|
for (sk = 0; sk != MAXSKILLS; sk++)
|
||||||
spskill(buf, find_locale("de"), u, sk, &dh, 1);
|
spskill(buf, sizeof(buf), find_locale("de"), u, sk, &dh, 1);
|
||||||
dh = 0;
|
dh = 0;
|
||||||
|
|
||||||
for (itm = u->items;itm;itm=itm->next) {
|
for (itm = u->items;itm;itm=itm->next) {
|
||||||
|
|
Loading…
Reference in New Issue