source: abuse/trunk/src/imlib/jwindow.cpp @ 668

Last change on this file since 668 was 668, checked in by Sam Hocevar, 11 years ago

imlib: make JCFont use vec2i classes.

File size: 18.7 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <string.h>
16
17#include "common.h"
18
19#include "video.h"
20#include "image.h"
21#include "input.h"
22#include "event.h"
23#include "filter.h"
24#include "jwindow.h"
25
26static int jw_left = 3, jw_right = 3, jw_top = 2, jw_bottom = 3;
27
28int frame_top() { return jw_top; }
29int frame_bottom() { return jw_bottom; }
30int frame_left() { return jw_left; }
31int frame_right() { return jw_right; }
32
33//
34//  Sets the size of the border around each window
35//
36void set_frame_size(int x)
37{
38    if(x < 1)
39        x = 1;
40    jw_left = x;
41    jw_right = x;
42    jw_top = 2;
43    jw_bottom = x;
44}
45
46 // true if a window lies in this area
47int WindowManager::window_in_area(int x1, int y1, int x2, int y2)
48{
49  for (Jwindow *f=m_first; f; f=f->next)
50    if (f->m_pos.x<=x2 && f->m_pos.y<=y2 && f->m_pos.x+f->l-1>=x1 && f->m_pos.y+f->h-1>=y1)
51      return 1;
52  return 0;
53}
54
55void WindowManager::grab_focus(Jwindow *j)
56{ m_grab=j; }
57
58void WindowManager::release_focus()
59{ m_grab=NULL; }
60
61
62void WindowManager::close_window(Jwindow *j)
63{
64    delete j;
65}
66
67void WindowManager::hide_windows()
68{
69    for (Jwindow *p = m_first; p; p = p->next)
70    {
71        if (!p->is_hidden())
72        {
73            p->hide();
74            m_surf->AddDirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h);
75        }
76    }
77}
78
79void WindowManager::show_windows()
80{
81  Jwindow *p;
82  for (p=m_first; p; p=p->next)
83    if (p->is_hidden())
84      show_window(p);
85}
86
87void WindowManager::hide_window(Jwindow *j)
88{
89    if (j == m_first)
90        m_first = m_first->next;
91    else
92    {
93        Jwindow *k;
94        for (k = m_first; k->next != j; k = k->next)
95            k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y,
96                                  j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y);
97        k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y,
98                              j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y);
99        k->next = j->next;
100    }
101    m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
102    j->hide();
103}
104
105void WindowManager::show_window(Jwindow *j)
106{
107    if (j->is_hidden())
108    {
109        j->show();
110        j->m_surf->AddDirty(0, 0, j->l, j->h);
111    }
112}
113
114void WindowManager::get_event(Event &ev)
115{
116  Get(ev);
117
118  if (ev.type==EV_KEY)
119    key_state[ev.key]=1;
120  else if (ev.type==EV_KEYRELEASE)
121    key_state[ev.key]=0;
122
123  if (state==inputing)
124  {
125    Jwindow *j;
126    for (ev.window=NULL,j=m_first; j; j=j->next)
127      if (!j->is_hidden() && ev.mouse_move >= j->m_pos
128                          && ev.mouse_move < j->m_pos + vec2i(j->l, j->h))
129        ev.window=j;
130
131    if (!ev.window && m_grab) ev.window=m_grab;
132
133    if (ev.window)
134    {
135      int closew=0,movew=0;
136
137      if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window &&
138       ev.mouse_move >= ev.window->m_pos &&
139       ev.mouse_move < ev.window->m_pos + vec2i(ev.window->l, ev.window->y1())))
140      {
141    if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1;
142    else if (ev.window->is_moveable()) movew=1;
143      } else if (m_grab)
144        ev.window=m_grab;
145
146      if (ev.type==EV_KEY && ev.key==JK_ESC)
147        closew=1;
148
149
150
151      if (closew)
152        ev.type=EV_CLOSE_WINDOW;
153      else if (movew)
154      {
155    int red=0;
156    if (ev.window==m_first)       // see if we need to raise the window
157    {
158      m_first=m_first->next;
159      if (m_first)
160        red=1;
161    }
162    else
163    {
164      Jwindow *last=m_first;
165      for (; last->next!=ev.window; last=last->next);
166      if (ev.window->next)
167        red=1;
168      last->next=ev.window->next;
169    }
170    if (!m_first)
171      m_first=ev.window;
172    else
173    {
174      Jwindow *last=m_first;
175      for (; last->next; last=last->next);
176      last->next=ev.window;
177    }
178    ev.window->next=NULL;
179    if (red)
180    {
181      Jwindow *j=ev.window;
182/*      m_surf->AddDirty(j->x,j->y,j->x+j->l,j->y+j->h);
183      for (p=m_first; p!=j; p=p->next)
184        p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */
185      j->m_surf->AddDirty(0, 0, j->l, j->h);
186      flush_screen();
187    }
188
189        state=dragging;
190        drag_window=ev.window;
191        drag_mousex=ev.window->m_pos.x-ev.mouse_move.x;
192        drag_mousey=ev.window->m_pos.y-ev.mouse_move.y;
193        ev.type=EV_SPURIOUS;
194      } else if (ev.window)
195        ev.window->inm->handle_event(ev,ev.window);
196    }
197  } else if (state==dragging)
198  {
199    ev.window=drag_window;
200    if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button==0)  // user released the mouse
201    {
202      state=inputing;
203      ev.type=EV_SPURIOUS;
204    } else if (ev.type==EV_MOUSE_MOVE)
205    {
206       move_window(drag_window,ev.mouse_move.x+drag_mousex,ev.mouse_move.y+drag_mousey);
207       flush_screen();
208       ev.type=EV_DRAG_WINDOW;
209       ev.window_position.x=ev.mouse_move.x+drag_mousex;
210       ev.window_position.y=ev.mouse_move.y+drag_mousey;
211    }
212  }
213  if (ev.type == EV_REDRAW)
214  {
215    for (Jwindow *j = m_first; j; j = j->next)
216       j->m_surf->AddDirty(ev.redraw.x1 - j->m_pos.x, ev.redraw.y1 - j->m_pos.y,
217                             ev.redraw.x2 + 1 - j->m_pos.x, ev.redraw.y2 + 1 - j->m_pos.y);
218    m_surf->AddDirty(ev.redraw.x1, ev.redraw.y1, ev.redraw.x2 + 1, ev.redraw.y2 + 1);
219    flush_screen();
220    ev.type=EV_SPURIOUS;   // we took care of this one by ourselves.
221  }
222}
223
224void Jwindow::resize(int L, int H)
225{
226  m_surf->SetSize(vec2i(L,H));
227  l=L; h=H;
228}
229
230void WindowManager::resize_window(Jwindow *j, int l, int h)
231{
232  Jwindow *p;
233  m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
234  for (p=m_first; p!=j; p=p->next)
235    p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y, j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y);
236  j->resize(l,h);
237  if (!frame_suppress)
238  j->redraw();
239}
240
241void WindowManager::move_window(Jwindow *j, int x, int y)
242{
243    m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h);
244    for(Jwindow *p = m_first; p != j; p = p->next)
245        p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y,
246                              j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y);
247    j->m_pos.x = x;
248    j->m_pos.y = y;
249    j->m_surf->AddDirty(0, 0, j->l, j->h);
250}
251
252WindowManager::WindowManager(image *screen, palette *pal, int Hi,
253                             int Med, int Low, JCFont *Font)
254  : EventHandler(screen, pal)
255{
256    wm = this;
257    m_surf = screen;
258    hi = Hi; low = Low; med = Med; m_first = NULL; m_pal = pal; m_grab = NULL;
259    bk = pal->find_closest(0, 0, 0);
260    state = inputing; fnt = Font;  wframe_fnt = Font;
261    memset(key_state, 0, sizeof(key_state));
262    frame_suppress = 0;
263}
264
265WindowManager::~WindowManager()
266{
267    while(m_first)
268        close_window(m_first);
269    wm = NULL;
270}
271
272void WindowManager::add_window(Jwindow *win)
273{
274    if(!m_first)
275        m_first = win;
276    else
277    {
278        Jwindow *tmp = m_first;
279        while(tmp->next)
280            tmp = tmp->next;
281        tmp->next = win;
282        win->next = NULL;
283    }
284}
285
286void WindowManager::remove_window(Jwindow *win)
287{
288    if(m_grab == win)
289        m_grab = NULL;
290
291    // close the window we were dragging
292    if(state == dragging && win == drag_window)
293        state = inputing;
294
295    if(m_first == win)
296        m_first = m_first->next;
297    else
298    {
299        Jwindow * search;
300        for(search = m_first; search->next != win; search = search->next)
301            search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x,
302                                     win->m_pos.y - search->m_pos.y,
303                                     win->m_pos.x + win->l - search->m_pos.x,
304                                     win->m_pos.y + win->h - search->m_pos.y);
305        search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x,
306                                 win->m_pos.y - search->m_pos.y,
307                                 win->m_pos.x + win->l - search->m_pos.x,
308                                 win->m_pos.y + win->h - search->m_pos.y);
309        search->next = win->next;
310    }
311
312    m_surf->AddDirty(win->m_pos.x, win->m_pos.y, win->m_pos.x + win->l, win->m_pos.y + win->h);
313}
314
315Jwindow * WindowManager::new_window(int x, int y, int l, int h,
316                                     ifield * fields, char const *name)
317{
318    if(x > m_surf->Size().x - 4)
319        x = m_surf->Size().x - 25;
320    if(y > m_surf->Size().y - 4)
321        y = m_surf->Size().y - 10;
322
323    Jwindow * j = new Jwindow (vec2i(x, y), l, h, fields, name);
324    j->show();
325
326    return j;
327}
328
329void WindowManager::flush_screen()
330{
331    vec2i m1(0, 0);
332
333    if (has_mouse())
334    {
335        m1 = m_pos - m_center;
336        vec2i m2 = m1 + m_sprite->visual->Size();
337
338        m_sprite->save->PutPart(m_surf, vec2i(0, 0), m1, m2);
339        m_surf->PutImage(m_sprite->visual, m1, 1);
340    }
341
342    for (Jwindow *p = m_first; p; p = p->next)
343        if (!p->is_hidden())
344            m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h);
345    update_dirty(m_surf);
346
347    if (has_mouse())
348        m_surf->PutImage(m_sprite->save, m1);
349
350    for (Jwindow *p = m_first; p; p = p->next)
351    {
352        if (p->is_hidden())
353            continue;
354
355        if (has_mouse())
356        {
357            m_sprite->save->PutPart(p->m_surf, vec2i(0, 0), m1 - p->m_pos,
358                                    m1 - p->m_pos + m_sprite->visual->Size());
359            p->m_surf->PutImage(m_sprite->visual, m1 - p->m_pos, 1);
360        }
361
362//          m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x+p->l, p->m_pos.y+p->h);
363        for (Jwindow *q = p->next; q; q = q->next)
364            if (!q->is_hidden())
365                p->m_surf->delete_dirty(q->m_pos.x - p->m_pos.x, q->m_pos.y - p->m_pos.y,
366                                        q->m_pos.x + q->l - p->m_pos.x,
367                                        q->m_pos.y + q->h - p->m_pos.y);
368        update_dirty(p->m_surf, p->m_pos.x, p->m_pos.y);
369        if (has_mouse())
370            p->m_surf->PutImage(m_sprite->save, m1 - p->m_pos, 0);
371    }
372}
373
374Jwindow::Jwindow(char const *name)
375{
376    _x1 = left_border();
377    _y1 = jw_top + 5;
378    _x2 = _y2 = 0;
379
380    _hidden = true;
381    _moveable = true;
382    // property.flags = JWINDOW_NOAUTOHIDE_FLAG;
383
384    inm = new InputManager(this, NULL);
385    reconfigure();
386
387    m_surf = NULL;
388    next = NULL;
389
390    _name = NULL;
391    if(name)
392        _name = strdup(name);
393    wm->add_window(this);
394}
395
396Jwindow::Jwindow(vec2i pos, int L, int H, ifield *f, char const *name)
397{
398    l = 0;
399    h = 0;
400    _hidden = false;
401    _moveable = true;
402
403    _x1 = left_border();
404    _y1 = name ? top_border() : jw_top + 5;
405
406    m_surf = NULL;
407    inm = new InputManager(m_surf, f);
408    reconfigure(); /* FIXME: TODO */
409
410    l = L >= 0 ? L + left_border() : l - L;
411    h = H >= 0 ? H + top_border() : h - H;
412    m_pos.x = pos.x >= 0 ? pos.x : xres - l + pos.x - left_border() - right_border() - 1;
413    m_pos.y = pos.y >= 0 ? pos.y : yres - h + pos.y - top_border() - bottom_border() - 1;
414
415    backg = wm->medium_color();
416
417    _x2 = l - 1;
418    _y2 = h - 1;
419    l += right_border();
420    h += bottom_border();
421
422    if(L == -1)
423        if(l < 15 + left_border() + right_border())
424            l = 15 + left_border() + right_border();
425    if(H == -1)
426        if(h < top_border() + bottom_border())
427            h = top_border() + bottom_border();
428    m_surf = new image(vec2i(l, h), NULL, 2);
429    m_surf->clear(backg);
430    // Keep this from getting destroyed when image list is cleared
431    image_list.unlink(m_surf);
432    inm->m_surf = m_surf;
433
434    next = NULL;
435
436    _name = NULL;
437    if(name)
438        _name = strdup(name);
439
440    wm->add_window(this);
441    if(!wm->frame_suppress)
442        redraw();
443}
444
445Jwindow::~Jwindow()
446{
447    wm->remove_window(this);
448    local_close();
449    delete m_surf;
450    delete inm;
451    if(_name)
452        free(_name);
453}
454
455void Jwindow::reconfigure()
456{
457    int x1, y1, x2, y2;
458    ifield *i;
459    l = 2;
460    h = 2;
461    for(i = inm->m_first; i; i = i->next)
462    {
463        i->set_owner(this);
464        i->area(x1, y1, x2, y2);
465        if ((int)y2 > (int)h)
466            h = y2;
467        if ((int)x2 > (int)l)
468            l = x2;
469    }
470}
471
472void Jwindow::local_close()
473{
474    ;
475}
476
477void Jwindow::redraw()
478{
479    int hi = wm->bright_color();
480    int med = wm->medium_color();
481    int low = wm->dark_color();
482    JCFont * fnt = wm->frame_font();
483
484    if(_name)
485    {
486        if (right_border() >= 1)
487        {
488            m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h - 1), hi, med, low);
489            if (right_border() >= 3)
490                m_surf->WidgetBar(vec2i(right_border() - 1, top_border() - 1),
491                                  vec2i(l - left_border(), h - bottom_border()),
492                                  low, med, hi);
493
494          else
495            m_surf->Line(vec2i(left_border() - 1, top_border() - 1),
496                         vec2i(right_border() - 1, top_border() - 1), low);
497        }
498      m_surf->Rectangle(vec2i(2, 2), vec2i(top_border() - 2, top_border() - 3),
499                        wm->black());
500      m_surf->WidgetBar(vec2i(3, 3), vec2i(top_border() - 3, top_border() - 4),
501                        hi, med, low); // draws the 'close' button
502    }
503
504  else
505    {
506      if (right_border() >= 1)
507        {
508          m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h - 1), hi, med, low);
509          if (right_border() >= 3)
510            m_surf->WidgetBar(vec2i(right_border() - 1, jw_top + 4),
511                              vec2i(l - left_border(), h - bottom_border()),
512                              low, med, hi);
513          else
514            m_surf->Line(vec2i(left_border() - 1, jw_top + 4),
515                         vec2i(right_border() - 1, jw_top + 4), low);
516        }
517      // Draw the 'close' button
518      m_surf->Rectangle(vec2i(1, 1), vec2i(4, 4), wm->black ());
519      m_surf->WidgetBar(vec2i(2, 2), vec2i(3, 3), hi, med, low);
520    }
521  if (_name && _name[0])
522    {
523      m_surf->Bar(vec2i(top_border(), 1),
524                  vec2i(top_border() + fnt->Size().x * strlen (_name) + 1,
525                        top_border() - 2),
526                  med);
527      fnt->PutString(m_surf, vec2i(top_border() + 1, 1), _name, low);
528    }
529  // clear 'client' region
530  m_surf->Bar(vec2i(x1(), y1()), vec2i(x2(), y2()), backg);
531  inm->redraw ();
532}
533
534int Jwindow::left_border()
535{
536    return frame_left();
537}
538
539int Jwindow::right_border()
540{
541    return frame_right();
542}
543
544int Jwindow::top_border()
545{
546    return wm->font()->Size().y + frame_top();
547}
548
549int Jwindow::bottom_border()
550{
551    return frame_bottom();
552}
553
554
555ifield *InputManager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
556{
557  for (ifield *i=m_first,*last=NULL; i; i=i->next)
558  {
559    if (i->id==id)
560    {
561      if (i==m_first)
562    m_first=m_first->next;
563      else
564        last->next=i->next;
565      if (m_active==i)
566        m_active=m_first;
567      return i;
568    }
569    ifield *x=i->unlink(id);
570    if (x) return x;
571    last=i;
572  }
573  return NULL;   // no such id
574}
575
576InputManager::~InputManager()
577{ ifield *i;
578  while (m_first)
579  { i=m_first;
580    m_first=m_first->next;
581    delete i;
582  }
583}
584
585void InputManager::clear_current()
586{
587    if(m_owner)
588        m_surf = m_owner->m_surf;
589    if(m_active)
590        m_active->draw(0, m_surf);
591    m_active = NULL;
592}
593
594void InputManager::handle_event(Event &ev, Jwindow *j)
595{
596  ifield *i,*in_area=NULL;
597  int x1,y1,x2,y2;
598
599  if(m_owner)
600      m_surf = m_owner->m_surf;
601
602  if (j)
603  {
604    ev.mouse_move -= j->m_pos;
605    m_cur = j;
606  }
607
608  if (!m_grab)
609  {
610    if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1) || ev.type==EV_MOUSE_MOVE)
611    {
612      for (i=m_first; i; i=i->next)
613      {
614    i->area(x1,y1,x2,y2);
615    if (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
616        ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2)
617        in_area=i;
618      }
619      if (in_area!=m_active && (no_selections_allowed || (in_area && in_area->selectable())))
620      {
621    if (m_active)
622          m_active->draw(0,m_surf);
623
624    m_active=in_area;
625
626    if (m_active)
627      m_active->draw(1,m_surf);
628      }
629    }
630    if (ev.type==EV_KEY && ev.key==JK_TAB && m_active)
631    {
632      m_active->draw(0,m_surf);
633      do
634      {
635    m_active=m_active->next;
636    if (!m_active) m_active=m_first;
637      } while (m_active && !m_active->selectable());
638      m_active->draw(1,m_surf);
639    }
640  } else m_active=m_grab;
641
642  if (m_active)
643  {
644    if (ev.type!=EV_MOUSE_MOVE && ev.type!=EV_MOUSE_BUTTON)
645      m_active->handle_event(ev,m_surf,this);
646    else
647    {
648      m_active->area(x1,y1,x2,y2);
649      if (m_grab || (ev.mouse_move.x>=x1 && ev.mouse_move.y>=y1 &&
650          ev.mouse_move.x<=x2 && ev.mouse_move.y<=y2))
651      {
652    if (j)
653      m_active->handle_event(ev,m_surf,j->inm);
654    else m_active->handle_event(ev,m_surf,this);
655      }
656    }
657  }
658
659  if (j)
660    ev.mouse_move += j->m_pos;
661}
662
663void InputManager::allow_no_selections()
664{
665    no_selections_allowed=1;
666}
667
668void InputManager::redraw()
669{
670    ifield *i;
671    if(m_owner)
672        m_surf = m_owner->m_surf;
673    for(i = m_first; i; i = i->next)
674        i->draw_first(m_surf);
675    if(m_active)
676        m_active->draw(1, m_surf);
677}
678
679InputManager::InputManager(image *screen, ifield *first)
680{
681    no_selections_allowed = 0;
682    m_cur = NULL;
683    m_grab = NULL;
684    m_owner = NULL;
685    m_surf = screen;
686    m_active = m_first = first;
687    while(m_active && !m_active->selectable())
688        m_active = m_active->next;
689    if(m_surf)
690        redraw();
691}
692
693InputManager::InputManager(Jwindow *owner, ifield *first)
694{
695    no_selections_allowed = 0;
696    m_cur = NULL;
697    m_grab = NULL;
698    m_owner = owner;
699    m_surf = NULL;
700    m_active = m_first = first;
701    while(m_active && !m_active->selectable())
702        m_active = m_active->next;
703}
704
705void InputManager::grab_focus(ifield *i)
706{
707    m_grab = i;
708    if (m_cur)
709        wm->grab_focus(m_cur);
710}
711
712void InputManager::release_focus()
713{
714    m_grab = NULL;
715    if (m_cur)
716        wm->release_focus();
717}
718
719void InputManager::remap(Filter *f)
720{
721    for (ifield *i = m_first; i; i = i->next)
722        i->remap(f);
723    redraw();
724}
725
726void InputManager::add(ifield *i)
727{ ifield *f=m_first;
728  if (i->selectable())
729  {
730    if (!f)
731      m_first=i;
732    else
733    {
734      while (f->next) f=f->next;
735      f->next=i;
736    }
737  }
738}
739
740ifield *InputManager::get(int id)
741{
742  ifield *f;
743  for (f=m_first; f; f=f->next)
744  {
745    ifield *ret=f->find(id);
746    if (ret) return ret;
747  }
748  return NULL;
749}
750
751ifield::ifield()
752{
753    owner = NULL;
754    m_pos = vec2i(0, 0);
755    next = NULL;
756    id = 0;
757}
758
759ifield::~ifield()
760{
761    ;
762}
763
764/* re-position the control with respect to the "client" area of the window */
765void ifield::set_owner(Jwindow * newowner)
766{
767    if(owner)
768        Move(m_pos - vec2i(owner->x1(), owner->y1()));
769    owner = newowner;
770    if(owner)
771        Move(m_pos + vec2i(owner->x1(), owner->y1()));
772}
773
Note: See TracBrowser for help on using the repository browser.