Typecasts Gefixt.
Teilweise ausgebaut, teilweise zu deklarativen Casts geaendert bzw.
deklarative Casts hinzugefuegt.
Weiterhin ein paar call_other() auf this_object() ausgebaut.
Change-Id: I0c493914c41c53e884aaf80b01db600aeb6508e9
diff --git a/std/armour/wear.c b/std/armour/wear.c
index a870bd1..3615d43 100644
--- a/std/armour/wear.c
+++ b/std/armour/wear.c
@@ -47,7 +47,7 @@
foreach(object armour: armours)
{
- if (type==(armour->QueryProp(P_ARMOUR_TYPE)))
+ if (type==(({string})armour->QueryProp(P_ARMOUR_TYPE)))
{
// Ruestung vom gleichen Typ gefunden -> zurueckgeben
return armour;
@@ -75,14 +75,14 @@
object_name()));
}
- armours=(object*)PL->QueryProp(P_ARMOURS) - ({0});
+ armours=({object*})PL->QueryProp(P_ARMOURS) - ({0});
// Von jedem Ruestungstyp ausser AT_MISC kann man immer nur ein
// Teil tragen
if ( (type!=AT_MISC) && (res=TestType(armours)) && objectp(res)) {
msg(break_string(sprintf(
"Du traegst bereits %s als Schutz der Sorte %s.",
- res->name(WEN,1), type),78,
+ ({string})res->name(WEN,1), type),78,
(all?(Name(WER)+": "):0)), all);
return(-1);
}
@@ -91,7 +91,7 @@
// Ruestungstyp zu hohen Schutzwert koennen nicht angezogen werden
if ( (type==AT_ILLEGAL) || (QueryProp(P_AC)>VALID_ARMOUR_CLASS[type])) {
write("Ungueltiger Ruestungstyp, bitte Erzmagier verstaendigen.\n");
- "/p/daemon/ruestungen"->RegisterArmour();
+ ({void})"/p/daemon/ruestungen"->RegisterArmour();
return(-2);
}
@@ -99,7 +99,8 @@
// das gesetzte Limit verstossen, haben keine Wirkung bezueglich der
// Attribute. Dies gibt aber nur ne Meldung aus, angezogen werden darf sie
// trotzdem.
- if (mappingp(res=QueryProp(P_M_ATTR_MOD)) && PL->TestLimitViolation(res) ) {
+ if (mappingp(res=QueryProp(P_M_ATTR_MOD)) &&
+ ({int})PL->TestLimitViolation(res) ) {
write(break_string(sprintf(
"Irgendetwas an Deiner Ausruestung verhindert, dass Du Dich mit "
"%s so richtig wohl fuehlst.",name(WEM,1)),78,
@@ -114,16 +115,16 @@
protected void _informwear(int silent, int all) {
// Ruestungen koennen Resistenzen beeinflussen
- PL->AddResistanceModifier(QueryProp(P_RESISTANCE_STRENGTHS),
+ ({int})PL->AddResistanceModifier(QueryProp(P_RESISTANCE_STRENGTHS),
QueryProp(P_ARMOUR_TYPE));
// Ruestungen koennen Attribute aendern/blockieren. Also muessen diese
// nach dem Anziehen aktualisiert werden
- PL->register_modifier(ME);
- PL->UpdateAttributes();
+ ({void})PL->register_modifier(ME);
+ ({void})PL->UpdateAttributes();
// P_TOTAL_AC im Traeger updaten (fuer Query()s)
- PL->QueryProp(P_TOTAL_AC);
+ ({int})PL->QueryProp(P_TOTAL_AC);
// Alle Ruestungen werden im awmaster registriert, sobald sie von
// einem Spieler gezueckt werden
@@ -160,15 +161,15 @@
protected void _informunwear(object worn_by, int silent, int all) {
mixed res;
// Gesetzte Resistenzen loeschen
- worn_by->RemoveResistanceModifier(res=QueryProp(P_ARMOUR_TYPE));
+ ({void})worn_by->RemoveResistanceModifier(res=QueryProp(P_ARMOUR_TYPE));
// Ruestungen koennen Attribute aendern/blockieren. Also muessen diese
// nach dem Ausziehen aktualisiert werden
- worn_by->deregister_modifiers(ME);
- worn_by->UpdateAttributes();
+ ({void})worn_by->deregister_modifiers(ME);
+ ({void})worn_by->UpdateAttributes();
// P_TOTAL_AC im Traeger updaten
- worn_by->QueryProp(P_TOTAL_AC);
+ ({int})worn_by->QueryProp(P_TOTAL_AC);
// die geerbte Funktion aus der Kleindung gibt noch meldungen aus und ruft
// Informunwear().
@@ -248,7 +249,7 @@
// P_TOTAL_AC im Traeger updaten, wenn vorhanden
if (objectp(w=QueryProp(P_WORN)))
- w->QueryProp(P_TOTAL_AC);
+ ({int})w->QueryProp(P_TOTAL_AC);
// Rueckgabewert: Durchgefuehrte Aenderung an P_DAMAGE
return new_dam;
diff --git a/std/clothing/moving.c b/std/clothing/moving.c
index 1c103b5..3dad966 100644
--- a/std/clothing/moving.c
+++ b/std/clothing/moving.c
@@ -26,7 +26,7 @@
if (objectp(QueryProp(P_WORN)))
DoUnwear(method & (M_SILENT|M_NOCHECK));
- if ((method&M_NOCHECK) || (!(object)QueryProp(P_WORN)))
+ if ((method&M_NOCHECK) || (!QueryProp(P_WORN)))
return ::move(dest, method);
return ME_CANT_BE_DROPPED;
@@ -37,7 +37,7 @@
if (objectp(QueryProp(P_WORN)))
DoUnwear(M_SILENT|M_NOCHECK);
- if (!(object)QueryProp(P_WORN))
+ if (!QueryProp(P_WORN))
return ::remove(silent);
// Ausziehen hat irgendwie nicht geklappt. :-(
return 0;
diff --git a/std/clothing/wear.c b/std/clothing/wear.c
index 1555b4e..69cb54f 100644
--- a/std/clothing/wear.c
+++ b/std/clothing/wear.c
@@ -112,7 +112,8 @@
(all?(Name(WER)+": "):0)));
}
if ( objectp(environment()) && objectp(environment(environment())) )
- tell_room(environment(environment()),break_string(PL->Name(WER)
+ tell_room(environment(environment()),break_string(
+ ({string})PL->Name(WER)
+ " zieht " + name(WEN,0) +" an.",78), ({PL}));
}
@@ -173,7 +174,8 @@
(all?(Name(WER)+": "):0)));
}
if ( objectp(environment(worn_by)) )
- tell_room(environment(worn_by), break_string(worn_by->Name(WER)
+ tell_room(environment(worn_by), break_string(
+ ({string})worn_by->Name(WER)
+ " zieht " + name(WEN,0) + " aus.",78), ({ worn_by }) );
}
@@ -223,7 +225,7 @@
// gleich auf eine WearFunc zurueckgreifen zu muessen.
// Die Auswertung erfolgt ueber den RestrictionChecker
if ((res=QueryProp(P_RESTRICTIONS)) && mappingp(res) &&
- (res=(string)"/std/restriction_checker"->check_restrictions(PL,res))
+ (res=({string})"/std/restriction_checker"->check_restrictions(PL,res))
&& stringp(res)) {
msg(break_string(res,78,(all?(Name(WER)+": "):0)),all);
return(-1);
@@ -231,7 +233,7 @@
// Ist eine WearFunc gesetzt, wird diese aufgerufen.
if (objectp(res=QueryProp(P_WEAR_FUNC)) &&
- !(res->WearFunc(ME, silent, environment()))) {
+ !(({int})res->WearFunc(ME, silent, environment()))) {
// Eine Meldung muss von der WearFunc ausgegeben werden
return(-2);
}
@@ -276,7 +278,7 @@
// Wenn Haende benutzt werden sollen, muss natuerlich auch getestet
// werden, ob das ueberhaupt geht
if (nh>0) {
- if (!(PL->UseHands(ME, nh))) {
+ if (!(({int})PL->UseHands(ME, nh))) {
// Schade, nicht genug Haende frei -> Meldung ausgeben
write(break_string("Du hast keine Hand mehr frei.",78,
(all?(Name(WER)+": "):0)));
@@ -291,16 +293,16 @@
// oder aehnliches...
if (!QueryProp(P_WEAPON_TYPE)) {
// Aktion noch setzen, Spieler hat ja was angezogen
- PL->SetProp(P_LAST_WEAR_ACTION,({WA_WEAR,time()}));
+ ({int*})PL->SetProp(P_LAST_WEAR_ACTION,({WA_WEAR,time()}));
// Im Kampf verliert der Spieler durch Kleidungswechsel eine Runde.
- if (PL->InFight()) {
- PL->SetProp(P_ATTACK_BUSY,1);
+ if (({int})PL->InFight()) {
+ ({int})PL->SetProp(P_ATTACK_BUSY,1);
}
}
// Eintragen in P_CLOTHING/P_ARMOURS
- PL->Wear(this_object());
+ ({int})PL->Wear(this_object());
- PL->SetProp(P_EQUIP_TIME,time());
+ ({int})PL->SetProp(P_EQUIP_TIME,time());
SetProp(P_WORN, PL);
SetProp(P_EQUIP_TIME,time());
@@ -329,7 +331,7 @@
// Im Falle von M_NOCHECK wird das Ergebnis allerdings ignoriert.
mixed res=QueryProp(P_REMOVE_FUNC);
if (objectp(res)
- && !res->RemoveFunc(ME,silent,worn_by)
+ && !({int})res->RemoveFunc(ME,silent,worn_by)
&& !(silent & M_NOCHECK)
)
{
@@ -408,14 +410,14 @@
return(!all);
// OK, alles klar, die Ruestung wird ausgezogen
- worn_by->Unwear(ME);
+ ({int})worn_by->Unwear(ME);
// Benutzte Haende wieder freigeben
if (nh>0) {
- worn_by->FreeHands(ME);
+ ({int})worn_by->FreeHands(ME);
}
- worn_by->SetProp(P_EQUIP_TIME, time());
+ ({int})worn_by->SetProp(P_EQUIP_TIME, time());
SetProp(P_WORN, 0);
// Flag noch setzen, Spieler hat ja was ausgezogen
@@ -424,9 +426,9 @@
if (PL && PL==worn_by && !QueryProp(P_WEAPON_TYPE)) {
//Behinderung beim Wechsel nur fuer Spieler
if (query_once_interactive(PL)) {
- PL->SetProp(P_LAST_WEAR_ACTION,({WA_UNWEAR,time()}));
- if (PL->InFight()) {
- PL->SetProp(P_ATTACK_BUSY,1);
+ ({int*})PL->SetProp(P_LAST_WEAR_ACTION,({WA_UNWEAR,time()}));
+ if (({int})PL->InFight()) {
+ ({int})PL->SetProp(P_ATTACK_BUSY,1);
}
}
}
@@ -453,8 +455,8 @@
}
// Vielleicht darf der Spieler ja gar nix mehr anziehen.
- if ((object)PL->InFight()) {
- last=(int*)PL->QueryProp(P_LAST_WEAR_ACTION);
+ if (({int})PL->InFight()) {
+ last=({int*})PL->QueryProp(P_LAST_WEAR_ACTION);
if (pointerp(last) && (last[0]==WA_UNWEAR) && ((time()-last[1])<2)) {
notify_fail("Du hast doch gerade erst etwas ausgezogen!\n"
"So schnell bist Du nicht!\n");
@@ -503,8 +505,8 @@
}
// Vielleicht darf der Spieler ja gar nichts mehr ausziehen.
- if ((object)PL->InFight()) {
- last=(int*)PL->QueryProp(P_LAST_WEAR_ACTION);
+ if (({int})PL->InFight()) {
+ last=({int*})PL->QueryProp(P_LAST_WEAR_ACTION);
if (pointerp(last) && (last[0]==WA_WEAR) && ((time()-last[1])<2)) {
notify_fail("Du hast doch gerade erst etwas angezogen!\n"
"So schnell bist Du nicht!\n");
diff --git a/std/npc/combat.c b/std/npc/combat.c
index 99f30a0..1e17201 100644
--- a/std/npc/combat.c
+++ b/std/npc/combat.c
@@ -277,7 +277,7 @@
for (i=sizeof(ind)-1;i>=0;i--) {
x=ind[i];
if ((z=m[x][ob->QueryProp(x)]) || (z=m[x][0])) {
- f=f+(float)z;
+ f=f+z;
n++;
}
}
diff --git a/std/room/pub.c b/std/room/pub.c
index b331452..cad1289 100644
--- a/std/room/pub.c
+++ b/std/room/pub.c
@@ -888,14 +888,14 @@
return 1;
}
- notify_fail((string)QueryProp(P_PUB_NOT_ON_MENU)||"So etwas gibt es hier nicht!\n");
+ notify_fail(QueryProp(P_PUB_NOT_ON_MENU)||"So etwas gibt es hier nicht!\n");
return search_what(what,PL,target);
}
int bestelle(string str)
{
- notify_fail((string)QueryProp(P_PUB_NOT_ON_MENU));
+ notify_fail(QueryProp(P_PUB_NOT_ON_MENU));
if ( !stringp(str) )
return 0;
diff --git a/std/spellbook.c b/std/spellbook.c
index 5c835f1..4b28a48 100644
--- a/std/spellbook.c
+++ b/std/spellbook.c
@@ -106,28 +106,28 @@
mixed no_attack;
int nomag;
- if (no_attack = (mixed)victim->QueryProp(P_NO_ATTACK)) {
+ if (no_attack = ({int|string})victim->QueryProp(P_NO_ATTACK)) {
if (stringp(no_attack))
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
no_attack,
MT_NOTIFICATION,
MA_FIGHT);
else
- caster->ReceiveMsg(
- victim->Name(WER,1)+" laesst sich nicht angreifen!",
+ ({int})caster->ReceiveMsg(
+ ({string})victim->Name(WER,1)+" laesst sich nicht angreifen!",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
- if (victim->QueryProp(P_GHOST)) {
- caster->ReceiveMsg(
- victim->Name(WER,1)+" ist ein Geist!",
+ if (({int})victim->QueryProp(P_GHOST)) {
+ ({int})caster->ReceiveMsg(
+ ({string})victim->Name(WER,1)+" ist ein Geist!",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
- damage=(damage*(int)caster->QuerySkillAttribute(SA_DAMAGE))/100;
+ damage=(damage*({int})caster->QuerySkillAttribute(SA_DAMAGE))/100;
// ggf. Loggen von PK-Versuchen und ggf. ausserdem Angriff abbrechen.
// BTW: Aufruf von InsertEnemy() gibt 0 zurueck, wenn der Gegner nicht
@@ -140,22 +140,22 @@
sprintf("Spellbook: %O, Spell: %O\n",
object_name(this_object()),
((mappingp(sinfo) && is_spell) ? sinfo[SP_NAME] : "")))
- && !caster->IsEnemy(victim)
- && !caster->InsertEnemy(victim)
+ && !({int})caster->IsEnemy(victim)
+ && !({int})caster->InsertEnemy(victim)
)
{
tell_object(ME, "Ein goettlicher Einfluss schuetzt Deinen Gegner.\n");
return 0;
}
- nomag=(int)victim->QueryProp(P_NOMAGIC);
+ nomag=({int})victim->QueryProp(P_NOMAGIC);
if ((sinfo[SI_NOMAGIC] < nomag) &&
- nomag*100 > random(100)*(int)caster->QuerySkillAttribute(SA_ENEMY_SAVE)) {
- printf("%s wehrt Deinen Zauber ab.\n", capitalize((string)victim->name(WER, 1)));
+ nomag*100 > random(100)*({int})caster->QuerySkillAttribute(SA_ENEMY_SAVE)) {
+ printf("%s wehrt Deinen Zauber ab.\n", capitalize(({string})victim->name(WER, 1)));
return 0;
}
else {
- return (int)victim->Defend(damage, dtypes, is_spell, caster);
+ return ({int})victim->Defend(damage, dtypes, is_spell, caster);
}
}
@@ -168,7 +168,7 @@
if (!si_spell) si_spell=sinfo[SI_SPELL];
// Wenn der Spieler in einem Team ist, die Teamreihen-Boni
// beruecksichtigen. Wenn nicht, eben nicht.
- if (!team=((object)caster->QueryProp(P_TEAM)))
+ if (!team=(({object})caster->QueryProp(P_TEAM)))
return TryAttackSpell(victim,
GetRandFValueO(SI_SKILLDAMAGE,sinfo,caster),
GetData(SI_SKILLDAMAGE_TYPE,sinfo,caster),
@@ -177,7 +177,7 @@
sinfo);
else
{
- row=(int)caster->PresentPosition();
+ row=({int})caster->PresentPosition();
return TryAttackSpell(victim,
GetRandFValueO(SI_SKILLDAMAGE,sinfo,caster)+
// Nur wenn SI_SKILLDAMAGE_BY_ROW ein mapping ist,
@@ -199,17 +199,17 @@
int cval,abil,res;
abil=sinfo[SI_SKILLABILITY];
- cval=(int)caster->UseSkill(SK_CASTING);
+ cval=({int})caster->UseSkill(SK_CASTING);
res=abil + (SMUL(abil,cval)) / MAX_ABILITY - random(MAX_ABILITY);
if (cval && res>MAX_ABILITY) // besonders gut gelungen?
- caster->LearnSkill(SK_CASTING,1+(res-MAX_ABILITY)/2000);
+ ({void})caster->LearnSkill(SK_CASTING,1+(res-MAX_ABILITY)/2000);
return res;
}
int
CanTrySpell(object caster, mapping sinfo) {
- if (caster->QueryProp(P_GHOST)) {
- caster->ReceiveMsg(
+ if (({int})caster->QueryProp(P_GHOST)) {
+ ({int})caster->ReceiveMsg(
"Als Geist kannst Du nicht zaubern.",
MT_NOTIFICATION,
MA_SPELL);
@@ -220,7 +220,7 @@
if (mappingp(rmap)
&& (res=check_restrictions(caster,rmap)))
{
- caster->ReceiveMsg(res, MT_NOTIFICATION|MSG_DONT_WRAP, MA_SPELL);
+ ({int})caster->ReceiveMsg(res, MT_NOTIFICATION|MSG_DONT_WRAP, MA_SPELL);
return 0;
}
return 1;
@@ -243,15 +243,15 @@
// Ich gehe davon aus, dass wir nie nie nie
// ein weiteres Attribut ins MG einfuegen.
// Wir berechnen den Mittelwert
- attval=((int)caster->QueryAttribute(A_INT)*attr[A_INT]+
- (int)caster->QueryAttribute(A_DEX)*attr[A_DEX]+
- (int)caster->QueryAttribute(A_STR)*attr[A_STR]+
- (int)caster->QueryAttribute(A_CON)*attr[A_CON])
+ attval=(({int})caster->QueryAttribute(A_INT)*attr[A_INT]+
+ ({int})caster->QueryAttribute(A_DEX)*attr[A_DEX]+
+ ({int})caster->QueryAttribute(A_STR)*attr[A_STR]+
+ ({int})caster->QueryAttribute(A_CON)*attr[A_CON])
/(attr[A_CON]+attr[A_INT]+attr[A_STR]+attr[A_DEX]);
} else {
- attval=(int)caster->QueryAttribute(A_INT);
+ attval=({int})caster->QueryAttribute(A_INT);
}
@@ -259,19 +259,19 @@
GetOffset(SI_SKILLLEARN,sinfo,caster));
if (!(diff=GetFValueO(SI_DIFFICULTY,sinfo,caster)))
diff=GetFValueO(SI_SPELLCOST,sinfo,caster);
- caster->LearnSkill(spell,val,diff);
+ ({void})caster->LearnSkill(spell,val,diff);
}
void
Erfolg(object caster, string spell, mapping sinfo) {
object env;
if(env=environment(caster))
- env->SpellInform(caster,spell,sinfo);
+ ({void})env->SpellInform(caster,spell,sinfo);
}
void
Misserfolg(object caster, string spell, mapping sinfo) {
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
"Der Zauberspruch ist missglueckt.\n"
"Du lernst aus Deinem Fehler.\n",
MT_NOTIFICATION|MSG_DONT_WRAP,
@@ -319,14 +319,14 @@
if (!CanTrySpell(caster, ski))
return 1;
- if (caster->QueryProp(P_SP) < (cost=GetFValueO(SI_SPELLCOST,ski,caster))) {
+ if (({int})caster->QueryProp(P_SP) < (cost=GetFValueO(SI_SPELLCOST,ski,caster))) {
if(txt=ski[SI_SP_LOW_MSG])
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
txt,
MT_NOTIFICATION,
MA_SPELL);
else
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
"Du hast zu wenig Zauberpunkte fuer diesen Spruch.",
MT_NOTIFICATION,
MA_SPELL);
@@ -339,9 +339,9 @@
// nicht leer ist, ist man zu erschoepft.
tmp = filter(ski[SI_X_SPELLFATIGUE],
function int (string key, int val)
- { return (int)caster->CheckSpellFatigue(key); } );
+ { return ({int})caster->CheckSpellFatigue(key); } );
if (sizeof(tmp)) {
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
ski[SI_TIME_MSG] ||
"Du bist noch zu erschoepft von Deinem letzten Spruch.",
MT_NOTIFICATION,
@@ -350,8 +350,8 @@
}
}
else {
- if (caster->CheckSpellFatigue()) {
- caster->ReceiveMsg(
+ if (({int})caster->CheckSpellFatigue()) {
+ ({int})caster->ReceiveMsg(
ski[SI_TIME_MSG] ||
"Du bist noch zu erschoepft von Deinem letzten Spruch.",
MT_NOTIFICATION,
@@ -361,14 +361,14 @@
}
if (!(ski[SI_NO_ATTACK_BUSY]&NO_ATTACK_BUSY_QUERY) &&
- caster->QueryProp(P_ATTACK_BUSY)) {
+ ({int})caster->QueryProp(P_ATTACK_BUSY)) {
if (txt=ski[SI_ATTACK_BUSY_MSG])
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
txt,
MT_NOTIFICATION,
MA_SPELL);
else
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
"Du bist schon zu sehr beschaeftigt.",
MT_NOTIFICATION,
MA_SPELL);
@@ -376,13 +376,13 @@
}
// Spruchvorbereitung
- if (pointerp(ps=(mixed)caster->QueryProp(P_PREPARED_SPELL)) // Ausstehender Spruch
+ if (pointerp(ps=({<int|mapping|string>*})caster->QueryProp(P_PREPARED_SPELL)) // Ausstehender Spruch
&& sizeof(ps)>=3 && intp(ps[0] && stringp(ps[1]))) {
if (ps[1]==spell) { // Dieser Spruch wird noch vorbereitet
if (time()<ps[0]) {
if (!stringp(txt=ski[SI_PREPARE_BUSY_MSG]))
txt="Du bist noch mit der Spruchvorbereitung beschaeftigt.\n";
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
txt,
MT_NOTIFICATION,
MA_SPELL);
@@ -396,7 +396,7 @@
printf(txt,ps[1]);
if (fat=GetValue(SI_PREPARE_TIME,ski,caster)) {
// Spruch braucht vorbereitungszeit
- caster->SetProp(P_PREPARED_SPELL,({time()+fat,spell,ski[SI_SKILLARG]}));
+ ({<int|mapping|string>*})caster->SetProp(P_PREPARED_SPELL,({time()+fat,spell,ski[SI_SKILLARG]}));
prepare_spell(caster,spell,ski);
return 1;
}
@@ -405,27 +405,27 @@
else {
if (fat=GetValue(SI_PREPARE_TIME,ski,caster)) {
// Spruch braucht vorbereitungszeit
- caster->SetProp(P_PREPARED_SPELL,({time()+fat,spell,ski[SI_SKILLARG]}));
+ ({<int|mapping|string>*})caster->SetProp(P_PREPARED_SPELL,({time()+fat,spell,ski[SI_SKILLARG]}));
prepare_spell(caster,spell,ski);
return 1;
}
}
if (ps)
- caster->SetProp(P_PREPARED_SPELL,0);
+ ({<int|mapping|string>*})caster->SetProp(P_PREPARED_SPELL,0);
// Funktion kann anderen Namen haben als Spell
if (!(fname=sinfo[SI_SKILLFUNC]))
fname=sname;
- if((ski[SI_NOMAGIC] < environment(caster)->QueryProp(P_NOMAGIC)) &&
- random(100) < environment(caster)->QueryProp(P_NOMAGIC)) {
+ if((ski[SI_NOMAGIC] < ({int})environment(caster)->QueryProp(P_NOMAGIC)) &&
+ random(100) < ({int})environment(caster)->QueryProp(P_NOMAGIC)) {
if (txt=ski[SI_NOMAGIC_MSG])
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
txt,
MT_NOTIFICATION,
MA_SPELL);
else
- caster->ReceiveMsg(
+ ({int})caster->ReceiveMsg(
"Dein Zauberspruch verpufft im Nichts.",
MT_NOTIFICATION,
MA_SPELL);
@@ -433,7 +433,7 @@
}
else {
// Spruch ausfuehren.
- res=(int)call_other(this_object(),fname,caster,ski);
+ res=funcall(symbol_function(fname),caster,ski);
}
if (!res || !caster)
return 1;
@@ -444,24 +444,24 @@
if (!(ski[SI_NO_ATTACK_BUSY]&NO_ATTACK_BUSY_QUERY))
{
if (!ski[SI_ATTACK_BUSY_AMOUNT])
- caster->SetProp(P_ATTACK_BUSY,1);
+ ({int})caster->SetProp(P_ATTACK_BUSY,1);
else
- caster->SetProp(P_ATTACK_BUSY,ski[SI_ATTACK_BUSY_AMOUNT]);
+ ({int})caster->SetProp(P_ATTACK_BUSY,ski[SI_ATTACK_BUSY_AMOUNT]);
}
- caster->restore_spell_points(-1*cost);
+ ({void})caster->restore_spell_points(-1*cost);
if (mappingp(ski[SI_X_SPELLFATIGUE])) {
// fuer jeden Key die Spellfatigue setzen. Keys mit Dauer 0 loesen keine
// Spellfatigue aus.
filter(ski[SI_X_SPELLFATIGUE],
function int (string key, int val)
- { return (int)caster->SetSpellFatigue(val, key); } );
+ { return ({int})caster->SetSpellFatigue(val, key); } );
}
else {
if ((fat=GetFValueO(SI_SPELLFATIGUE,ski,caster))<0)
fat=1;
- caster->SetSpellFatigue(fat);
+ ({int})caster->SetSpellFatigue(fat);
}
@@ -482,11 +482,11 @@
res=({});
if (!pl || !(env=environment(pl))) return res;
p1 = query_once_interactive(pl) ? 1 : -1;
- team=(object)pl->QueryProp(P_TEAM);
+ team=({object})pl->QueryProp(P_TEAM);
for (ob=first_inventory(env);ob;ob=next_inventory(ob)) {
if (!living(ob)) continue;
qp=symbol_function("QueryProp",ob);
- if (pl->IsEnemy(ob)) // Feinde sind immer Gegner
+ if (({int})pl->IsEnemy(ob)) // Feinde sind immer Gegner
p2=-1*p1;
else if (objectp(team) && funcall(qp,P_TEAM)==team)
p2=p1; // Teammitglieder sind immer auf Seite des Spielers
@@ -499,7 +499,7 @@
if ( who<0 && (funcall(qp,P_NO_ATTACK) || funcall(qp,P_NO_GLOBAL_ATTACK)) )
continue;
if (IS_LEARNING(ob) &&
- (funcall(qp,P_INVIS) || (who<0 && !pl->IsEnemy(ob))))
+ (funcall(qp,P_INVIS) || (who<0 && !({int})pl->IsEnemy(ob))))
continue;
if (p1*p2*who >=0)
res+=({ob});
@@ -510,7 +510,7 @@
object *
FindGroupN(object pl, int who, int n) {
if (!pl) return ({});
- n=(n*(int)pl->QuerySkillAttribute(SA_EXTENSION))/100;
+ n=(n*({int})pl->QuerySkillAttribute(SA_EXTENSION))/100;
if (n<1) n=1;
return FindGroup(pl,who)[0..(n-1)];
}
@@ -522,7 +522,7 @@
nres=({});
if (!pl) return nres;
- pr=(pr*(int)pl->QuerySkillAttribute(SA_EXTENSION))/100;
+ pr=(pr*({int})pl->QuerySkillAttribute(SA_EXTENSION))/100;
if (pr<0) return nres;
res=FindGroup(pl,who);
for (i=sizeof(res)-1;i>=0;i--)
@@ -544,16 +544,16 @@
return ({({}),({})});
if (!dy) dy=100;
if (!dx) dx=MAX_TEAM_ROWLEN*100;
- x=(int)pl->QuerySkillAttribute(SA_EXTENSION);
+ x=({int})pl->QuerySkillAttribute(SA_EXTENSION);
dx=(dx*x)/100;dy=(dy*x)/100;
- dist=(dist*(int)pl->QuerySkillAttribute(SA_RANGE))/100;
+ dist=(dist*({int})pl->QuerySkillAttribute(SA_RANGE))/100;
min=dist-dy/2;
max=dist+dy/2;
pos=([]);
p1=query_once_interactive(pl) ? 1 : -1;
is_enemy=symbol_function("IsEnemy",pl); // zur Beschleunigung
- myteam=(object)pl->QueryProp(P_TEAM);
+ myteam=({object})pl->QueryProp(P_TEAM);
for (ob=first_inventory(environment(pl));ob;ob=next_inventory(ob)) {
if (!living(ob)) continue;
qp=symbol_function("QueryProp",ob); // zur Beschleunigung
@@ -561,7 +561,7 @@
// Zuerst mal die Position feststellen:
if (!objectp(enteam=funcall(qp,P_TEAM)))
pos[ob]=1;
- else if (!pos[ob] && mappingp(x=(mapping)ob->PresentTeamPositions()))
+ else if (!pos[ob] && mappingp(x=({mapping})ob->PresentTeamPositions()))
pos+=x;
// PresentTeamPositions wird nur einmal pro Team ausgerechnet, weil
// anschliessend jedes anwesende Teammitglied pos[ob]!=0 hat.
@@ -575,7 +575,7 @@
else if (objectp(myteam) && myteam==enteam)
; // Teammitglieder sind immer auf eigener Seite
else
- pos[ob]*=(p1*((int)(query_once_interactive(ob)||
+ pos[ob]*=(p1*((query_once_interactive(ob)||
funcall(qp,P_FRIEND))?1:-1));
// Den Spieler auf keinen Fall entfernen
@@ -652,7 +652,7 @@
if (!pl) return 0;
if (!sizeof(wen)) {
- if (victim = (object)pl->SelectEnemy())
+ if (victim = ({object})pl->SelectEnemy())
return victim;
else
return 0;
@@ -669,7 +669,7 @@
object vic;
if (!(vic=find_victim(wen,pl)) && msg)
- pl->ReceiveMsg(
+ ({int})pl->ReceiveMsg(
msg,
MT_NOTIFICATION,
MA_SPELL);
@@ -681,8 +681,8 @@
if (!(vic=FindVictim(wen,pl,msg)))
return 0;
- if (!living(vic) || vic->QueryProp(P_GHOST)) {
- printf("%s lebt doch nicht!\n", capitalize((string)vic->name()));
+ if (!living(vic) || ({int})vic->QueryProp(P_GHOST)) {
+ printf("%s lebt doch nicht!\n", capitalize(({string})vic->name()));
return 0;
}
return vic;
@@ -699,31 +699,31 @@
if ((stringp(wen) && wen!="") || !objectp(pl))
return 0;
if (pointerp(func)) { // Soll einer DIESER Gegner genommen werden?
- if (!(vic=(object)pl->SelectEnemy(func))) // Dann daraus auswaehlen
+ if (!(vic=({object})pl->SelectEnemy(func))) // Dann daraus auswaehlen
return 0;
} else {
if (!stringp(func))
func="SelectEnemy";
- if (!(vic=(object)call_other(pl,func,0,min,max)))
+ if (!(vic=({object})call_other(pl,func,0,min,max)))
return 0;
}
func=0; // kein zweites Mal pruefen.
}
- if (no_attack = (mixed)vic->QueryProp(P_NO_ATTACK)) {
+ if (no_attack = ({int|string})vic->QueryProp(P_NO_ATTACK)) {
if (stringp(no_attack))
- pl->ReceiveMsg(
+ ({int})pl->ReceiveMsg(
no_attack,
MT_NOTIFICATION,
MA_FIGHT);
else
- pl->ReceiveMsg(
- vic->Name(WER,1)+" laesst sich nicht angreifen.",
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" laesst sich nicht angreifen.",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
if (vic==pl) {
- pl->ReceiveMsg(
+ ({int})pl->ReceiveMsg(
"Du koenntest Dir dabei wehtun.",
MT_NOTIFICATION,
MA_FIGHT);
@@ -732,39 +732,39 @@
if (stringp(func)) {
switch(func) {
case "SelectNearEnemy":
- if (pl->PresentPosition()>1) {
- pl->ReceiveMsg(
+ if (({int})pl->PresentPosition()>1) {
+ ({int})pl->ReceiveMsg(
"Du stehst nicht in der ersten Kampfreihe.",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
- if (vic->PresentPosition()>1) {
- pl->ReceiveMsg(
- vic->Name(WER,1)+" ist in einer hinteren Kampfreihe.",
+ if (({int})vic->PresentPosition()>1) {
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" ist in einer hinteren Kampfreihe.",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
break;
case "SelectFarEnemy":
- if (row=(int)vic->PresentPosition())
+ if (row=({int})vic->PresentPosition())
row--;
if (row>=min && row<=max)
break;
if (row<min)
- pl->ReceiveMsg(
- vic->Name(WER,1)+" ist zu nahe.",
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" ist zu nahe.",
MT_NOTIFICATION,
MA_FIGHT);
else if (row>max)
- pl->ReceiveMsg(
- vic->Name(WER,1)+" ist zu weit weg.",
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" ist zu weit weg.",
MT_NOTIFICATION,
MA_FIGHT);
else
- pl->ReceiveMsg(
- vic->Name(WER,1)+" ist unerreichbar.",
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" ist unerreichbar.",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
@@ -772,16 +772,16 @@
}
} else if (pointerp(func)) {
if (member(func,vic)<0) {
- pl->ReceiveMsg(
- vic->Name(WER,1)+" ist unerreichbar.",
+ ({int})pl->ReceiveMsg(
+ ({string})vic->Name(WER,1)+" ist unerreichbar.",
MT_NOTIFICATION,
MA_FIGHT);
return 0;
}
}
- if (!pl->IsEnemy(vic)) // War es bisher kein Feind?
- pl->Kill(vic); // Dann ist es jetzt einer.
+ if (!({int})pl->IsEnemy(vic)) // War es bisher kein Feind?
+ ({int})pl->Kill(vic); // Dann ist es jetzt einer.
return vic;
}
@@ -840,7 +840,7 @@
obs=x[0];
for (i=sizeof(obs)-1;i>=0;i--)
- if (objectp(ob=obs[i]) && suc>=ob->SpellDefend(caster,sinfo))
+ if (objectp(ob=obs[i]) && suc>=({int})ob->SpellDefend(caster,sinfo))
TryAttackSpell(ob,(damage?random(damage):
GetRandFValueO(SI_SKILLDAMAGE,sinfo,caster)),
dt,is_spell,caster,sinfo);
@@ -849,8 +849,8 @@
return 1;
obs=x[1];
for (i=sizeof(obs)-1;i>=0;i--)
- if (objectp(ob=obs[i]) && suc>=ob->SpellDefend(caster,sinfo))
- ob->reduce_hit_points(((damage?random(damage):
+ if (objectp(ob=obs[i]) && suc>=({int})ob->SpellDefend(caster,sinfo))
+ ({int})ob->reduce_hit_points(((damage?random(damage):
GetRandFValueO(SI_SKILLDAMAGE,sinfo,caster))
*coldam)/10);
// 10 statt 100 ist Absicht, weil reduce_hit_points schon um Faktor
diff --git a/std/weapon/combat.c b/std/weapon/combat.c
index 4cddc50..4130585 100644
--- a/std/weapon/combat.c
+++ b/std/weapon/combat.c
@@ -82,7 +82,7 @@
if(interactive(this_player()))
{
- this_player()->ReceiveMsg(str[0],
+ ({int})this_player()->ReceiveMsg(str[0],
MT_NOTIFICATION|MSG_BS_LEAVE_LFS, MA_WIELD, 0,
this_player());
}
@@ -99,7 +99,7 @@
s1 = replace_personal(sprintf(QueryProp(P_WIELD_MSG)[0],"@WEN2"),
({this_player(),this_object()}), 1);
- this_player()->ReceiveMsg(s1,
+ ({int})this_player()->ReceiveMsg(s1,
MT_NOTIFICATION|MSG_BS_LEAVE_LFS, MA_WIELD, 0,
this_player());
}
@@ -120,7 +120,7 @@
*/
else if(interactive(this_player()))
{
- this_player()->ReceiveMsg(
+ ({int})this_player()->ReceiveMsg(
"Du zueckst "+name(WEN,1)+".",
MT_NOTIFICATION, MA_WIELD, 0, this_player());
}
@@ -130,7 +130,7 @@
// +name(WEN,0)+".",78),({ this_player() }));
if ( objectp(environment()) && objectp(environment(environment())) )
send_room(environment(environment()),
- this_player()->Name(WER)+" zueckt "+name(WEN,0)+".",
+ ({string})this_player()->Name(WER)+" zueckt "+name(WEN,0)+".",
MT_LOOK,
MA_WIELD, 0, ({this_player()}), environment());
}
@@ -156,7 +156,7 @@
if(interactive(wielded_by))
{
- wielded_by->ReceiveMsg(str[0],
+ ({int})wielded_by->ReceiveMsg(str[0],
MT_NOTIFICATION|MSG_BS_LEAVE_LFS, MA_UNWIELD, 0, wielded_by);
}
if ( objectp(environment()) && objectp(environment(environment())) )
@@ -171,7 +171,7 @@
{
s1 = replace_personal(sprintf(QueryProp(P_UNWIELD_MSG)[0],"@WEN2"),
({this_player(),this_object()}), 1);
- wielded_by->ReceiveMsg(s1,
+ ({int})wielded_by->ReceiveMsg(s1,
MT_NOTIFICATION|MSG_BS_LEAVE_LFS, MA_UNWIELD, 0, wielded_by);
}
@@ -190,13 +190,13 @@
*/
else if(interactive(wielded_by))
{
- wielded_by->ReceiveMsg(
+ ({int})wielded_by->ReceiveMsg(
"Du steckst "+name(WEN,1)+" zurueck.",
MT_NOTIFICATION, MA_UNWIELD, 0, wielded_by);
}
if ( objectp(environment()) && objectp(environment(environment())) )
send_room(environment(environment()),
- wielded_by->Name(WER) +" steckt "+name(WEN,0)+" zurueck.",
+ ({string})wielded_by->Name(WER) +" steckt "+name(WEN,0)+" zurueck.",
MT_LOOK,
MA_UNWIELD, 0, ({wielded_by}), environment());
}
@@ -246,7 +246,7 @@
// Waffen, die ein oder mehrere Attribut veraendern und gegen
// das gesetzte Limit verstossen, haben keine Wirkung bezueglich der
// Attribute.
- if ( mappingp(res=QueryProp(P_M_ATTR_MOD)) && PL->TestLimitViolation(res) )
+ if ( mappingp(res=QueryProp(P_M_ATTR_MOD)) && ({int})PL->TestLimitViolation(res) )
{
write(break_string(
"Irgendetwas an Deiner Ausruestung verhindert, dass Du Dich mit "+
@@ -257,15 +257,15 @@
// gleich auf eine WieldFunc zurueckgreifen zu muessen.
// Die Auswertung erfolgt ueber den RestrictionChecker
if ( (res=QueryProp(P_RESTRICTIONS)) && mappingp(res) &&
- (res=(string)call_other("/std/restriction_checker","check_restrictions",
+ (res=call_other("/std/restriction_checker","check_restrictions",
PL,res)) && stringp(res) )
{
notify_fail(res);
return 0;
}
- parry=(int)QueryProp(P_PARRY);
- dex=(int)PL->QueryAttribute(A_DEX);
+ parry=QueryProp(P_PARRY);
+ dex=({int})PL->QueryAttribute(A_DEX);
// Testen, ob der Spieler die noetige Geschicklichkeit besitzt, um
// mit dieser (Parier)Waffe umgehen zu koennen
@@ -278,9 +278,9 @@
}
// Eine Gezueckte Waffe muss natuerlich erst mal weggesteckt werden.
- if ( (parry<PARRY_ONLY) && objectp(res=(object)PL->QueryProp(P_WEAPON)) )
+ if ( (parry<PARRY_ONLY) && objectp(res=({object})PL->QueryProp(P_WEAPON)) )
{
- if ( (res->DoUnwield(silent)) && !((object)PL->QueryProp(P_WEAPON)) )
+ if ( (({int})res->DoUnwield(silent)) && !(({object})PL->QueryProp(P_WEAPON)) )
{
// Wenn die alte Waffe weggesteckt werden konnte, nochmal
// versuchen zu zuecken
@@ -295,9 +295,9 @@
}
}
// Das gleiche gilt natuerlich fuer Parierwaffen
- if ( (parry>PARRY_NOT) && objectp(res=(object)PL->QueryProp(P_PARRY_WEAPON)) )
+ if ( (parry>PARRY_NOT) && objectp(res=({object})PL->QueryProp(P_PARRY_WEAPON)) )
{
- if ( (res->DoUnwield(silent)) && !(PL->QueryProp(P_PARRY_WEAPON)) )
+ if ( (({int})res->DoUnwield(silent)) && !(({object})PL->QueryProp(P_PARRY_WEAPON)) )
{
// Wenn die alte Parierwaffe weggesteckt werden konnte, nochmal
// versuchen zu zuecken
@@ -314,7 +314,7 @@
// Ist eine WieldFunc gesetzt, wird diese aufgerufen.
if (objectp(res=QueryProp(P_WIELD_FUNC))
- && !(res->WieldFunc(ME,silent,environment())))
+ && !(({int})res->WieldFunc(ME,silent,environment())))
{
// Eine Meldung sollte schon von der WieldFunc ausgegeben werden.
return 1;
@@ -336,7 +336,7 @@
}
// Testen, ob der Zuecker genug Haende frei hat.
- if (!(PL->UseHands(ME,QueryProp(P_NR_HANDS))))
+ if (!(({int})PL->UseHands(ME,QueryProp(P_NR_HANDS))))
{
notify_fail("Du hast keine Hand mehr frei.\n");
return 0;
@@ -361,18 +361,18 @@
// Waffen koennen Attribute aendern/blockieren. Also muessen diese
// nach dem Zuecken aktualisiert werden
- PL->register_modifier(ME);
- PL->UpdateAttributes();
+ ({void})PL->register_modifier(ME);
+ ({void})PL->UpdateAttributes();
// P_TOTAL_AC/P_TOTAL_WC im Spieler aktualisieren. Da dort Attribute
// eingehen, kann das erst hier gemacht werden.
if (parry<PARRY_ONLY)
{
- PL->QueryProp(P_TOTAL_WC);
+ ({int})PL->QueryProp(P_TOTAL_WC);
}
if (parry>PARRY_NOT)
{
- PL->QueryProp(P_TOTAL_AC);
+ ({int})PL->QueryProp(P_TOTAL_AC);
}
// Zueck-Meldung ausgeben, wenn das silent-Flag nicht gesetzt ist
@@ -412,7 +412,7 @@
// Ist eine UnwieldFunc gesetzt, wird diese aufgerufen
if ( objectp(res=QueryProp(P_UNWIELD_FUNC)) &&
- !(res->UnwieldFunc(ME,silent,wielded_by)) )
+ !(({int})res->UnwieldFunc(ME,silent,wielded_by)) )
{
// Eine Meldung muss die UnwieldFunc schon selbst ausgeben.
return 1;
@@ -463,23 +463,23 @@
}
// Die Haende, die bisher von der Waffe benutzt wurden, freigeben
- wielded_by->FreeHands(ME);
+ ({int})wielded_by->FreeHands(ME);
SetProp(P_WIELDED, 0);
// Waffen koennen Attribute aendern/blockieren. Also muessen diese
// nach dem Wegstecken aktualisiert werden
- wielded_by->deregister_modifier(ME);
- wielded_by->UpdateAttributes();
+ ({void})wielded_by->deregister_modifier(ME);
+ ({void})wielded_by->UpdateAttributes();
// P_TOTAL_AC/P_TOTAL_WC im Spieler aktualisieren. Da dort Attribute
// eingehen, kann das erst hier gemacht werden.
if (parry<PARRY_ONLY)
{
- wielded_by->QueryProp(P_TOTAL_WC);
+ ({int})wielded_by->QueryProp(P_TOTAL_WC);
}
if (parry>PARRY_NOT)
{
- wielded_by->QueryProp(P_TOTAL_AC);
+ ({int})wielded_by->QueryProp(P_TOTAL_AC);
}
// Inform-Funktion aufrufen
@@ -526,8 +526,8 @@
// Ist wirklich diese Waffe gemeint?
if ( !stringp(str) || !id(str) ||
- ((parry<PARRY_ONLY)&&((object)PL->QueryProp(P_WEAPON)!=ME)) ||
- ((parry>PARRY_NOT)&&((object)PL->QueryProp(P_PARRY_WEAPON)!=ME)) )
+ ((parry<PARRY_ONLY)&&(({object})PL->QueryProp(P_WEAPON)!=ME)) ||
+ ((parry>PARRY_NOT)&&(({object})PL->QueryProp(P_PARRY_WEAPON)!=ME)) )
{
return 0;
}
@@ -561,7 +561,7 @@
// Den Basis-Schaden berechnen. Die Staerke des Benutzers wird
// hier beruecksichtigt.
- dam = (2*QueryProp(P_WC)+10*((int)wielder->QueryAttribute(A_STR)))/3;
+ dam = (2*QueryProp(P_WC)+10*(({int})wielder->QueryAttribute(A_STR)))/3;
// Wie gut man getroffen hat, wird ueber ein random() simuliert
dam = random(1+dam);
@@ -746,7 +746,7 @@
// P_TOTAL_WC im Traeger updaten, so vorhanden
if (objectp(w=QueryProp(P_WIELDED)))
- w->QueryProp(P_TOTAL_WC);
+ ({int})w->QueryProp(P_TOTAL_WC);
// Rueckgabewert: Durchgefuehrte Aenderung an P_DAMAGE
return new_dam;
@@ -786,7 +786,7 @@
// P_TOTAL_AC im Traeger updaten, so vorhanden
if (objectp(w=QueryProp(P_WIELDED)))
- w->QueryProp(P_TOTAL_AC);
+ ({int})w->QueryProp(P_TOTAL_AC);
// Rueckgabewert: Durchgefuehrte Aenderung an P_DAMAGE
return new_dam;