source: golgotha/src/golg/objs/takeover_pad.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.1 KB
Line 
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 "objs/def_object.hh"
10#include "lisp/li_class.hh"
11#include "map_man.hh"
12#include "map.hh"
13#include "li_objref.hh"
14#include "lisp/li_init.hh"
15#include "object_definer.hh"
16
17static li_object_class_member target("takeover_objects"), me_turret("turret");
18static li_symbol_ref turret_obj("turret");
19
20class g1_takeover_pad_class : public g1_object_class
21{
22public:
23  g1_takeover_pad_class(g1_object_type id, g1_loader_class *fp)
24    : g1_object_class(id,fp) {}
25
26  void think() {}
27
28  virtual void change_player_num(int new_team)
29  //{{{
30  {
31    li_class_context c(vars);
32
33    g1_object_class *turret=li_g1_ref::get(me_turret(),0)->value();
34    if (!turret)
35    {
36      g1_object_class::change_player_num(new_team);
37     
38      li_g1_ref_list *list=li_g1_ref_list::get(target(),0);
39      int list_size=list->size();
40      for (int i=0; i<list_size; i++) 
41      {
42        g1_object_class *tar=list->value(i);
43        if (tar)
44        {
45          tar->request_think();
46          tar->change_player_num(player_num);
47        }
48      }
49     
50      g1_object_class *t = g1_create_object(g1_get_object_type(turret_obj.get()));
51      if (t)
52      {
53        t->x = x;
54        t->y = y;
55        t->player_num = player_num;
56        t->occupy_location();
57        t->request_think();
58        t->grab_old();
59       
60        me_turret() = new li_g1_ref(t->global_id);
61      }     
62    }
63  }
64  //}}}
65};
66
67g1_object_definer<g1_takeover_pad_class>
68g1_takeover_pad_def("takeover_pad", g1_object_definition_class::EDITOR_SELECTABLE);
69
70//{{{ Emacs Locals
71// Local Variables:
72// folded-file: t
73// End:
74//}}}
Note: See TracBrowser for help on using the repository browser.