"SPIONIERE bringt durchwegs falsche Resulate"

Falsche Schleife. Bei der Gelegenheit Spionage nach spy.c verlegt, und das ganze wegen der Sprueche die es brauchen in ein anderes Directory verschoben, auch wenn ich eigentlich meine, da gehoert es nicht hin...

Jamfile-Anpassungen kommen gleich.
This commit is contained in:
Enno Rehling 2007-02-03 14:09:03 +00:00
parent 39e348db1d
commit 91e7829b3c
10 changed files with 174 additions and 171 deletions

View File

@ -335,9 +335,6 @@
<File
RelativePath=".\report.c">
</File>
<File
RelativePath=".\spy.c">
</File>
<File
RelativePath=".\study.c">
</File>

View File

@ -391,6 +391,9 @@
<File
RelativePath=".\spell.c">
</File>
<File
RelativePath=".\spy.c">
</File>
<File
RelativePath=".\teleport.c">
</File>

View File

@ -97,7 +97,7 @@ groupid(const struct group * g, const struct faction * f)
return buf;
}
static const char *
const char *
report_kampfstatus(const unit * u, const struct locale * lang)
{
static char fsbuf[64];
@ -802,146 +802,6 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden
lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-')));
}
/* in spy steht der Unterschied zwischen Wahrnehmung des Opfers und
* Spionage des Spions */
void
spy_message(int spy, unit *u, unit *target)
{
const char *c;
produceexp(u, SK_SPY, u->number);
/* Infos:
* - Kampfstatus
* - verborgene Gegenstände: Amulette, Ringe, Phiolen, Geld
* - Partei
* - Talentinfo
* - Zaubersprüche
* - Zauberwirkungen
*/
/* mit spy=100 (magische Spionage) soll alles herausgefunden werden */
buf[0]='\0';
if (spy > 99){
/* magische Spionage */
/* Zauberwirkungen */
}
if (spy > 20){
sc_mage * m = get_mage(target);
/* bei Magiern Zaubersprüche und Magiegebiet */
if (m) {
spell_list *slist = m->spells;
boolean first = true;
scat("Magiegebiet: ");
scat(LOC(u->faction->locale, magietypen[find_magetype(target)]));
scat(", Sprüche: ");
for (;slist; slist=slist->next) {
spell * sp = slist->data;
if (first) {
first = false;
} else {
scat(", ");
}
scat(spell_name(sp, u->faction->locale));
}
if (first) scat("Keine");
scat(". ");
}
}
if (spy > 6){
/* wahre Partei */
scat("Partei '");
scat(factionname(target->faction));
scat("'. ");
} else {
/* ist die Einheit in Spionage nicht gut genug, glaubt sie die
* Parteitarnung */
faction *fv = visible_faction(u->faction,target);
if (fv != target->faction){
scat("Partei '");
scat(factionname(fv));
scat("'. ");
} else if (!fval(target, UFL_PARTEITARNUNG)){
scat("Partei '");
scat(factionname(target->faction));
scat("'. ");
}
}
if (spy > 0){
int first = 1;
int found = 0;
skill * sv;
scat("Talente: ");
for (sv = u->skills;sv!=u->skills+u->skill_size;++sv) {
if (sv->level>0) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillname(sv->id, u->faction->locale));
scat(" ");
icat(eff_skill(target, sv->id, target->region));
}
if (found == 0) {
scat("Keine");
}
scat(". ");
}
scat("Im Gepäck sind");
{
boolean first = true;
int found = 0;
item * itm;
for (itm=target->items;itm;itm=itm->next) {
if (itm->number>0) {
resource_type * rtype = itm->type->rtype;
++found;
if (first) {
first = false;
scat(": ");
} else {
scat(", ");
}
if (itm->number == 1) {
scat("1 ");
scat(locale_string(u->faction->locale, resourcename(rtype, 0)));
} else {
icat(itm->number);
scat(" ");
scat(locale_string(u->faction->locale, resourcename(rtype, NMF_PLURAL)));
}
}
}
if (found == 0) {
scat(" keine verborgenen Gegenstände");
}
scat(". ");
}
}
/* spion ist gleich gut wie Wahrnehmung Opfer */
/* spion ist schlechter als Wahrnehmung Opfer */
{ /* immer */
scat("Kampfstatus: ");
scat(report_kampfstatus(target, u->faction->locale));
c = locale_string(u->faction->locale, hp_status(target));
if (c && strlen(c))
sprintf(buf, "%s (%s)", buf, c);
scat(".");
}
ADDMSG(&u->faction->msgs, msg_message("spyreport",
"spy target report", u, target, strdup(buf)));
}
const struct unit *
ucansee(const struct faction *f, const struct unit *u, const struct unit *x)
{

View File

@ -102,6 +102,7 @@ extern int bufunit(const struct faction * f, const struct unit * u, int indent,
extern const char * reportpath(void);
extern const char * trailinto(const struct region * r, const struct locale * lang);
extern const char * report_kampfstatus(const struct unit * u, const struct locale * lang);
extern void reports_init(void);

View File

@ -23,8 +23,6 @@
#include "eressea.h"
#include "spy.h"
#include "economy.h"
/* kernel includes */
#include <kernel/build.h>
#include <kernel/reports.h>
@ -58,6 +56,145 @@
#include <attributes/otherfaction.h>
/* in spy steht der Unterschied zwischen Wahrnehmung des Opfers und
* Spionage des Spions */
void
spy_message(int spy, const unit *u, const unit *target)
{
const char *c;
/* Infos:
* - Kampfstatus
* - verborgene Gegenstände: Amulette, Ringe, Phiolen, Geld
* - Partei
* - Talentinfo
* - Zaubersprüche
* - Zauberwirkungen
*/
/* mit spy=100 (magische Spionage) soll alles herausgefunden werden */
buf[0]='\0';
if (spy > 99){
/* magische Spionage */
/* Zauberwirkungen */
}
if (spy > 20){
sc_mage * m = get_mage(target);
/* bei Magiern Zaubersprüche und Magiegebiet */
if (m) {
spell_list *slist = m->spells;
boolean first = true;
scat("Magiegebiet: ");
scat(LOC(u->faction->locale, magietypen[find_magetype(target)]));
scat(", Sprüche: ");
for (;slist; slist=slist->next) {
spell * sp = slist->data;
if (first) {
first = false;
} else {
scat(", ");
}
scat(spell_name(sp, u->faction->locale));
}
if (first) scat("Keine");
scat(". ");
}
}
if (spy > 6){
/* wahre Partei */
scat("Partei '");
scat(factionname(target->faction));
scat("'. ");
} else {
/* ist die Einheit in Spionage nicht gut genug, glaubt sie die
* Parteitarnung */
faction *fv = visible_faction(u->faction,target);
if (fv != target->faction){
scat("Partei '");
scat(factionname(fv));
scat("'. ");
} else if (!fval(target, UFL_PARTEITARNUNG)){
scat("Partei '");
scat(factionname(target->faction));
scat("'. ");
}
}
if (spy > 0){
int first = 1;
int found = 0;
skill * sv;
scat("Talente: ");
for (sv = target->skills;sv!=target->skills+target->skill_size;++sv) {
if (sv->level>0) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillname(sv->id, u->faction->locale));
scat(" ");
icat(eff_skill(target, sv->id, target->region));
}
if (found == 0) {
scat("Keine");
}
scat(". ");
}
scat("Im Gepäck sind");
{
boolean first = true;
int found = 0;
item * itm;
for (itm=target->items;itm;itm=itm->next) {
if (itm->number>0) {
resource_type * rtype = itm->type->rtype;
++found;
if (first) {
first = false;
scat(": ");
} else {
scat(", ");
}
if (itm->number == 1) {
scat("1 ");
scat(locale_string(u->faction->locale, resourcename(rtype, 0)));
} else {
icat(itm->number);
scat(" ");
scat(locale_string(u->faction->locale, resourcename(rtype, NMF_PLURAL)));
}
}
}
if (found == 0) {
scat(" keine verborgenen Gegenstände");
}
scat(". ");
}
}
/* spion ist gleich gut wie Wahrnehmung Opfer */
/* spion ist schlechter als Wahrnehmung Opfer */
{ /* immer */
scat("Kampfstatus: ");
scat(report_kampfstatus(target, u->faction->locale));
c = locale_string(u->faction->locale, hp_status(target));
if (c && strlen(c))
sprintf(buf, "%s (%s)", buf, c);
scat(".");
}
ADDMSG(&u->faction->msgs, msg_message("spyreport",
"spy target report", u, target, strdup(buf)));
}
int
spy_cmd(unit * u, struct order * ord)
{
@ -89,6 +226,7 @@ spy_cmd(unit * u, struct order * ord)
spychance = 0.1 + max(spy*0.05, 0.0);
if (chance(spychance)) {
produceexp(u, SK_SPY, u->number);
spy_message(spy, u, target);
} else {
ADDMSG(&u->faction->msgs, msg_message("spyfail", "spy target", u, target));

View File

@ -33,7 +33,7 @@ extern int setwere_cmd(struct unit * u, struct order * ord);
extern int setstealth_cmd(struct unit * u, struct order * ord);
extern int spy_cmd(struct unit * u, struct order * ord);
extern int sabotage_cmd(struct unit * u, struct order * ord);
extern void spy_message(int spy, struct unit *u, struct unit *target);
extern void spy_message(int spy, const struct unit *u, const struct unit *target);
#define OCEAN_SWIMMER_CHANCE 0.1
#define CANAL_SWIMMER_CHANCE 0.9

View File

@ -16,16 +16,16 @@
#include "buildingcurse.h"
/* kernel includes */
#include <message.h>
#include <nrmessage.h>
#include <objtypes.h>
#include <building.h>
#include <ship.h>
#include <curse.h>
#include <kernel/message.h>
#include <kernel/objtypes.h>
#include <kernel/building.h>
#include <kernel/ship.h>
#include <kernel/curse.h>
/* util includes */
#include <base36.h>
#include <functions.h>
#include <util/nrmessage.h>
#include <util/base36.h>
#include <util/functions.h>
/* libc includes */
#include <string.h>

View File

@ -16,19 +16,19 @@
#include "unitcurse.h"
/* kernel includes */
#include <message.h>
#include <nrmessage.h>
#include <race.h>
#include <skill.h>
#include <unit.h>
#include <faction.h>
#include <objtypes.h>
#include <curse.h>
#include <kernel/message.h>
#include <kernel/race.h>
#include <kernel/skill.h>
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <kernel/objtypes.h>
#include <kernel/curse.h>
/* util includes */
#include <message.h>
#include <base36.h>
#include <functions.h>
#include <util/nrmessage.h>
#include <util/message.h>
#include <util/base36.h>
#include <util/functions.h>
/* libc includes */
#include <string.h>

View File

@ -145,8 +145,10 @@ typedef struct stat stat_type;
# define HAVE_SNPRINTF
/* MSVC has _access, not access */
#ifndef access
# define access(f, m) _access(f, m)
# define HAVE_ACCESS
#endif
#define HAVE_ACCESS
/* MSVC has _stat, not stat */
# define HAVE_STAT
@ -229,10 +231,12 @@ extern char * strdup(const char *s);
/**** ****
** The Eressea boolean type **
**** ****/
#ifdef __cplusplus
typedef int boolean; /* not bool! wrong size. */
#if defined(WIN32) && defined(USE_MYSQL)
typedef unsigned char boolean;
#else
typedef int boolean;
typedef int boolean; /* not bool! wrong size. */
#endif
#ifndef __cplusplus
# define false ((boolean)0)
# define true ((boolean)!false)
#endif

View File

@ -175,7 +175,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="luabind.lib lua50.lib libxml2.lib"
AdditionalDependencies="luabind.lib lua50.lib libxml2.lib mysqlclient.lib zlib.lib"
OutputFile=".\Debug/eressea-lua.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"