#include <thing/properties.h>#include <bank.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
Funktionen | |
| varargs int | SetTradingData (int money, int factor, int maxobs) |
| void | SetBuyFact (int i) |
| varargs int | QueryBuyFact (object client) |
| int | InflateSellValue (int value, int cnt) |
| int | TruncateSellValue (int value) |
| int | ObjectCount (object ob) |
| varargs int | QueryValue (object ob, int value, object client) |
| varargs int | QuerySellValue (object ob, object client) |
| varargs int | QueryBuyValue (mixed ob, object client) |
| protected void | create () |
| protected void | create_super () |
| void | reset () |
| void | _add_money (int i) |
| int | _set_shop_percent_left (int dummy) |
| int | _query_shop_percent_left () |
| int | _query_current_money () |
| int | _query_wantto () |
Variablen | |
| nosave int | buyfact |
| nosave int | shop_percent_left |
| nosave int | mymoney |
| nosave int | wantto |
| nosave int | last |
| private nosave int | wantthresh |
| private nosave int | maxnum |
| #define NEED_PROTOTYPES |
Definiert in Zeile 12 der Datei trading_price.c.
| void _add_money | ( | int | i | ) |
Definiert in Zeile 154 der Datei trading_price.c.
Benutzt log_file, mymoney und strftime().
Wird benutzt von buy(), make_to_money() und really_buy().
00154 { 00155 if (extern_call() && previous_object() != this_object()) 00156 log_file("ZENTRALBANK",sprintf("%s: TRANSFER: %O got %d from %O\n", 00157 strftime("%H:%M"), this_object(), i, previous_object())); 00158 mymoney+=i; 00159 }


| int _query_current_money | ( | ) |
Definiert in Zeile 169 der Datei trading_price.c.
Benutzt mymoney.
00169 { 00170 return mymoney; 00171 }
| int _query_shop_percent_left | ( | ) |
Definiert in Zeile 165 der Datei trading_price.c.
Benutzt shop_percent_left.
00165 { 00166 return shop_percent_left; 00167 }
| int _query_wantto | ( | ) |
Definiert in Zeile 173 der Datei trading_price.c.
Benutzt wantto.
00173 { 00174 return wantto; 00175 }
| int _set_shop_percent_left | ( | int | dummy | ) |
Definiert in Zeile 161 der Datei trading_price.c.
Benutzt shop_percent_left und ZENTRALBANK.
00161 { 00162 return shop_percent_left=ZENTRALBANK->_query_shop_percent_left(); 00163 }
| protected void create | ( | ) |
Definiert in Zeile 124 der Datei trading_price.c.
Benutzt P_SHOP_PERCENT_LEFT, SetProp() und SetTradingData().
00125 { 00126 SetProp(P_SHOP_PERCENT_LEFT, 0); 00127 SetTradingData(50000,300,3); 00128 }

| protected void create_super | ( | ) |
Definiert in Zeile 130 der Datei trading_price.c.
Benutzt set_next_reset().
00130 { 00131 set_next_reset(-1); 00132 }

| int InflateSellValue | ( | int | value, | |
| int | cnt | |||
| ) |
Definiert in Zeile 61 der Datei trading_price.c.
Benutzt maxnum.
Wird benutzt von QueryValue().

| int ObjectCount | ( | object | ob | ) |
Definiert in Zeile 77 der Datei trading_price.c.
Wird benutzt von QueryValue().
00078 { 00079 return objectp(ob); // 0 oder 1 00080 }

| varargs int QueryBuyFact | ( | object | client | ) |
Definiert in Zeile 56 der Datei trading_price.c.
Benutzt buyfact.
Wird benutzt von FindBestArmoursT(), FindBestWeapon() und QueryBuyValue().
00057 { 00058 return buyfact; 00059 }

| varargs int QueryBuyValue | ( | mixed | ob, | |
| object | client | |||
| ) |
Definiert in Zeile 117 der Datei trading_price.c.
Benutzt P_VALUE und QueryBuyFact().
00118 { 00119 if (objectp(ob)) 00120 return (ob->QueryProp(P_VALUE)*QueryBuyFact(client) + 50)/100; // runden... 00121 return 0; 00122 }

| varargs int QuerySellValue | ( | object | ob, | |
| object | client | |||
| ) |
Definiert in Zeile 110 der Datei trading_price.c.
Benutzt P_VALUE und QueryValue().
Wird benutzt von evaluate() und sell().
00111 { 00112 if (objectp(ob)) 00113 return QueryValue(ob,ob->QueryProp(P_VALUE),client); 00114 return 0; 00115 }


| varargs int QueryValue | ( | object | ob, | |
| int | value, | |||
| object | client | |||
| ) |
Definiert in Zeile 82 der Datei trading_price.c.
Benutzt dtime(), InflateSellValue(), log_file, mymoney, ObjectCount(), P_AC, P_DAMAGED, P_WC und TruncateSellValue().
Wird benutzt von QuerySellValue().
00083 { 00084 value=TruncateSellValue(InflateSellValue(value,ObjectCount(ob))); 00085 if (3*value>mymoney) 00086 { 00087 log_file("LADEN",sprintf("Out of money: %O for %O (%s)\n",this_object(), 00088 this_player(),dtime(time())[5..])); 00089 value=mymoney/3; 00090 } 00091 if (value<0) value=0; 00092 00093 /* Preisverfall von beschaedigtenObjekten gleich hier festlegen */ 00094 00095 if(value && ob->QueryProp(P_DAMAGED)) 00096 { 00097 if(ob->QueryProp(P_WC) || ob->QueryProp(P_AC)) 00098 { 00099 value = (6 * (value / 10)); 00100 } 00101 else 00102 { 00103 value = (4 * (value / 10)); 00104 } 00105 } 00106 00107 return value; 00108 }


| void reset | ( | void | ) |
Definiert in Zeile 134 der Datei trading_price.c.
Benutzt last, mymoney, P_SHOP_PERCENT_LEFT, SetProp(), wantthresh, wantto und ZENTRALBANK.
00135 { 00136 SetProp(P_SHOP_PERCENT_LEFT, 0); 00137 00138 if (last/3>mymoney) 00139 wantto=wantto*110/100; 00140 else 00141 if (last/2<mymoney) 00142 wantto=wantto*85/100; 00143 if (wantto<wantthresh) wantto=wantthresh+500; 00144 if (wantto>1500000) wantto=1500000; 00145 if (wantto<mymoney) 00146 { 00147 ZENTRALBANK->PayIn(mymoney-wantto); 00148 mymoney=wantto; 00149 } else 00150 mymoney+=ZENTRALBANK->WithDraw(wantto-mymoney); 00151 last=mymoney; 00152 }

| void SetBuyFact | ( | int | i | ) |
Definiert in Zeile 51 der Datei trading_price.c.
Benutzt buyfact.
| varargs int SetTradingData | ( | int | money, | |
| int | factor, | |||
| int | maxobs | |||
| ) |
Definiert in Zeile 23 der Datei trading_price.c.
Benutzt buyfact, last, log_file, maxnum, mymoney, wantthresh und wantto.
Wird benutzt von create().
00024 { 00025 if (extern_call() && previous_object() != this_object()) 00026 log_file("ZENTRALBANK",sprintf("INITIALIZE: %O got (%d,%d,%d) from %O (%O)\n", 00027 this_object(), money,factor,maxobs, 00028 previous_object(),this_player())); 00029 00030 if (money < 1000) 00031 money = 1000; 00032 00033 last=wantto=mymoney=money; 00034 wantthresh=wantto/2; 00035 if (wantthresh < 5000) 00036 wantthresh = 5000; 00037 00038 if (factor < 100) 00039 buyfact = 300; 00040 else 00041 buyfact = factor; 00042 00043 if (maxobs < 1) 00044 maxnum=3; 00045 else 00046 maxnum=maxobs; 00047 00048 return mymoney; 00049 }

| int TruncateSellValue | ( | int | value | ) |
Definiert in Zeile 68 der Datei trading_price.c.
Wird benutzt von QueryValue().
00069 { 00070 if (value > 500) { 00071 value-=500; 00072 value = ((1000*value)/(value+1000))+500; 00073 } 00074 return value; 00075 }

| nosave int buyfact |
Definiert in Zeile 20 der Datei trading_price.c.
Wird benutzt von QueryBuyFact(), SetBuyFact() und SetTradingData().
| nosave int last |
Definiert in Zeile 20 der Datei trading_price.c.
| private nosave int maxnum |
Definiert in Zeile 21 der Datei trading_price.c.
Wird benutzt von InflateSellValue() und SetTradingData().
| nosave int mymoney |
Definiert in Zeile 20 der Datei trading_price.c.
Wird benutzt von _add_money(), _query_current_money(), QueryValue(), reset() und SetTradingData().
| nosave int shop_percent_left |
Definiert in Zeile 20 der Datei trading_price.c.
Wird benutzt von _query_shop_percent_left() und _set_shop_percent_left().
| private nosave int wantthresh |
Definiert in Zeile 21 der Datei trading_price.c.
Wird benutzt von reset() und SetTradingData().
| nosave int wantto |
Definiert in Zeile 20 der Datei trading_price.c.
Wird benutzt von _query_wantto(), reset() und SetTradingData().
1.6.3