Changeset 653


Ignore:
Timestamp:
May 14, 2011, 4:00:53 PM (9 years ago)
Author:
Sam Hocevar
Message:

imlib: remove unused code and tag unused method arguments.

Location:
abuse/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/go.h

    r555 r653  
    3939  elevator(FILE *fp, unsigned char *state_remap);
    4040  virtual int size();
    41   virtual void recieve_signal(long signal) { ; }
     41  virtual void receive_signal(long signal) { (void)signal; }
    4242  virtual game_objects type() { return O_elevator; }
    4343  virtual ifield *make_fields(int ystart, ifield *Next);
  • abuse/trunk/src/imlib/image.h

    r650 r653  
    2525{
    2626public :
    27   int16_t dx1,dy1,dx2,dy2;
    28   dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
    29   { dx1=x1; dy1=y1; dx2=x2; dy2=y2;
    30     if(x2<x1 || y2<y1)
    31       printf("add incorrect dirty\n");
    32   }
    33   virtual int16_t compare(void *n1, int16_t field)
    34   { return((dirty_rect *)n1)->dy1>dy1; }
    35 } ;
     27    int16_t dx1, dy1, dx2, dy2;
     28    dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
     29    {
     30        dx1 = x1; dy1 = y1; dx2 = x2; dy2 = y2;
     31        if (x2 < x1 || y2 < y1)
     32            printf("add incorrect dirty\n");
     33    }
     34    virtual int compare(void *n1) { return ((dirty_rect *)n1)->dy1 > dy1; }
     35};
    3636
    3737class image_descriptor
  • abuse/trunk/src/imlib/input.h

    r643 r653  
    103103  virtual void area(int &x1, int &y1, int &x2, int &y2);
    104104  virtual void draw_first(image *screen);
    105   virtual void draw(int active, image *screen) { ; }
    106   virtual void handle_event(Event &ev, image *screen, InputManager *im) { ; }
     105  virtual void draw(int active, image *screen) { (void)active; (void)screen; }
     106  virtual void handle_event(Event &ev, image *screen, InputManager *im)
     107  {
     108      (void)ev; (void)screen; (void)im;
     109  }
    107110  virtual char *read() { return text; }
    108111  virtual int selectable() { return 0; }
  • abuse/trunk/src/imlib/jwindow.h

    r649 r653  
    7777    virtual void handle_event(Event &ev, image *screen, InputManager *im) = 0;
    7878    virtual int selectable() { return 1; }
    79     virtual void remap(Filter *f) { ; }
     79    virtual void remap(Filter *f) { (void)f; }
    8080    virtual char *read() = 0;
    8181    virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; }
    82     virtual ifield *unlink(int id) { return NULL; }
     82    virtual ifield *unlink(int id) { (void)id; return NULL; }
    8383    virtual ~ifield();
    8484} ;
  • abuse/trunk/src/imlib/palette.cpp

    r555 r653  
    5656}
    5757
    58 int palette::find_closest(unsigned char r, unsigned char g, unsigned char b)
     58int palette::find_closest(uint8_t r, uint8_t g, uint8_t b)
    5959{
    6060   unsigned char *cl=(unsigned char *)addr();
     
    7171}
    7272
    73 
    74 int palette::find_closest_non0(unsigned char r, unsigned char g, unsigned char b)
    75 {
    76    unsigned char *cl=(unsigned char *)addr()+3;
    77    int c=1,d=0x7fffffff,i,nd;
    78    for (i=1; i<256; i++)
    79    {
    80      nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++;
    81      nd+=((int)g-(int)(*cl))*((int)g-(int)(*cl)); cl++;
    82      nd+=((int)b-(int)(*cl))*((int)b-(int)(*cl)); cl++;
    83      if (nd<d)
    84      { c=i; d=nd; }
    85    }
    86    return c;
    87 }
    88 
    89 
    90 int palette::find_color(unsigned char r, unsigned char g, unsigned char b)
     73int palette::find_color(uint8_t r, uint8_t g, uint8_t b)
    9174{
    9275  int i,ub,mask,find;
     
    210193  b=color_num%8;
    211194  return (usd[x]&(128>>b));
    212 }
    213 
    214 int palette::add_color(unsigned int r, int unsigned g, int unsigned b, int closest_only)
    215 {
    216   int i,f,u,c;
    217   if (!closest_only)
    218   {
    219     for (i=ncolors-1,f=-1,u=-1; i>=0 && f<0; i--)
    220     {
    221       if (used(i))
    222       {
    223         if (pal[i].red==r && pal[i].green==g && pal[i].blue==b)
    224     f=i;
    225       }
    226       else
    227         u=i;
    228     }
    229   } else { f=-1; u=-1; }
    230   if (f<0)
    231   {
    232     if (u>=0)
    233     { pal[u].red=r;
    234       pal[u].green=g;
    235       pal[u].blue=b;
    236       set_used(u);
    237       f=u;
    238     }
    239     else
    240     {
    241       for (i=0,f=0,u=10000; i<ncolors; i++)
    242       { c=(pal[i].red-r)*(pal[i].red-r)+
    243       (pal[i].green-g)*(pal[i].green-g)+
    244       (pal[i].blue-b)*(pal[i].blue-b);
    245     if (c<u)
    246     { f=i;
    247       u=c;
    248     }
    249       }
    250     }
    251   }
    252   return f;
    253195}
    254196
     
    430372}
    431373
    432 void quant_palette::add_color(unsigned char r, unsigned char g, unsigned char b)
    433 {
    434   quant_node **p,*fat;
    435   int lev,cn,stop;
    436   p=&root;
    437   lev=0;
    438   stop=0;
    439   fat=NULL;
    440   if (nc>=mx-1)
    441     prune();
    442   while (!stop)
    443   {
    444     lev++;
    445     if (!(*p))
    446     {
    447       if (lev>2 && !fat)
    448     printf("h");
    449       (*p)=new quant_node(lev,fat);
    450       level[lev-1].add_end(*p);
    451     }
    452 
    453     if (!(*p)->is_leaf())
    454     {
    455       cn=((r&(256>>lev))!=0)<<2;
    456       cn+=((g&(256>>lev))!=0)<<1;
    457       cn+=((b&(256>>lev))!=0);
    458       fat=(*p);
    459       p=&((*p)->children[cn]);
    460     } else stop=1;
    461 
    462   }
    463   (*p)->set(r,g,b);
    464   if (!(*p)->tot)
    465     nc++;
    466   (*p)->tot++;
    467 }
    468 
    469 palette *quant_palette::create_pal()
    470 {
    471   palette *p;
    472   int i,x;
    473   quant_node *pn;
    474   p=new palette(mx);
    475   for (x=0,i=7; i>=0; i++)
    476     for (pn=(quant_node *)level[i].first();
    477      pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->Next())
    478       if (pn->is_leaf())
    479     p->set(x++,pn->red,pn->green,pn->blue);
    480   return p;
    481 }
    482 
    483374quant_palette::~quant_palette()
    484375{
     
    490381}
    491382
    492 unsigned char palette::brightest(int all)
    493 { unsigned char r,g,b,bri;
     383uint8_t palette::brightest(int all)
     384{ uint8_t r,g,b,bri;
    494385  unsigned i;
    495386  long brv;
     
    510401}
    511402
    512 unsigned char palette::darkest(int all, int noblack)
    513 { unsigned char r,g,b,bri;
     403uint8_t palette::darkest(int all, int noblack)
     404{ uint8_t r,g,b,bri;
    514405  unsigned i;
    515406  long brv,x;
  • abuse/trunk/src/imlib/palette.h

    r555 r653  
    5959  void set_all_used();
    6060  void set_all_unused();
    61   void set_background(unsigned char b)  { bg=b; }
    62   int background(unsigned char b)  { return bg; }
    63   int add_color(unsigned int r, unsigned int g, unsigned int b,
    64              int closest_only=0);
    65   int find_color(unsigned char r, unsigned char g, unsigned char b);
    66   int find_closest(unsigned char r, unsigned char g, unsigned char b);
    67   int find_closest_non0(unsigned char r, unsigned char g, unsigned char b);
     61  int find_color(uint8_t r, uint8_t g, uint8_t b);
     62  int find_closest(uint8_t r, uint8_t g, uint8_t b);
    6863  palette *copy();
    69   unsigned char brightest(int all=0);
    70   unsigned char darkest(int all=0, int noblack=1);
     64  uint8_t brightest(int all=0);
     65  uint8_t darkest(int all=0, int noblack=1);
    7166  int write(bFILE *fp);
    7267  int size();
     
    10196  void re_delete(quant_node *who, int lev);
    10297public :
    103   void add_color(unsigned char r, unsigned char g, unsigned char b);
    10498  quant_palette(int max_colors=256);
    105   palette *create_pal();
    10699  ~quant_palette();
    107100} ;
  • abuse/trunk/src/level.cpp

    r643 r653  
    399399void level::check_collisions()
    400400{
    401   game_object *target,*reciever=NULL;
     401  game_object *target,*receiver=NULL;
    402402  int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
    403403      s_centerx,t_centerx;
     
    409409
    410410    int hit=0;
    411     reciever=NULL;
     411    receiver=NULL;
    412412    for (target=first_active; target; target=target->next_active)
    413413    {
     
    456456        if (x2!=_x2 || _y2!=y2)
    457457        {
    458           reciever=target;
     458          receiver=target;
    459459          hitx=((x1+x2)/2+(xp1+xp2)/2)/2;
    460460          hity=((y1+y1)/2+(yp1+yp2)/2)/2;
     
    467467      }
    468468    }
    469     if (reciever)
    470     {
    471       reciever->do_damage((int)subject->current_figure()->hit_damage,subject,hitx,hity,0,0);
    472       subject->note_attack(reciever);
     469    if (receiver)
     470    {
     471      receiver->do_damage((int)subject->current_figure()->hit_damage,subject,hitx,hity,0,0);
     472      subject->note_attack(receiver);
    473473      hit=1;
    474474    }
     
    27692769    game_object *o=first_active;
    27702770    for (; o; o=o->next_active)
    2771       o->recieve_signal(signal);
     2771      o->receive_signal(signal);
    27722772  }
    27732773}
  • abuse/trunk/src/objects.h

    r555 r653  
    6363  int decide();        // returns 0 if you want to be deleted
    6464  int type() { return otype; }
    65   ifield *make_fields(int ystart, ifield *Next) { return NULL ; }
    66   void gather_input(InputManager *inm) { ; }
     65  ifield *make_fields(int ystart, ifield *Next)
     66  {
     67    (void)ystart; (void)Next;
     68    return NULL;
     69  }
     70  void gather_input(InputManager *inm) { (void)inm; }
    6771  int hurt_all() { return figures[otype]->get_cflag(CFLAG_HURT_ALL); }
    6872  int stoppable() { return figures[otype]->get_cflag(CFLAG_STOPPABLE); }
     
    8791
    8892  void note_attack(game_object *whom);
    89   void recieve_signal(long singal) { ; }
     93  void receive_signal(long signal) { (void)signal; }
    9094  int push_range();
    9195  int can_hurt(game_object *who);     // collision checking will ask first to see if you
Note: See TracChangeset for help on using the changeset viewer.