This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | econ_change_items (dbref d, int id, int brand, int num) |
int | econ_find_items (dbref d, int id, int brand) |
void | econ_set_items (dbref d, int id, int brand, int num) |
void econ_change_items | ( | dbref | d, | |
int | id, | |||
int | brand, | |||
int | num | |||
) |
Definition at line 68 of file econ.c.
References A_ECONPARTS, add_entry(), Cargo, econ_change_items(), find_entry(), get_parts_short_name(), Good_obj, IsActuator, remove_entry(), S_ACTUATOR, silly_atr_get(), silly_atr_set(), and tprintf().
Referenced by econ_change_items(), econ_set_items(), fun_btaddstores(), fun_btremovestores(), and mech_Rfixstuff().
00069 { 00070 char *t, *u; 00071 int base = 0, i1, i2, i3; 00072 00073 if(!Good_obj(d)) 00074 return; 00075 if(brand) 00076 if(get_parts_short_name(id, brand) == get_parts_short_name(id, 0)) 00077 brand = 0; 00078 t = silly_atr_get(d, A_ECONPARTS); 00079 if((u = find_entry(t, id, brand))) { 00080 if(sscanf(u, "[%d,%d,%d]", &i1, &i2, &i3) == 3) 00081 base += i3; 00082 remove_entry(t, u); 00083 } 00084 base += num; 00085 if(base <= 0) { 00086 if(u) 00087 silly_atr_set(d, A_ECONPARTS, t); 00088 return; 00089 } 00090 if(!(IsActuator(id))) 00091 add_entry(t, tprintf("%d,%d,%d", id, brand, base)); 00092 silly_atr_set(d, A_ECONPARTS, t); 00093 if(IsActuator(id)) 00094 econ_change_items(d, Cargo(S_ACTUATOR), brand, base); 00095 /* Successfully changed */ 00096 }
int econ_find_items | ( | dbref | d, | |
int | id, | |||
int | brand | |||
) |
Definition at line 98 of file econ.c.
References A_ECONPARTS, find_entry(), get_parts_short_name(), Good_obj, and silly_atr_get().
Referenced by econ_set_items(), fun_btremovestores(), fun_btstores(), and stuff_change_sub().
00099 { 00100 char *t, *u; 00101 int i1, i2, i3; 00102 00103 if(!Good_obj(d)) 00104 return 0; 00105 if(brand) 00106 if(get_parts_short_name(id, brand) == get_parts_short_name(id, 0)) 00107 brand = 0; 00108 t = silly_atr_get(d, A_ECONPARTS); 00109 if((u = find_entry(t, id, brand))) 00110 if(sscanf(u, "[%d,%d,%d]", &i1, &i2, &i3) == 3) 00111 return i3; 00112 return 0; 00113 }
void econ_set_items | ( | dbref | d, | |
int | id, | |||
int | brand, | |||
int | num | |||
) |
Definition at line 115 of file econ.c.
References econ_change_items(), econ_find_items(), and Good_obj.
00116 { 00117 int i; 00118 00119 if(!Good_obj(d)) 00120 return; 00121 i = econ_find_items(d, id, brand); 00122 if(i != num) 00123 econ_change_items(d, id, brand, num - i); 00124 }