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,59 +597,59 @@ 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;
|
||||||
|
|
||||||
|
bufp += strlcpy(bufp, ", ", siz);
|
||||||
|
|
||||||
pbuf += strlcpy(pbuf, ", ", sizeof(buf));
|
if (!*dh) {
|
||||||
|
bufp += strlcpy(bufp, LOC(lang, "nr_skills"), siz-(bufp-buffer));
|
||||||
if (!*dh) {
|
bufp += strlcpy(bufp, ": ", sizeof(buf)-(bufp-buf));
|
||||||
pbuf += strlcpy(pbuf, LOC(lang, "nr_skills"), sizeof(buf)-(bufp-buf));
|
*dh = 1;
|
||||||
pbuf += strlcpy(pbuf, ": ", sizeof(buf)-(bufp-buf));
|
}
|
||||||
*dh = 1;
|
bufp += strlcpy(bufp, skillname(sk, lang), siz-(bufp-buffer));
|
||||||
}
|
strcpy(bufp++, " ");
|
||||||
pbuf += strlcpy(pbuf, skillname(sk, lang), sizeof(buf)-(bufp-buf));
|
|
||||||
strcpy(pbuf++, " ");
|
if (sk == SK_MAGIC){
|
||||||
|
if (find_magetype(u) != M_GRAU){
|
||||||
if (sk == SK_MAGIC){
|
bufp += strlcpy(bufp, LOC(lang, mkname("school", magietypen[find_magetype(u)])), siz-(bufp-buffer));
|
||||||
if (find_magetype(u) != M_GRAU){
|
strcpy(bufp++, " ");
|
||||||
pbuf += strlcpy(pbuf, LOC(lang, mkname("school", magietypen[find_magetype(u)])), sizeof(buf)-(bufp-buf));
|
}
|
||||||
strcpy(pbuf++, " ");
|
}
|
||||||
}
|
|
||||||
}
|
if (sk == SK_STEALTH) {
|
||||||
|
i = u_geteffstealth(u);
|
||||||
if (sk == SK_STEALTH) {
|
if(i>=0) {
|
||||||
i = u_geteffstealth(u);
|
bufp += sprintf(bufp, "%d/", i);
|
||||||
if(i>=0) {
|
}
|
||||||
pbuf += sprintf(pbuf, "%d/", i);
|
}
|
||||||
}
|
|
||||||
}
|
effsk = effskill(u, sk);
|
||||||
|
bufp += sprintf(bufp, "%d", effsk);
|
||||||
effsk = effskill(u, sk);
|
|
||||||
pbuf += sprintf(pbuf, "%d", effsk);
|
if(u->faction->options & Pow(O_SHOWSKCHANGE)) {
|
||||||
|
skill *skill = get_skill(u, sk);
|
||||||
if(u->faction->options & Pow(O_SHOWSKCHANGE)) {
|
int oldeff = 0;
|
||||||
skill *skill = get_skill(u, sk);
|
int diff;
|
||||||
int oldeff = 0;
|
|
||||||
int diff;
|
if (skill->old > 0) {
|
||||||
|
oldeff = skill->old + get_modifier(u, sk, skill->old, u->region, false);
|
||||||
if (skill->old > 0) {
|
}
|
||||||
oldeff = skill->old + get_modifier(u, sk, skill->old, u->region, false);
|
|
||||||
}
|
oldeff = max(0, oldeff);
|
||||||
|
diff = effsk - oldeff;
|
||||||
oldeff = max(0, oldeff);
|
|
||||||
diff = effsk - oldeff;
|
if(diff != 0) {
|
||||||
|
bufp += sprintf(bufp, " (%s%d)", (diff>0)?"+":"", diff);
|
||||||
if(diff != 0) {
|
}
|
||||||
pbuf += sprintf(pbuf, " (%s%d)", (diff>0)?"+":"", diff);
|
}
|
||||||
}
|
return bufp-buffer;
|
||||||
}
|
|
||||||
return pbuf-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
|
||||||
|
|
12
src/config.h
12
src/config.h
|
@ -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
|
||||||
|
@ -148,8 +153,8 @@ typedef struct stat stat_type;
|
||||||
# define R_OK 4
|
# define R_OK 4
|
||||||
# define HAVE__MKDIR_WITHOUT_PERMISSION
|
# define HAVE__MKDIR_WITHOUT_PERMISSION
|
||||||
|
|
||||||
#define HAVE_INLINE
|
# define HAVE_INLINE
|
||||||
#define INLINE_FUNCTION __inline
|
# define INLINE_FUNCTION __inline
|
||||||
|
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
# define HAVE_SNPRINTF
|
# define HAVE_SNPRINTF
|
||||||
|
@ -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