1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "player.hh"
|
---|
10 | #include "objs/def_object.hh"
|
---|
11 | #include "lisp/li_class.hh"
|
---|
12 | #include "lisp/li_init.hh"
|
---|
13 |
|
---|
14 | static li_int_class_member income_rate("income_rate"),
|
---|
15 | counter("counter"), reset_time("reset_time");
|
---|
16 | static li_float_class_member commision("commision");
|
---|
17 |
|
---|
18 | li_object *g1_lawfirm_think(li_object *o, li_environment *env)
|
---|
19 | {
|
---|
20 | g1_dynamic_object_class *me=g1_dynamic_object_class::get(li_car(o,env),env);
|
---|
21 |
|
---|
22 | if (!counter())
|
---|
23 | {
|
---|
24 | counter()=reset_time();
|
---|
25 |
|
---|
26 | int take_away_total=0;
|
---|
27 |
|
---|
28 | for (int i=0; i<G1_MAX_PLAYERS; i++)
|
---|
29 | if (i!=me->player_num)
|
---|
30 | {
|
---|
31 | int take_away=income_rate();
|
---|
32 | if (g1_player_man.get(i)->money() + take_away<0)
|
---|
33 | take_away=-g1_player_man.get(i)->money();
|
---|
34 |
|
---|
35 | g1_player_man.get(i)->money() += take_away;
|
---|
36 | take_away_total-=take_away;
|
---|
37 | }
|
---|
38 |
|
---|
39 | if (take_away_total>0)
|
---|
40 | g1_player_man.get(me->player_num)->money() += i4_f_to_i(take_away_total * commision());
|
---|
41 |
|
---|
42 | }
|
---|
43 | else counter()--;
|
---|
44 |
|
---|
45 | me->request_think();
|
---|
46 | return 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 |
|
---|
50 | li_automatic_add_function(g1_lawfirm_think, "lawfirm_think");
|
---|