Changeset 39 for abuse/trunk


Ignore:
Timestamp:
Mar 2, 2008, 12:29:06 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Fix almost 2,000 warnings by using proper "const" keywords where needed.
Location:
abuse/trunk/src
Files:
97 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/ability.cpp

    r2 r39  
    1818
    1919
    20 char *ability_names[TOTAL_ABILITIES]=
    21    {"start_hp","start_accel","stop_accel",
    22     "jump_xvel","jump_yvel",
    23     "run_top_speed","jump_top_speed",
     20char const *ability_names[TOTAL_ABILITIES] =
     21{
     22    "start_hp", "start_accel", "stop_accel",
     23    "jump_xvel", "jump_yvel",
     24    "run_top_speed", "jump_top_speed",
    2425    "tint_color",
    2526    "push_xrange",
    26     "walk_top_speed"};
     27    "walk_top_speed"
     28};
    2729
    2830
  • abuse/trunk/src/cache.cpp

    r17 r39  
    1111#include "status.hpp"
    1212#include "crc.hpp"
     13#include "dev.hpp"
    1314#include "specache.hpp"
    1415
     
    2324                   if ((x)->last_access<0) { normalize(); (x)->last_access=1; } }
    2425
    25 extern char *symbol_str(char *name);
    26 
    2726crc_manager crc_man;
    2827
    2928int past_startup=0;
    3029
    31 int crc_man_write_crc_file(char *filename)
     30int crc_man_write_crc_file(char const *filename)
    3231{
    3332  return crc_man.write_crc_file(filename);
    3433}
    3534
    36 int crc_manager::write_crc_file(char *filename)  // return 0 on failure
     35int crc_manager::write_crc_file(char const *filename)  // return 0 on failure
    3736{
    3837  char msg[100];
     
    8786}
    8887
    89 int crc_manager::load_crc_file(char *filename)
     88int crc_manager::load_crc_file(char const *filename)
    9089{
    9190  bFILE *fp=open_file(filename,"rb");
     
    126125}
    127126
    128 crced_file::crced_file(char *name)
     127crced_file::crced_file(char const *name)
    129128{
    130129  filename=strcpy((char *)jmalloc(strlen(name)+1,"crc_file"),name);
     
    138137}
    139138
    140 int crc_manager::get_filenumber(char *filename)
     139int crc_manager::get_filenumber(char const *filename)
    141140{
    142141  for (int i=0;i<total_files;i++)
     
    660659}
    661660
    662 FILE *open_FILE(char *filename, char *mode);
    663661extern char *macify_name(char *s);
    664662
     
    668666        char *prefix="c:\\";
    669667#else
    670         char *prefix="/tmp/";     // for UNIX store lisp cache in tmp dir
    671         int flags=O_CREAT | O_RDWR;
     668        char const *prefix = "/tmp/";     // for UNIX store lisp cache in tmp dir
     669        int flags = O_CREAT | O_RDWR;
    672670#endif
    673671
     
    898896}
    899897
    900 int32_t cache_list::reg_object(char *filename, void *object, int type, int rm_dups)
     898int32_t cache_list::reg_object(char const *filename, void *object, int type, int rm_dups)
    901899{
    902900  char *name;
     
    912910extern int total_files_open;
    913911
    914 int32_t cache_list::reg(char *filename, char *name, int type, int rm_dups)
     912int32_t cache_list::reg(char const *filename, char const *name, int type, int rm_dups)
    915913{
    916914        int id=alloc_id(),i,fn=crc_man.get_filenumber(filename);
  • abuse/trunk/src/chars.cpp

    r4 r39  
    2020int *weapon_types=NULL;    // maps 0..total_weapons into 'real' weapon type
    2121
    22 char *state_names[MAX_STATE]= {
    23                                "dead",
    24                                "dieing",
    25                                "stopped",
    26                                "start_run_jump","run_jump","run_jump_fall","end_run_jump",
    27                                "flinch_up","flinch_down",
    28                                "morph_pose",
    29                                "running" };
     22char const *state_names[MAX_STATE] =
     23{
     24    "dead",
     25    "dieing",
     26    "stopped",
     27    "start_run_jump", "run_jump", "run_jump_fall", "end_run_jump",
     28    "flinch_up", "flinch_down",
     29    "morph_pose",
     30    "running"
     31};
    3032
    3133/*                             "start_still_jump","still_jump","still_jump_fall","end_still_jump",
     
    5355
    5456
    55 char *cflag_names[TOTAL_CFLAGS]={"hurt_all","is_weapon","stoppable","can_block",
    56                                  "hurtable","pushable","unlistable",
    57                                  "add_front","cached_in","need_cache_in","unactive_shield"};
    58 char *ofun_names[TOTAL_OFUNS]={"ai_fun","move_fun","draw_fun","map_draw_fun","damage_fun",
    59                                "next_state_fun","user_fun",
    60                                "constructor","reload_fun","get_cache_list_fun",
    61                                "type_change_fun"};
     57char const *cflag_names[TOTAL_CFLAGS] =
     58{
     59    "hurt_all", "is_weapon", "stoppable", "can_block",
     60    "hurtable", "pushable", "unlistable",
     61    "add_front", "cached_in", "need_cache_in", "unactive_shield"
     62};
     63
     64char const *ofun_names[TOTAL_OFUNS] =
     65{
     66    "ai_fun", "move_fun", "draw_fun", "map_draw_fun", "damage_fun",
     67    "next_state_fun", "user_fun",
     68    "constructor", "reload_fun", "get_cache_list_fun",
     69    "type_change_fun"
     70};
    6271
    6372int character_type::add_state(void *symbol)             // returns index into seq to use
  • abuse/trunk/src/chat.cpp

    r2 r39  
    11#include "chat.hpp"
    2 
    3 extern char *symbol_str(char *name);
     2#include "dev.hpp"
    43
    54chat_console::chat_console(window_manager *WM, JCFont *font, int width, int height) :
  • abuse/trunk/src/clisp.cpp

    r17 r39  
    6868extern int registered;
    6969
    70 view *lget_view(void *arg, char *msg)
     70static view *lget_view(void *arg, char const *msg)
    7171{
    7272  game_object *o=(game_object *)lpointer_value(arg);
     
    8181}
    8282
    83 extern int get_option(char *name);
    84 extern void set_login(char *name);
     83extern int get_option(char const *name);
     84extern void set_login(char const *name);
    8585
    8686void clisp_init()                            // call by lisp_init, defines symbols and functions
  • abuse/trunk/src/compiled.cpp

    r17 r39  
    2828int compile_error=0;
    2929
    30 int32_t c_state(char *name)
     30static int32_t c_state(char const *name)
    3131{
    3232  void *sym=find_symbol(name);
  • abuse/trunk/src/config.cpp

    r2 r39  
    77#include "game.hpp"
    88
    9 extern int get_key_binding( char *dir, int i );
     9extern int get_key_binding(char const *dir, int i);
    1010
    1111extern window_manager *eh;
     
    3737
    3838/*
    39 int get_key_binding(char *dir, int i)
     39int get_key_binding(char const *dir, int i)
    4040{
    4141        char tmp[100], kn[50];
     
    220220// Returns -1 for an invalid key code
    221221//
    222 int get_keycode( char *str )
     222int get_keycode(char const *str)
    223223{
    224224        if( !str[0] )
  • abuse/trunk/src/console.cpp

    r2 r39  
    77extern window_manager *eh;
    88
    9 void console::put_string(char *st)
     9void console::put_string(char const *st)
    1010{
    1111  while (*st)
     
    6363}
    6464
    65 console::console(window_manager *WM, JCFont *font, int width, int height, char *Name)
     65console::console(window_manager *WM, JCFont *font, int width, int height, char const *Name)
    6666{
    6767  wm=WM;
     
    161161
    162162
    163 shell_term::shell_term(window_manager *WM, JCFont *font, int width, int height, char *Name) :
     163shell_term::shell_term(window_manager *WM, JCFont *font, int width, int height, char const *Name) :
    164164  console(WM,font,width,height,Name)
    165165{
     
    173173}
    174174
    175 void shell_term::execute(char *st)
     175void shell_term::execute(char const *st)
    176176{
    177177  put_string(st);
  • abuse/trunk/src/cop.cpp

    r17 r39  
    88#include "clisp.hpp"
    99#include "ant.hpp"
     10#include "dev.hpp"
    1011
    1112enum { point_angle, fire_delay1 };
     
    120121  return 0;
    121122}
    122 
    123 extern char *symbol_str(char *name);
    124123
    125124void *top_ai()
     
    10481047
    10491048  int y=(y1+y2)/2-(tp+2)*fnt->height()/2,x=x1+10;
    1050   char *header_str=symbol_str("score_header");
     1049  char const *header_str = symbol_str("score_header");
    10511050  fnt->put_string(screen,x,y,header_str,eh->bright_color());
    10521051  y+=fnt->height();
  • abuse/trunk/src/dev.cpp

    r17 r39  
     1#include <ctype.h>
     2
    13#include "dev.hpp"
    24#include "input.hpp"
     
    1921#include "compiled.hpp"
    2022#include "chat.hpp"
    21 #include <ctype.h>
    2223
    2324#define make_above_tile(x) ((x)|0x4000)
     
    2829     raise_all;
    2930
    30 char *symbol_str(char *name)
     31char const *symbol_str(char const *name)
    3132{
    3233  void *sym=make_find_symbol(name);
     
    4142 
    4243  char prog[50];
    43   char *cs=prog;
     44  char const *cs=prog;
    4445  strcpy(prog,"(setq section 'game_section)\n");
    4546  eval(compile(cs));
     
    109110    dev_forward,dev_backward;
    110111
    111 char *dev_mode_icon_names[DEV_MODES]={"pixel_mode","pick_mode", /* "fill_mode",
    112                                       "line_mode","rect_mode","bar_mode", */ "area_select"};
     112char const *dev_mode_icon_names[DEV_MODES] =
     113{
     114    "pixel_mode", "pick_mode", /* "fill_mode",
     115    "line_mode","rect_mode","bar_mode", */ "area_select"
     116};
    113117
    114118int dev_mode_ids[DEV_MODES]={ID_DMODE_DRAW,ID_DMODE_PICK, ID_DMODE_AREA};
     
    317321void load_dev_icons()
    318322{
    319   char *artf="art/dev.spe";
     323  char const *artf="art/dev.spe";
    320324  dev_del=cash.reg(artf,"dev_del",SPEC_IMAGE,0);
    321325  dev_move=cash.reg(artf,"dev_move",SPEC_IMAGE,0);
     
    824828
    825829
    826 int get_option(char *name);
     830int get_option(char const *name);
    827831
    828832
     
    970974  if (dev & EDIT_MODE)
    971975  {
    972     char prog[100],*cs;
     976    char prog[100];
     977    char const *cs;
    973978    strcpy(prog,"(compile-file \"edit.lsp\")");
    974979    cs=prog;
     
    983988}
    984989
    985 void dev_controll::do_command(char *command, event &ev)
    986 {
    987   char fword[50],*st;
     990void dev_controll::do_command(char const *command, event &ev)
     991{
     992  char fword[50];
     993  char const *st;
    988994  int l,h,x,y,i;
    989995  if (command[0]=='(')            // is this a lisp command?
     
    20552061          if (!mess_win)
    20562062          {
    2057             mess_win=file_dialog(eh,symbol_str("level_name"),current_level ? current_level->name() : (char *)"",
     2063            mess_win=file_dialog(eh,symbol_str("level_name"),current_level ? current_level->name() : "",
    20582064                                 ID_LEVEL_LOAD_OK,symbol_str("ok_button"),ID_CANCEL,symbol_str("cancel_button"),
    20592065                                 symbol_str("FILENAME"),ID_MESS_STR1);
     
    23262332                  atoi(mess_win->read(ID_MESS_STR1)),
    23272333                  atoi(mess_win->read(ID_MESS_STR2)));
    2328           char *s=name;
     2334          char const *s=name;
    23292335          eval(compile(s));
    23302336          eh->push_event(new event(ID_CANCEL,NULL));        // close window
     
    32183224
    32193225}
    3220 
    3221 FILE *open_FILE(char *filename, char *mode);
    32223226
    32233227void dev_controll::save()
     
    33703374}
    33713375
    3372 void dev_controll::show_char_mem(char *name)
     3376void dev_controll::show_char_mem(char const *name)
    33733377{
    33743378  int find=-1;
     
    34463450struct pmi
    34473451{
    3448   char *name;
     3452  char const *name;
    34493453  int id;
    3450   char *on_off;
     3454  char const *on_off;
    34513455  int key;
    34523456} ;
  • abuse/trunk/src/director.cpp

    r17 r39  
    2525
    2626
    27 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color)
     27int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf, JCFont *font, uint8_t *cmap, char color)
    2828{
    2929  short cx1,cy1,cx2,cy2,word_size,word_len;
     
    3232  int h=font->height()+2,w=font->width(),x=x1,dist;
    3333  y+=y1;
    34   char *word_start;
     34  char const *word_start;
    3535
    3636  while (buf && *buf)
  • abuse/trunk/src/endgame.cpp

    r17 r39  
    2626
    2727
    28 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
     28extern int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf, JCFont *font, uint8_t *cmap, char color);
    2929
    3030mask_line *make_mask_lines(image *mask, int map_width)
  • abuse/trunk/src/game.cpp

    r17 r39  
    8383tcpip_protocol tcpip;
    8484
    85 FILE *open_FILE(char *filename, char *mode)
     85FILE *open_FILE(char const *filename, char const *mode)
    8686{
    8787/*  char *prefix=get_filename_prefix() ? get_filename_prefix() : "",*c;
     
    109109void handle_no_space()
    110110{
    111   char *no_space_msg= "\nYou are out of disk space or the game\n"
    112                       "was unable to write to disk for some reason\n"
    113                       "The game cannot continue, please check this out\n"
    114                       "and try again.\n";
     111  char const *no_space_msg =
     112      "\nYou are out of disk space or the game\n"
     113      "was unable to write to disk for some reason\n"
     114      "The game cannot continue, please check this out\n"
     115      "and try again.\n";
    115116  if (eh)
    116117  {
     
    188189}
    189190
    190 int get_option( char *name )
     191int get_option(char const *name)
    191192{
    192193        int i;
     
    505506
    506507
    507 void game::show_help(char *st)
     508void game::show_help(char const *st)
    508509{
    509510  strcpy(help_text,st);
     
    526527}
    527528
    528 void game::load_level(char *name)
     529void game::load_level(char const *name)
    529530{
    530531  if (current_level)
     
    12481249}
    12491250
    1250 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color);
     1251int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf, JCFont *font, uint8_t *cmap, char color);
    12511252
    12521253void do_title()
     
    22242225        if( scene_mode )
    22252226        {
    2226                 char *helpstr = "ARROW KEYS CHANGE TEXT SPEED";
     2227                char const *helpstr = "ARROW KEYS CHANGE TEXT SPEED";
    22272228                eh->font()->put_string(screen,screen->width()/2-(eh->font()->width()*strlen(helpstr))/2+1,
    22282229                        screen->height()-eh->font()->height()-5+1,helpstr,eh->dark_color());
     
    23702371    {
    23712372      lisp_init(0xf000,0x30000);
    2372       char *prog="(load \"lisp/upgrade.lsp\")",*cs;
    2373       cs=prog;
     2373      char const *prog="(load \"lisp/upgrade.lsp\")";
     2374      char const *cs = prog;
    23742375      if (!eval(compile(cs)))
    23752376        printf("file does not exists : lisp/upgrade.lsp, cannot upgrade\n");
     
    23862387                {
    23872388                        lisp_init(0xf000,0x30000);
    2388                         char *eof_char = "CTRL-D";
     2389                        char const *eof_char = "CTRL-D";
    23892390                        fprintf(stderr,
    23902391                                        " CLIVE (C) 1995 Jonathan Clark, all rights reserved\n"
     
    23952396                        {
    23962397                                fprintf(stderr,"Lisp> ");
    2397                                 char *l=get_line(0);
    2398                                 char *s=l;
     2398                                char *l = get_line(0);
     2399                                char const *s = l;
    23992400                                while (*s)
    24002401                                {
  • abuse/trunk/src/gamma.cpp

    r17 r39  
     1#include <math.h>
     2
    13#include "jwindow.hpp"
    24#include "lisp.hpp"
     5#include "game.hpp"
    36#include "scroller.hpp"
    47#include "id.hpp"
     
    710#include "dprint.hpp"
    811#include "loader2.hpp"
    9 #include <math.h>
    1012
    1113extern window_manager *eh;
     
    4446
    4547
    46 FILE *open_FILE( char *filename, char *mode );
    47 
    4848void gamma_correct(palette *&pal, int force_menu)
    4949{
  • abuse/trunk/src/gui.cpp

    r2 r39  
    11#include "cache.hpp"
    22#include "gui.hpp"
     3#include "dev.hpp"
    34#include "loader2.hpp"
    4 
    5 extern char *symbol_str(char *name);
    65
    76void ico_button::set_act_id(int id)
     
    128127}
    129128
    130 ico_button::ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id, char *help_key)
     129ico_button::ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id, char const *help_key)
    131130{
    132131  if (help_key)
  • abuse/trunk/src/imlib/filesel.cpp

    r4 r39  
    109109}
    110110
    111 jwindow *file_dialog(window_manager *wm, char *prompt, char *def,
    112                      int ok_id, char *ok_name, int cancel_id, char *cancel_name, char *FILENAME_str, int filename_id)
     111jwindow *file_dialog(window_manager *wm, char const *prompt, char const *def,
     112                     int ok_id, char const *ok_name, int cancel_id,
     113                     char const *cancel_name, char const *FILENAME_str,
     114                     int filename_id)
    113115{
    114116  int wl=WINDOW_FRAME_LEFT,wh=WINDOW_FRAME_TOP;
  • abuse/trunk/src/imlib/fonts.cpp

    r4 r39  
    1717}
    1818
    19 void texture_font::put_string(image *screen, int x, int y, char *st)
     19void texture_font::put_string(image *screen, int x, int y, char const *st)
    2020{ while (*st)
    2121  { put_char(screen,x,y,*st);
     
    2626
    2727
    28 void JCFont::put_string(image *screen, int x, int y, char *st, int color)
     28void JCFont::put_string(image *screen, int x, int y, char const *st, int color)
    2929{ while (*st)
    3030  { put_char(screen,x,y,*st,color);
  • abuse/trunk/src/imlib/guistat.cpp

    r2 r39  
    1313  int last_update;
    1414  time_marker last_time;
    15   gui_status_node(char *Name, visual_object *Show, window_manager *WM, gui_status_node *Next)
     15  gui_status_node(char const *Name, visual_object *Show, window_manager *WM, gui_status_node *Next)
    1616  { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
    1717    show=Show;
     
    6060#endif
    6161
    62 void gui_status_manager::push(char *name, visual_object *show)
     62void gui_status_manager::push(char const *name, visual_object *show)
    6363{
    6464  first=new gui_status_node(name,show,wm,first); 
  • abuse/trunk/src/imlib/image.cpp

    r19 r39  
    1313
    1414extern uint8_t current_background;
    15 char *imerr_messages[]={"No error",
    16                         "Error occured while reading",
    17                         "Incorrect file type",
    18                         "File is corrupted",
    19                         "File not found",
    20                         "Memory allocation trouble",
    21                         "Operation/file type not supported",
    22                         "Error occured while writing, (disk full?)"};
     15
     16char const *imerr_messages[] =
     17{
     18    "No error",
     19    "Error occured while reading",
     20    "Incorrect file type",
     21    "File is corrupted",
     22    "File not found",
     23    "Memory allocation trouble",
     24    "Operation/file type not supported",
     25    "Error occured while writing, (disk full?)"
     26};
    2327                       
    2428                         
  • abuse/trunk/src/imlib/include/filesel.hpp

    r2 r39  
    44#include "jwindow.hpp"
    55
    6 
    7 
    8 jwindow *file_dialog(window_manager *wm, char *prompt, char *def,
    9                      int ok_id, char *ok_name, int cancel_id, char *cancel_name,
    10                      char *FILENAME_str,
     6jwindow *file_dialog(window_manager *wm, char const *prompt, char const *def,
     7                     int ok_id, char const *ok_name, int cancel_id,
     8                     char const *cancel_name, char const *FILENAME_str,
    119                     int filename_id);
    1210
  • abuse/trunk/src/imlib/include/fonts.hpp

    r2 r39  
    1313  texture_font(image *letters, image *font_pattern=NULL);
    1414  void put_char(image *screen,  int x, int y, char ch);
    15   void put_string(image *screen, int x, int y, char *st);
     15  void put_string(image *screen, int x, int y, char const *st);
    1616  int height() { return th; }
    1717  int length() { return tl; }
     
    2929  JCFont(image *letters);
    3030  void put_char(image *screen,  int x, int y, char ch, int color=-1);
    31   void put_string(image *screen, int x, int y, char *st, int color=-1);
     31  void put_string(image *screen, int x, int y, char const *st, int color=-1);
    3232  int height() { return th; }
    3333  int length() { return tl; }
  • abuse/trunk/src/imlib/include/guistat.hpp

    r2 r39  
    1414  gui_status_node *first;
    1515  gui_status_manager(window_manager *WM);
    16   virtual void push(char *name, visual_object *show);
     16  virtual void push(char const *name, visual_object *show);
    1717  virtual void update(int percentage);
    1818  virtual void pop();
    1919  void draw_bar(gui_status_node *whom, int perc);
    20   void set_window_title(char *name) { strncpy(title,name,39); }
     20  void set_window_title(char const *name) { strncpy(title,name,39); }
    2121  virtual void force_display();
    2222} ;
  • abuse/trunk/src/imlib/include/image.hpp

    r19 r39  
    99#define Inew(pointer,type); { make_block(sizeof(type)); pointer=new type; }
    1010
    11 extern char *imerr_messages[];  // correspond to imERRORS
     11extern char const *imerr_messages[];  // correspond to imERRORS
    1212#define imREAD_ERROR           1
    1313#define imINCORRECT_FILETYPE   2
  • abuse/trunk/src/imlib/include/input.hpp

    r2 r39  
    1212  int act_id;
    1313public :
    14   button(int X, int Y, int ID, char *Text, ifield *Next);
     14  button(int X, int Y, int ID, char const *Text, ifield *Next);
    1515  button(int X, int Y, int ID, image *vis, ifield *Next);
    1616  button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next);
     
    6464  }
    6565public :
    66   text_field(int X, int Y, int ID, char *Prompt, char *Format,
    67                                char *Data, ifield *Next);
    68   text_field(int X, int Y, int ID, char *Prompt, char *Format,
     66  text_field(int X, int Y, int ID, char const *Prompt, char const *Format,
     67                               char const *Data, ifield *Next);
     68  text_field(int X, int Y, int ID, char const *Prompt, char const *Format,
    6969                               double Data, ifield *Next);
    7070
     
    7676  virtual ~text_field() { jfree(prompt); jfree(format); jfree(data); }
    7777  virtual char *read();
    78   void change_data(char *new_data, int new_cursor,       // cursor==-1, does not change it.
     78  void change_data(char const *new_data, int new_cursor,       // cursor==-1, does not change it.
    7979                   int active, image *screen, window_manager *wm);
    8080} ;
     
    8585  char *text;
    8686  int w,h;
    87   void put_para(image *screen, char *st, int dx, int dy, int xspace,
     87  void put_para(image *screen, char const *st, int dx, int dy, int xspace,
    8888                int yspace, JCFont *font, int color);
    8989public :
    90   info_field(int X, int Y, int ID, char *info, ifield *Next);
     90  info_field(int X, int Y, int ID, char const *info, ifield *Next);
    9191  virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    9292  virtual void draw_first(image *screen, window_manager *wm);
  • abuse/trunk/src/imlib/include/jmalloc.hpp

    r17 r39  
    88enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE};
    99extern int alloc_space;
    10 void *jmalloc(int32_t size, char *what_for);
    11 void *jrealloc(void *ptr, int32_t size, char *what_for);
     10void *jmalloc(int32_t size, char const *what_for);
     11void *jrealloc(void *ptr, int32_t size, char const *what_for);
    1212void jfree(void *ptr);
    13 void mem_report(char *filename);
     13void mem_report(char const *filename);
    1414void jmalloc_init(int32_t min_size);
    1515void jmalloc_uninit();
  • abuse/trunk/src/imlib/include/jwindow.hpp

    r17 r39  
    8484  input_manager *inm;
    8585  void *local_info;     // pointer to info block for local system (may support windows)
    86   jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char *Name=NULL);
     86  jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char const *Name=NULL);
    8787  void redraw(int hi, int med, int low, JCFont *fnt);
    8888  void resize(int L, int H);
     
    116116  window_manager(image *Screen, palette *Pal, int Hi, int Med, int Low, JCFont *Font);
    117117
    118   jwindow *new_window(int x, int y, int l, int h, ifield *fields=NULL, char *Name=NULL);
     118  jwindow *new_window(int x, int y, int l, int h, ifield *fields=NULL, char const *Name=NULL);
    119119  void set_frame_font(JCFont *fnt) { wframe_fnt=fnt; }
    120120  JCFont *frame_font() { return wframe_fnt; }
  • abuse/trunk/src/imlib/include/keys.hpp

    r2 r39  
    4343
    4444// returns a value describing a key name
    45 int key_value( char *buffer );
     45int key_value(char const *buffer);
    4646
    4747#endif
  • abuse/trunk/src/imlib/include/pcxread.hpp

    r2 r39  
    88enum PCX_type { not_PCX, PCX_8, PCX_24 };
    99
    10 PCX_type PCX_file_type(char *filename);
    11 image24 *read_PCX24(char *filename);
    12 image *read_PCX(char *filename, palette *&pal);
    13 void write_PCX(image *im, palette *pal,char *filename);
     10PCX_type PCX_file_type(char const *filename);
     11image24 *read_PCX24(char const *filename);
     12image *read_PCX(char const *filename, palette *&pal);
     13void write_PCX(image *im, palette *pal, char const *filename);
    1414
    1515#endif
  • abuse/trunk/src/imlib/include/pmenu.hpp

    r2 r39  
    1111  int hotkey;
    1212public :
    13   char *n,*on_off;
     13  char *n;
     14  char const *on_off;
    1415  psub_menu *sub;
    1516
    1617  int id,xp;
    1718  pmenu_item *next;
    18   pmenu_item(int ID, char *name, char *on_off_flag, int Hotkey, pmenu_item *Next);
    19   pmenu_item(char *Name, psub_menu *Sub, pmenu_item *Next, int xpos=-1);
     19  pmenu_item(int ID, char const *name, char const *on_off_flag, int Hotkey, pmenu_item *Next);
     20  pmenu_item(char const *Name, psub_menu *Sub, pmenu_item *Next, int xpos=-1);
    2021  char *name() { return n; }
    2122  pmenu_item *find_id(int search_id);
  • abuse/trunk/src/imlib/include/sound.hpp

    r2 r39  
    2828  unsigned long song_id;
    2929public :
    30   char *name() { return Name; }
    31   song(char *filename);
     30  char const *name() { return Name; }
     31  song(char const *filename);
    3232  void play(unsigned char volume=127);
    3333  void stop(long fadeout_time=0);                                        // time in ms
  • abuse/trunk/src/imlib/include/specs.hpp

    r17 r39  
    99#include <stdint.h>
    1010
    11 extern char *spec_types[];
     11extern char const *spec_types[];
    1212
    1313#define SPEC_INVALID_TYPE    0
     
    6161*/
    6262
    63 void set_spec_main_file(char *filename, int search_order=SPEC_SEARCH_OUTSIDE_INSIDE);
    64 
    65 void set_filename_prefix(char *prefix);
     63void set_spec_main_file(char const *filename, int search_order=SPEC_SEARCH_OUTSIDE_INSIDE);
     64
     65void set_filename_prefix(char const *prefix);
    6666char *get_filename_prefix();
    67 void set_save_filename_prefix(char *prefix);
     67void set_save_filename_prefix(char const *prefix);
    6868char *get_save_filename_prefix();
    6969#define JFILE_CLONED 1
     
    7878
    7979  virtual int unbuffered_read(void *buf, size_t count)  = 0;
    80   virtual int unbuffered_write(void *buf, size_t count) = 0;
     80  virtual int unbuffered_write(void const *buf, size_t count) = 0;
    8181  virtual int unbuffered_tell()                         = 0;
    8282  virtual int unbuffered_seek(long offset, int whence)  = 0;   // whence=SEEK_SET, SEEK_CUR,
     
    8787  bFILE();
    8888  virtual int open_failure() = 0;
    89   int read(void *buf, size_t count);       // returns number of bytes read, calls unbuffer_read
    90   int write(void *buf, size_t count);      // returns number of bytes written
    91   int seek(long offset, int whence);       // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
     89  int read(void *buf, size_t count);        // returns number of bytes read, calls unbuffer_read
     90  int write(void const *buf, size_t count); // returns number of bytes written
     91  int seek(long offset, int whence);        // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
    9292  int tell();
    9393  virtual int file_size() = 0;
     
    121121        int get_fd() const { return fd; }
    122122
    123   void open_internal(char *filename, char *mode, int flags);
    124   void open_external(char *filename, char *mode, int flags);
    125 
    126   jFILE(char *filename, char *access_string);      // same as fopen parameters
     123  void open_internal(char const *filename, char const *mode, int flags);
     124  void open_external(char const *filename, char const *mode, int flags);
     125
     126  jFILE(char const *filename, char const *access_string);      // same as fopen parameters
    127127  jFILE(FILE *file_pointer);                      // assumes fp is at begining of file
    128128  virtual int open_failure() { return fd<0; }
    129129  virtual int unbuffered_read(void *buf, size_t count);       // returns number of bytes read
    130   virtual int unbuffered_write(void *buf, size_t count);     // returns number of bytes written
     130  virtual int unbuffered_write(void const *buf, size_t count);     // returns number of bytes written
    131131  virtual int unbuffered_seek(long offset, int whence);      // whence=SEEK_SET, SEEK_CUR,
    132132                                                             // SEEK_END, ret=0=success
     
    144144 
    145145  spec_entry(unsigned char spec_type,
    146              char *object_name,
    147              char *link_filename,
     146             char const *object_name,
     147             char const *link_filename,
    148148             unsigned long data_size,
    149149             unsigned long data_offset)
     
    170170  spec_directory(bFILE *fp);
    171171  spec_directory();
    172   spec_entry *find(char *name);
    173   spec_entry *find(char *name, int type);
     172  spec_entry *find(char const *name);
     173  spec_entry *find(char const *name, int type);
    174174  spec_entry *find(int type);
    175   long find_number(char*name);
     175  long find_number(char const *name);
    176176  long find_number(int type);
    177177  void remove(spec_entry *e);
     
    181181  long data_end_offset();    // this should be the end of the file
    182182  long type_total(int type);
    183   jFILE *write(char *filename);
     183  jFILE *write(char const *filename);
    184184  int    write(bFILE *fp);
    185185  void print();
     
    207207
    208208void set_spec_main_file(char *filename, int Search_order);
    209 void set_file_opener(bFILE *(*open_fun)(char *, char *));
     209void set_file_opener(bFILE *(*open_fun)(char const *, char const *));
    210210void set_no_space_handler(void (*handle_fun)());
    211 bFILE *open_file(char *filename, char *mode);
     211bFILE *open_file(char const *filename, char const *mode);
    212212#endif
    213213
  • abuse/trunk/src/imlib/include/status.hpp

    r14 r39  
    88{
    99  public :
    10   virtual void push(char *name, visual_object *show) = 0;
     10  virtual void push(char const *name, visual_object *show) = 0;
    1111  virtual void update(int percentage) = 0;
    1212  virtual void pop() = 0;
     
    2424  text_status_node *first;
    2525  text_status_manager();
    26   virtual void push(char *name, visual_object *show);
     26  virtual void push(char const *name, visual_object *show);
    2727  virtual void update(int percentage);
    2828  virtual void pop();
     
    3535{
    3636  public :
    37   stack_stat(char *st, visual_object *show=NULL) { if (stat_man) stat_man->push(st,show); }
     37  stack_stat(char const *st, visual_object *show=NULL) { if (stat_man) stat_man->push(st,show); }
    3838  ~stack_stat() { if (stat_man) stat_man->pop(); }
    3939} ;
  • abuse/trunk/src/imlib/include/timage.hpp

    r17 r39  
    2323  short height() { return h; }
    2424  short width() { return w; } 
    25   trans_image(image *im, char *name);  // name has no meaning if MEM_CHECK is off
     25  trans_image(image *im, char const *name);  // name has no meaning if MEM_CHECK is off
    2626  void put_image(image *screen, int x, int y);   // always transparent   
    2727
  • abuse/trunk/src/imlib/input.cpp

    r4 r39  
    198198
    199199
    200 button::button(int X, int Y, int ID, char *Text, ifield *Next)
     200button::button(int X, int Y, int ID, char const *Text, ifield *Next)
    201201
    202202  x=X; y=Y; id=ID;
     
    225225
    226226
    227 void text_field::change_data(char *new_data, int new_cursor, // cursor==-1, does not change it.
     227void text_field::change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it.
    228228                             int active, image *screen, window_manager *wm)
    229229{
     
    317317}
    318318
    319 text_field::text_field(int X, int Y, int ID, char *Prompt, char *Format,
    320                                                      char *Data, ifield *Next)
     319text_field::text_field(int X, int Y, int ID, char const *Prompt,
     320                       char const *Format, char const *Data, ifield *Next)
    321321{
    322322  int slen=(strlen(Format)>strlen(Data) ? strlen(Format) : strlen(Data));
     
    331331}
    332332
    333 text_field::text_field(int X, int Y, int ID, char *Prompt, char *Format,
    334                                double Data, ifield *Next)
     333text_field::text_field(int X, int Y, int ID, char const *Prompt,
     334                       char const *Format, double Data, ifield *Next)
    335335{
    336336  char num[20];
     
    446446
    447447
    448 info_field::info_field(int X, int Y, int ID, char *info, ifield *Next)
    449 {
    450   x=X; y=Y; id=ID; next=Next;
    451   text=strcpy((char *)jmalloc(strlen(info)+1,"info_field"),info);
    452   w=-1;
     448info_field::info_field(int X, int Y, int ID, char const *info, ifield *Next)
     449{
     450  x = X; y = Y; id = ID; next = Next;
     451  text = strcpy((char *)jmalloc(strlen(info)+1,"info_field"), info);
     452  w = -1;
    453453}
    454454
     
    478478}
    479479
    480 void info_field::put_para(image *screen, char *st, int dx, int dy,
     480void info_field::put_para(image *screen, char const *st, int dx, int dy,
    481481                          int xspace, int yspace, JCFont *font, int color)
    482482{
  • abuse/trunk/src/imlib/jmalloc.cpp

    r17 r39  
    6363
    6464  void init(void *block, int32_t Block_size, uint8_t type);
    65   void *static_alloc(int32_t size, char *name);
    66   void *cache_alloc(int32_t size, char *name);
     65  void *static_alloc(int32_t size, char const *name);
     66  void *cache_alloc(int32_t size, char const *name);
    6767  void static_free(void *ptr);
    6868  void cache_free(void *ptr);
     
    325325}
    326326
    327 void *block_manager::static_alloc(int32_t size, char *name)
     327void *block_manager::static_alloc(int32_t size, char const *name)
    328328{
    329329  if (size<JM_SMALL_SIZE)
     
    405405
    406406
    407 void *block_manager::cache_alloc(int32_t size, char *name)
     407void *block_manager::cache_alloc(int32_t size, char const *name)
    408408{
    409409  if (size<JM_SMALL_SIZE)
     
    683683
    684684 
    685 int jmalloc_max_size=3072000;
    686 int jmalloc_min_low_size=0x1000;
    687 char *not_enough_total_memory_message="Memory manager : Sorry you do not have enough memory available to\n"
    688                                        "                 run this program.\n"
    689                                        "    DOS users  : Remove any TSR's and device drivers you can.\n"
    690                                        "    UNIX users : Do you have a swapfile/partition setup?\n";
    691 char *not_enough_low_memory_message="Memory Manager : Not enough low memory available (%d : need %d)\n"
    692                                    "  Suggestions...\n"
    693                                    "    - make a boot disk\n"
    694                                    "    - remove TSR's  & drivers not needed by ABUSE\n"
    695                                    "    - add memory to your system\n";
     685int jmalloc_max_size = 3072000;
     686int jmalloc_min_low_size = 0x1000;
     687static char const *not_enough_total_memory_message =
     688    "Memory manager : Sorry you do not have enough memory available to\n"
     689    "                 run this program.\n"
     690    "    DOS users  : Remove any TSR's and device drivers you can.\n"
     691    "    UNIX users : Do you have a swapfile/partition setup?\n";
     692static char const *not_enough_low_memory_message =
     693    "Memory Manager : Not enough low memory available (%d : need %d)\n"
     694    "  Suggestions...\n"
     695    "    - make a boot disk\n"
     696    "    - remove TSRs & drivers not needed by ABUSE\n"
     697    "    - add memory to your system\n";
    696698
    697699void jmalloc_init(int32_t min_size)
     
    784786
    785787
    786 void *jmalloc(int32_t size, char *name)
     788void *jmalloc(int32_t size, char const *name)
    787789
    788790  if (!bmanage_total)
     
    837839
    838840
    839 void *jrealloc(void *ptr, int32_t size, char *name)
     841void *jrealloc(void *ptr, int32_t size, char const *name)
    840842
    841843  if (!ptr) return jmalloc(size,name);
     
    882884
    883885
    884 void mem_report(char *filename)
     886void mem_report(char const *filename)
    885887{
    886888        char *reportpath;
  • abuse/trunk/src/imlib/jwindow.cpp

    r4 r39  
    258258}
    259259
    260 jwindow *window_manager::new_window(int x, int y, int l, int h, ifield *fields, char *Name)
     260jwindow *window_manager::new_window(int x, int y, int l, int h, ifield *fields, char const *Name)
    261261{
    262262  if (x>screen->width()-4) x=screen->width()-25;
     
    339339}
    340340
    341 jwindow::jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char *Name)
     341jwindow::jwindow(int X, int Y, int L, int H, window_manager *wm, ifield *fields, char const *Name)
    342342{
    343343  ifield *i;
  • abuse/trunk/src/imlib/keys.cpp

    r4 r39  
    33#include <ctype.h>
    44
    5 char *jk_key_names[]= {"Up Arrow","Down Arrow","Left Arrow","Right Arrow",
    6                     "Left Ctrl","Right Ctrl","Left Alt","Right Alt",
    7                     "Left Shift","Right Shift","Caps Lock","Num Lock",
    8                     "Home","End","Del","F1","F2","F3","F4","F5","F6",
    9                     "F7","F8","F9","F10","Insert","PageUp","PageDown","Command"};
    10 
     5char const *jk_key_names[]=
     6{
     7    "Up Arrow","Down Arrow","Left Arrow","Right Arrow",
     8    "Left Ctrl","Right Ctrl","Left Alt","Right Alt",
     9    "Left Shift","Right Shift","Caps Lock","Num Lock",
     10    "Home","End","Del","F1","F2","F3","F4","F5","F6",
     11    "F7","F8","F9","F10","Insert","PageUp","PageDown","Command"
     12};
    1113
    1214void key_name(int key, char *buffer)
    1315{
    14         //static char sing[2];
    15         if( key > 255 && key <= JK_MAX_KEY )
    16                 strcpy(buffer,jk_key_names[key-256]);
    17         else if( key == JK_BACKSPACE )
    18                 strcpy(buffer,"Backspace");
    19         else if( key == JK_TAB )
    20                 strcpy(buffer,"Tab");
    21         else if( key == JK_ENTER )
    22                 strcpy(buffer,"Enter");
    23         else if( key == JK_ESC )
    24                 strcpy(buffer,"Esc");
    25         else if( key == JK_SPACE )
    26                 strcpy( buffer, "Space" );
    27         else if( isprint(key) )
    28         {
    29                 buffer[0] = key;
    30                 buffer[1] = 0;
    31         }
    32         else
    33         {
    34                 buffer[0] = 0;
    35         }
     16    //static char sing[2];
     17    if( key > 255 && key <= JK_MAX_KEY )
     18        strcpy(buffer,jk_key_names[key-256]);
     19    else if( key == JK_BACKSPACE )
     20        strcpy(buffer,"Backspace");
     21    else if( key == JK_TAB )
     22        strcpy(buffer,"Tab");
     23    else if( key == JK_ENTER )
     24        strcpy(buffer,"Enter");
     25    else if( key == JK_ESC )
     26        strcpy(buffer,"Esc");
     27    else if( key == JK_SPACE )
     28        strcpy( buffer, "Space" );
     29    else if( isprint(key) )
     30    {
     31        buffer[0] = key;
     32        buffer[1] = 0;
     33    }
     34    else
     35    {
     36        buffer[0] = 0;
     37    }
    3638}
    3739
    38 int key_value( char *buffer )
     40int key_value(char const *buffer)
    3941{
    40         if( strcasecmp( buffer, "Backspace" ) == 0 )
    41                 return JK_BACKSPACE;
    42         if( strcasecmp( buffer, "Tab" ) == 0 )
    43                 return JK_TAB;
    44         if( strcasecmp( buffer, "Enter" ) == 0 )
    45                 return JK_ENTER;
    46         if( strcasecmp( buffer, "ESC" ) == 0 )
    47                 return JK_ESC;
    48         if( strcasecmp( buffer, "Space" ) == 0 )
    49                 return JK_SPACE;
    50         if( strcasecmp( buffer, "Up" ) == 0 )
    51                 return JK_UP;
    52         if( strcasecmp( buffer, "Down" ) == 0 )
    53                 return JK_DOWN;
    54         if( strcasecmp( buffer, "Left" ) == 0 )
    55                 return JK_LEFT;
    56         if( strcasecmp( buffer, "Right" ) == 0 )
    57                 return JK_RIGHT;
    58         if( strcasecmp( buffer, "CTRL_L" ) == 0 )
    59                 return JK_CTRL_L;
    60         if( strcasecmp( buffer, "CTRL_R" ) == 0 )
    61                 return JK_CTRL_R;
    62         if( strcasecmp( buffer, "ALT_L" ) == 0 )
    63                 return JK_ALT_L;
    64         if( strcasecmp( buffer, "ALT_R" ) == 0 )
    65                 return JK_ALT_R;
    66         if( strcasecmp( buffer, "SHIFT_L" ) == 0 )
    67                 return JK_SHIFT_L;
    68         if( strcasecmp( buffer, "SHIFT_R" ) == 0 )
    69                 return JK_SHIFT_R;
    70         if( strcasecmp( buffer, "Caps" ) == 0 )
    71                 return JK_CAPS;
    72         if( strcasecmp( buffer, "Num_Lock" ) == 0 )
    73                 return JK_NUM_LOCK;
    74         if( strcasecmp( buffer, "Home" ) == 0 )
    75                 return JK_HOME;
    76         if( strcasecmp( buffer, "End" ) == 0 )
    77                 return JK_END;
    78         if( strcasecmp( buffer, "Del" ) == 0 )
    79                 return JK_DEL;
    80         if( strcasecmp( buffer, "F1" ) == 0 )
    81                 return JK_F1;
    82         if( strcasecmp( buffer, "F2" ) == 0 )
    83                 return JK_F2;
    84         if( strcasecmp( buffer, "F3" ) == 0 )
    85                 return JK_F3;
    86         if( strcasecmp( buffer, "F4" ) == 0 )
    87                 return JK_F4;
    88         if( strcasecmp( buffer, "F5" ) == 0 )
    89                 return JK_F5;
    90         if( strcasecmp( buffer, "F6" ) == 0 )
    91                 return JK_F6;
    92         if( strcasecmp( buffer, "F7" ) == 0 )
    93                 return JK_F7;
    94         if( strcasecmp( buffer, "F8" ) == 0 )
    95                 return JK_F8;
    96         if( strcasecmp( buffer, "F9" ) == 0 )
    97                 return JK_F9;
    98         if( strcasecmp( buffer, "F10" ) == 0 )
    99                 return JK_F10;
    100         if( strcasecmp( buffer, "Insert" ) == 0 )
    101                 return JK_INSERT;
    102         if( strcasecmp( buffer, "PageUp" ) == 0 )
    103                 return JK_PAGEUP;
    104         if( strcasecmp( buffer, "PageDown" ) == 0 )
    105                 return JK_PAGEDOWN;
     42    if( strcasecmp( buffer, "Backspace" ) == 0 )
     43        return JK_BACKSPACE;
     44    if( strcasecmp( buffer, "Tab" ) == 0 )
     45        return JK_TAB;
     46    if( strcasecmp( buffer, "Enter" ) == 0 )
     47        return JK_ENTER;
     48    if( strcasecmp( buffer, "ESC" ) == 0 )
     49        return JK_ESC;
     50    if( strcasecmp( buffer, "Space" ) == 0 )
     51        return JK_SPACE;
     52    if( strcasecmp( buffer, "Up" ) == 0 )
     53        return JK_UP;
     54    if( strcasecmp( buffer, "Down" ) == 0 )
     55        return JK_DOWN;
     56    if( strcasecmp( buffer, "Left" ) == 0 )
     57        return JK_LEFT;
     58    if( strcasecmp( buffer, "Right" ) == 0 )
     59        return JK_RIGHT;
     60    if( strcasecmp( buffer, "CTRL_L" ) == 0 )
     61        return JK_CTRL_L;
     62    if( strcasecmp( buffer, "CTRL_R" ) == 0 )
     63        return JK_CTRL_R;
     64    if( strcasecmp( buffer, "ALT_L" ) == 0 )
     65        return JK_ALT_L;
     66    if( strcasecmp( buffer, "ALT_R" ) == 0 )
     67        return JK_ALT_R;
     68    if( strcasecmp( buffer, "SHIFT_L" ) == 0 )
     69        return JK_SHIFT_L;
     70    if( strcasecmp( buffer, "SHIFT_R" ) == 0 )
     71        return JK_SHIFT_R;
     72    if( strcasecmp( buffer, "Caps" ) == 0 )
     73        return JK_CAPS;
     74    if( strcasecmp( buffer, "Num_Lock" ) == 0 )
     75        return JK_NUM_LOCK;
     76    if( strcasecmp( buffer, "Home" ) == 0 )
     77        return JK_HOME;
     78    if( strcasecmp( buffer, "End" ) == 0 )
     79        return JK_END;
     80    if( strcasecmp( buffer, "Del" ) == 0 )
     81        return JK_DEL;
     82    if( strcasecmp( buffer, "F1" ) == 0 )
     83        return JK_F1;
     84    if( strcasecmp( buffer, "F2" ) == 0 )
     85        return JK_F2;
     86    if( strcasecmp( buffer, "F3" ) == 0 )
     87        return JK_F3;
     88    if( strcasecmp( buffer, "F4" ) == 0 )
     89        return JK_F4;
     90    if( strcasecmp( buffer, "F5" ) == 0 )
     91        return JK_F5;
     92    if( strcasecmp( buffer, "F6" ) == 0 )
     93        return JK_F6;
     94    if( strcasecmp( buffer, "F7" ) == 0 )
     95        return JK_F7;
     96    if( strcasecmp( buffer, "F8" ) == 0 )
     97        return JK_F8;
     98    if( strcasecmp( buffer, "F9" ) == 0 )
     99        return JK_F9;
     100    if( strcasecmp( buffer, "F10" ) == 0 )
     101        return JK_F10;
     102    if( strcasecmp( buffer, "Insert" ) == 0 )
     103        return JK_INSERT;
     104    if( strcasecmp( buffer, "PageUp" ) == 0 )
     105        return JK_PAGEUP;
     106    if( strcasecmp( buffer, "PageDown" ) == 0 )
     107        return JK_PAGEDOWN;
    106108
    107         // Assume they are asking for a normal key, so convert the first
    108         // character to an integer and return that
    109         return (int)buffer[0];
     109    // Assume they are asking for a normal key, so convert the first
     110    // character to an integer and return that
     111    return (int)buffer[0];
    110112}
    111113
    112 
  • abuse/trunk/src/imlib/pcxread.cpp

    r17 r39  
    5656
    5757
    58 PCX_type PCX_file_type(char *filename)
     58PCX_type PCX_file_type(char const *filename)
    5959{
    6060  FILE *fp=fopen(filename,"rb"); 
     
    108108
    109109
    110 image24 *read_PCX24(char *filename)
     110image24 *read_PCX24(char const *filename)
    111111{
    112112  if (PCX_file_type(filename)!=PCX_24) return NULL; 
     
    126126}
    127127
    128 image *read_PCX(char *filename, palette *&pal)
     128image *read_PCX(char const *filename, palette *&pal)
    129129{
    130130  if (PCX_file_type(filename)!=PCX_8) return NULL; 
     
    152152
    153153
    154 void write_PCX(image *im, palette *pal, char *filename)
     154void write_PCX(image *im, palette *pal, char const *filename)
    155155{
    156156  FILE *fp=fopen(filename,"wb");
  • abuse/trunk/src/imlib/pmenu.cpp

    r4 r39  
    4545}
    4646
    47 pmenu_item::pmenu_item(int ID, char *Name, char *on_off_flag, int Hotkey, pmenu_item *Next)
     47pmenu_item::pmenu_item(int ID, char const *Name, char const *on_off_flag, int Hotkey, pmenu_item *Next)
    4848{
    4949  xp=-1;
     
    5858}
    5959
    60 pmenu_item::pmenu_item(char *Name, psub_menu *Sub, pmenu_item *Next, int xpos)
     60pmenu_item::pmenu_item(char const *Name, psub_menu *Sub, pmenu_item *Next, int xpos)
    6161{
    6262  xp=xpos;
  • abuse/trunk/src/imlib/specs.cpp

    r17 r39  
    2020#endif
    2121
    22 char *spec_types[]={"Invalid type",             // 0
    23                     "Color table",              // 1
    24                     "Palette",                  // 2
    25                     "Invalid Type",             // 3
    26                     "Image",                    // 4
    27                     "Fore Tile",
    28                     "Back Tile",
    29                     "Character",
    30                     "8 Morph",
    31                     "16 Morph",
    32                     "Grue objs",
    33                     "Extern WAV",
    34                     "DMX MUS",
    35                     "Patched morph",
    36                     "Normal file",
    37                     "Compress1 file",
    38                     "Vector Image",
    39                     "Light list",
    40                     "Grue fgmap",
    41                     "Grue bgmap",
    42                     "Data array",
    43                     "Character2",
    44                     "Particle",
    45                     "Extern lcache"
     22char const *spec_types[] =
     23{
     24    "Invalid type", // 0
     25    "Color table",  // 1
     26    "Palette",      // 2
     27    "Invalid Type", // 3
     28    "Image",        // 4
     29    "Fore Tile",
     30    "Back Tile",
     31    "Character",
     32    "8 Morph",
     33    "16 Morph",
     34    "Grue objs",
     35    "Extern WAV",
     36    "DMX MUS",
     37    "Patched morph",
     38    "Normal file",
     39    "Compress1 file",
     40    "Vector Image",
     41    "Light list",
     42    "Grue fgmap",
     43    "Grue bgmap",
     44    "Data array",
     45    "Character2",
     46    "Particle",
     47    "Extern lcache"
    4648};
    4749
     
    6163static int fast_load_mode = 0;
    6264
    63 void set_filename_prefix(char *prefix)
     65void set_filename_prefix(char const *prefix)
    6466{
    6567        if( spec_prefix )
     
    9092
    9193
    92 void set_save_filename_prefix(char *save_prefix)
     94void set_save_filename_prefix(char const *save_prefix)
    9395{
    9496        if( save_spec_prefix )
     
    197199
    198200
    199 int bFILE::write(void *buf, size_t count)      // returns number of bytes written
     201int bFILE::write(void const *buf, size_t count)      // returns number of bytes written
    200202{
    201203  if (allow_write_buffering())
     
    263265}
    264266
    265 void set_spec_main_file(char *filename, int Search_order)
     267void set_spec_main_file(char const *filename, int Search_order)
    266268{
    267269  dprintf("Specs : main file set to %s\n",filename);
     
    319321}
    320322
    321 void jFILE::open_external(char *filename, char *mode, int flags)
     323void jFILE::open_external(char const *filename, char const *mode, int flags)
    322324{
    323325  int skip_size=0;
     
    376378  virtual int open_failure() { return 1; }
    377379  virtual int unbuffered_read(void *buf, size_t count)   { return 0; }
    378   virtual int unbuffered_write(void *buf, size_t count)  { return 0; }
     380  virtual int unbuffered_write(void const *buf, size_t count)  { return 0; }
    379381  virtual int unbuffered_seek(long offset, int whence)   { return 0; }
    380382
     
    385387
    386388
    387 static bFILE *(*open_file_fun)(char *,char *)=NULL;
    388 int (*verify_file_fun)(char *,char *)=NULL;
    389 
    390 void set_file_opener(bFILE *(*open_fun)(char *, char *))
     389static bFILE *(*open_file_fun)(char const *,char const *)=NULL;
     390int (*verify_file_fun)(char const *,char const *)=NULL;
     391
     392void set_file_opener(bFILE *(*open_fun)(char const *, char const *))
    391393{
    392394  open_file_fun=open_fun;
    393395}
    394396
    395 bFILE *open_file(char *filename, char *mode)
     397bFILE *open_file(char const *filename, char const *mode)
    396398{
    397399  if (!verify_file_fun || verify_file_fun(filename,mode))
     
    403405}
    404406
    405 void jFILE::open_internal(char *filename, char *mode, int flags)
     407void jFILE::open_internal(char const *filename, char const *mode, int flags)
    406408{
    407409  int wr=0;
    408   for (char *s=mode;*s;s++)
     410  for (char const *s=mode;*s;s++)
    409411    if (toupper(*s)=='A' || toupper(*s)=='W')
    410412      wr=1;
     
    434436}
    435437
    436 jFILE::jFILE(char *filename, char *access_string)      // same as fopen parameters
     438jFILE::jFILE(char const *filename, char const *access_string)      // same as fopen parameters
    437439{
    438440 flags=access=0; 
    439  char *s=access_string;
     441 char const *s=access_string;
    440442  for (;*s;s++)
    441443    if (toupper(*s)=='R') access=O_RDONLY;
     
    540542}
    541543
    542 int jFILE::unbuffered_write(void *buf, size_t count)
     544int jFILE::unbuffered_write(void const *buf, size_t count)
    543545{
    544546  long ret = ::write(fd,(char*)buf,count);
     
    684686}
    685687
    686 spec_entry *spec_directory::find(char *name, int type)
     688spec_entry *spec_directory::find(char const *name, int type)
    687689{
    688690  int i;
     
    694696}
    695697
    696 spec_entry *spec_directory::find(char *name)
     698spec_entry *spec_directory::find(char const *name)
    697699{
    698700  int i;
     
    704706}
    705707
    706 long spec_directory::find_number(char *name)
     708long spec_directory::find_number(char const *name)
    707709{
    708710  int i;
     
    842844}*/
    843845
    844 int write_string(bFILE *fp, char *st)
     846int write_string(bFILE *fp, char const *st)
    845847{
    846848  unsigned char length=strlen(st)+1;
     
    900902}
    901903
    902 jFILE *spec_directory::write(char *filename)
     904jFILE *spec_directory::write(char const *filename)
    903905{
    904906  jFILE *fp;
     
    10051007
    10061008
    1007 void note_open_fd(int fd, char *str)
     1009void note_open_fd(int fd, char const *str)
    10081010{
    10091011  total_files_open++;
  • abuse/trunk/src/imlib/status.cpp

    r2 r39  
    1212  visual_object *show;
    1313  int last_update;
    14   text_status_node(char *Name, visual_object *Show, text_status_node *Next)
     14  text_status_node(char const *Name, visual_object *Show, text_status_node *Next)
    1515  { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
    1616    show=Show;
     
    2929}
    3030
    31 void text_status_manager::push(char *name, visual_object *show)
     31void text_status_manager::push(char const *name, visual_object *show)
    3232{
    3333  level++;
  • abuse/trunk/src/imlib/timage.cpp

    r17 r39  
    5151}
    5252
    53 trans_image::trans_image(image *im, char *name)
     53trans_image::trans_image(image *im, char const *name)
    5454{
    5555  int size=0,x,y;
  • abuse/trunk/src/include/ability.hpp

    r2 r39  
    1717
    1818#define TOTAL_ABILITIES (walk_top_speed+1)
    19 extern char *ability_names[TOTAL_ABILITIES];
     19extern char const *ability_names[TOTAL_ABILITIES];
    2020long get_ability(int who, ability a);
    2121long get_ability_default(ability a);
  • abuse/trunk/src/include/cache.hpp

    r17 r39  
    3737  uint32_t crc;
    3838  char *filename;
    39   crced_file(char *name);
     39  crced_file(char const *name);
    4040  ~crced_file();
    4141} ;
     
    4747  public :
    4848  crc_manager();
    49   int get_filenumber(char *filename);
     49  int get_filenumber(char const *filename);
    5050  uint32_t get_crc(int32_t filenumber, int &failed);
    5151  void set_crc(int32_t filenumber, uint32_t crc);
     
    5353  void clean_up();
    5454  int total_filenames() { return total_files; }
    55   int write_crc_file(char *filename);
    56   int load_crc_file(char *filename);
     55  int write_crc_file(char const *filename);
     56  int load_crc_file(char const *filename);
    5757} ;
    5858
     
    8787  int in_use() { if (used) { used=0; return 1; } else return 0; }
    8888  int full() { if (ful) { ful=0; return 1; } else return 0; }
    89   int32_t reg_object(char *filename, void *object, int type, int rm_dups);      // lisp object
    90   int32_t reg(char *filename, char *name, int type=-1, int rm_dups=0);          // returns id to item
     89  int32_t reg_object(char const *filename, void *object, int type, int rm_dups);      // lisp object
     90  int32_t reg(char const *filename, char const *name, int type=-1, int rm_dups=0);          // returns id to item
    9191  int32_t reg_lisp_block(Cell *block);
    9292  int loaded(int id);
  • abuse/trunk/src/include/chars.hpp

    r2 r39  
    2424
    2525#define MAX_STATE (running+1)
    26 extern char *state_names[];
     26extern char const *state_names[];
    2727
    2828class named_field
     
    5555                                  // then objects will not draw a damage when hitting it
    5656     };
    57 extern char *cflag_names[TOTAL_CFLAGS];
     57extern char const *cflag_names[TOTAL_CFLAGS];
    5858
    5959// all object functions default to NULL
     
    7171       OFUN_CHANGE_TYPE
    7272     } ;
    73 extern char *ofun_names[TOTAL_OFUNS];
     73extern char const *ofun_names[TOTAL_OFUNS];
    7474
    7575
  • abuse/trunk/src/include/config.hpp

    r2 r39  
    1212void get_movement(int player, int &x, int &y, int &b1, int &b2, int &b3, int &b4);
    1313void config_cleanup();  // free any memory allocated
    14 int get_keycode(char *str);  // -1 means not a valid key code
     14int get_keycode(char const *str);  // -1 means not a valid key code
    1515
    1616#endif
  • abuse/trunk/src/include/console.hpp

    r2 r39  
    1414  public :
    1515
    16   console(window_manager *WM, JCFont *font, int width, int height, char *Name);
     16  console(window_manager *WM, JCFont *font, int width, int height, char const *Name);
    1717  int showing() { return con_win!=NULL; }
    1818  void show();
     
    2626  int wy() { return con_win->y1(); }
    2727  void draw_cursor();
    28   void put_string(char *st);
     28  void put_string(char const *st);
    2929  void draw_char(int x, int y, char ch);
    3030  void toggle() { if (con_win) hide(); else show(); }
    31   void print_f(const char *format, ...);
     31  void print_f(char const *format, ...);
    3232  ~console();
    3333} ;
     
    3737  char shcmd[300];
    3838  public :
    39   shell_term(window_manager *WM, JCFont *font, int width, int height, char *Name);
     39  shell_term(window_manager *WM, JCFont *font, int width, int height, char const *Name);
    4040  virtual ~shell_term() {};
    4141  int handle_event(event &ev, window_manager *wm);
    4242  virtual void prompt();
    43   virtual void execute(char *st);
     43  virtual void execute(char const *st);
    4444} ;
    4545
  • abuse/trunk/src/include/dev.hpp

    r16 r39  
    1515void dev_cleanup();
    1616void toggle_edit_mode();
    17 char *symbol_str(char *name);
     17char const *symbol_str(char const *name);
    1818
    1919class pal_win
     
    8585  void toggle_light_window();
    8686  void toggle_search_window();
    87   void show_char_mem(char *name);
     87  void show_char_mem(char const *name);
    8888  void close_oedit_window();
    8989  void show_mem();
    9090  dev_controll();
    9191  void handle_event(event &ev);
    92   void do_command(char *st, event &ev);
     92  void do_command(char const *st, event &ev);
    9393  int is_pal_win(jwindow *win);
    9494  void dev_draw(view *v);
  • abuse/trunk/src/include/extend.hpp

    r17 r39  
    4141  morph_char *mc;
    4242  int total_vars();
    43   char *var_name(int x);
    44   int   var_type(int x);
     43  char const *var_name(int x);
     44  int var_type(int x);
    4545  void set_var(int x, uint32_t v);
    4646  int32_t get_var(int x);
  • abuse/trunk/src/include/game.hpp

    r17 r39  
    5050extern int demo_start,idle_ticks;
    5151
     52extern FILE *open_FILE(char const *filename, char const *mode);
     53
    5254class game
    5355{
     
    8082  game(int argc, char **argv);
    8183  void step();
    82   void show_help(char *st);
     84  void show_help(char const *st);
    8385  void draw_value(image *screen, int x, int y, int w, int h, int val, int max);
    8486  unsigned char get_color(int x) { return x; }
     
    120122
    121123  int in_area(event &ev, int x1, int y1, int x2, int y2);
    122   void load_level(char *name);
     124  void load_level(char const *name);
    123125  void set_level(level *nl);
    124126  void show_time();
  • abuse/trunk/src/include/gui.hpp

    r2 r39  
    1010  char key[16];
    1111public :
    12   ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id=-1, char *help_key=NULL);
     12  ico_button(int X, int Y, int ID, int Up, int down, int upa, int downa, ifield *Next, int act_id=-1, char const *help_key=NULL);
    1313
    1414  virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
  • abuse/trunk/src/include/items.hpp

    r17 r39  
    1414{
    1515public : 
    16   boundary(bFILE *fp,char *er_name);
     16  boundary(bFILE *fp,char const *er_name);
    1717  uint8_t *inside;     // tells which side of the line is on the inside
    1818  boundary(boundary *p);      // flips the *inside list
  • abuse/trunk/src/include/language.hpp

    r2 r39  
    1 char *lang_string(char *symbol);
     1char const *lang_string(char const *symbol);
  • abuse/trunk/src/include/level.hpp

    r17 r39  
    8585  uint16_t background_height() { return bg_height; }
    8686  int load_failed() { return map_fg==NULL; }
    87   level(spec_directory *sd, bFILE *fp, char *lev_name);
     87  level(spec_directory *sd, bFILE *fp, char const *lev_name);
    8888  void load_fail();             
    89   level(int width, int height, char *name); 
    90   int save(char *filename, int save_all);  // save_all includes player and view information (1 = success)
    91   void set_name(char *name) { Name=strcpy((char *)jrealloc(Name,strlen(name)+1,"map name"),name); }
     89  level(int width, int height, char const *name); 
     90  int save(char const *filename, int save_all);  // save_all includes player and view information (1 = success)
     91  void set_name(char const *name) { Name=strcpy((char *)jrealloc(Name,strlen(name)+1,"map name"),name); }
    9292  void set_size(int w, int h);
    9393  void remove_light(light_source *which);
  • abuse/trunk/src/include/light.hpp

    r17 r39  
    5555                               int32_t inner, int32_t outer, int32_t xshift, int32_t yshift);
    5656
    57 void add_light_spec(spec_directory *sd, char *level_name);
     57void add_light_spec(spec_directory *sd, char const *level_name);
    5858void write_lights(bFILE *fp);
    59 void read_lights(spec_directory *sd, bFILE *fp, char *level_name);
     59void read_lights(spec_directory *sd, bFILE *fp, char const *level_name);
    6060
    6161
  • abuse/trunk/src/include/lisp.hpp

    r19 r39  
    139139void *lisp_eq(void *n1, void *n2);
    140140void *lisp_equal(void *n1, void *n2);
    141 lisp_symbol *find_symbol(char *name);
     141lisp_symbol *find_symbol(char const *name);
    142142long list_length(void *i);
    143143void lprint(void *i);
     
    146146void *eval_function(lisp_symbol *sym, void *arg_list);
    147147void *eval_user_fun(lisp_symbol *sym, void *arg_list);
    148 void *compile(char *&s);
     148void *compile(char const *&s);
    149149void *symbol_value(void *symbol);
    150150void *symbol_function(void *symbol);
     
    155155void resize_tmp(int new_size);
    156156void resize_perm(int new_size);
    157 lisp_symbol *make_find_symbol(char *name);
     157lisp_symbol *make_find_symbol(char const *name);
    158158
    159159void push_onto_list(void *object, void *&list);
    160160lisp_symbol *add_c_object(void *symbol, int16_t number);
    161 lisp_symbol *add_c_function(char *name, short min_args, short max_args, short number);
    162 lisp_symbol *add_c_bool_fun(char *name, short min_args, short max_args, short number);
    163 lisp_symbol *add_lisp_function(char *name, short min_args, short max_args, short number);
     161lisp_symbol *add_c_function(char const *name, short min_args, short max_args, short number);
     162lisp_symbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number);
     163lisp_symbol *add_lisp_function(char const *name, short min_args, short max_args, short number);
    164164int read_ltoken(char *&s, char *buffer);
    165165cons_cell *new_cons_cell();
     
    170170lisp_pointer *new_lisp_pointer(void *addr);
    171171lisp_character *new_lisp_character(uint16_t ch);
    172 lisp_string *new_lisp_string(char *string);
    173 lisp_string *new_lisp_string(char *string, int length);
     172lisp_string *new_lisp_string(char const *string);
     173lisp_string *new_lisp_string(char const *string, int length);
    174174lisp_string *new_lisp_string(int length);
    175175lisp_fixed_point *new_lisp_fixed_point(int32_t x);
  • abuse/trunk/src/include/lisp2.hpp

    r2 r39  
    8282void lisp_init (long a, long b);
    8383void lisp_uninit (void);
    84 char* lstring_value (void* x);
     84char * lstring_value (void* x);
    8585long lnumber_value (void* x);
    8686char lcharacter_value (void* x);
  • abuse/trunk/src/include/loadgame.hpp

    r2 r39  
    33
    44int show_load_icon();
    5 int load_game(int show_all, char *title);
     5int load_game(int show_all, char const *title);
    66void get_savegame_name(char *buf);  // buf should be at least 50 bytes
    77void last_savegame_name(char *buf);
  • abuse/trunk/src/include/netcfg.hpp

    r2 r39  
    2424  net_configuration();
    2525  int input();   // pulls up dialog box and input fileds
    26   void cfg_error(char *msg);
     26  void cfg_error(char const *msg);
    2727  int confirm_inputs(jwindow *j, int server);
    28   void error(char *message);
     28  void error(char const *message);
    2929  int confirm_inputs(input_manager *i, int server);
    3030  ifield *center_ifield(ifield *i,int x1, int x2, ifield *place_below);
  • abuse/trunk/src/include/nfserver.hpp

    r2 r39  
    1515
    1616int net_start();
    17 bFILE *open_nfs_file(char *filename,char *mode);
     17bFILE *open_nfs_file(char const *filename, char const *mode);
    1818
    1919int net_init(int argc, char **argv);
    20 int NF_open_file(char *filename, char *mode);
     20int NF_open_file(char const *filename, char const *mode);
    2121long NF_close(int fd);
    2222long NF_read(int fd, void *buf, long size);
     
    3030void net_reload();
    3131void read_new_views();
    32 int set_file_server(char *name);
     32int set_file_server(char const *name);
    3333int set_file_server(net_address *addr);
    3434
  • abuse/trunk/src/include/objects.hpp

    r18 r39  
    3737
    3838#define TOTAL_OBJECT_VARS 28
    39 struct obj_desc { char *name; int type; } ;
     39struct obj_desc { char const *name; int type; } ;
    4040extern obj_desc object_descriptions[TOTAL_OBJECT_VARS];
    4141int RC_type_size(int type);
  • abuse/trunk/src/include/property.hpp

    r2 r39  
    66{
    77  property *first;
    8   property *find(char *name);
     8  property *find(char const *name);
    99  public :
    1010  property_manager() { first=0; }
    11   void load(char *filename);
    12   void save(char *filename);
     11  void load(char const *filename);
     12  void save(char const *filename);
    1313 
    14   int getd(char *name, int def) { return (int)get(name,def); }
    15   int get(char *name, int def);
    16   char  *get(char *name, char *def);
     14  int getd(char const *name, int def) { return (int)get(name,def); }
     15  int get(char const *name, int def);
     16  char const *get(char const *name, char const *def);
    1717
    18   void setd(char *name, int def) { set(name,def); }
    19   void set(char *name, double def);
    20   void set(char *name, char *def);
     18  void setd(char const *name, int def) { set(name,def); }
     19  void set(char const *name, double def);
     20  void set(char const *name, char const *def);
    2121  ~property_manager();
    2222} ;
  • abuse/trunk/src/include/specache.hpp

    r2 r39  
    1414    spec_directory *sd;
    1515    char *filename() { return fn; }
    16     filename_node(char *filename, spec_directory *dir)
     16    filename_node(char const *filename, spec_directory *dir)
    1717    {
    1818      fn=(char *)memcpy(jmalloc(strlen(filename)+1,"spec_dir cache"),filename,strlen(filename)+1);
     
    2525  long size;
    2626  public :
    27   spec_directory *get_spec_directory(char *filename, bFILE *fp=NULL);
     27  spec_directory *get_spec_directory(char const *filename, bFILE *fp=NULL);
    2828  spec_directory_cache() { fn_root=0; size=0; }
    2929  void clear();                             // frees up all allocated memory
  • abuse/trunk/src/include/view.hpp

    r17 r39  
    119119object_node *make_player_onodes(int player_num=-1);
    120120int total_view_vars();
    121 char *get_view_var_name(int num);
     121char const *get_view_var_name(int num);
    122122ushort make_sync();
    123123
  • abuse/trunk/src/innet.cpp

    r17 r39  
    1212
    1313*/
     14#include <stdio.h>
     15
    1416#include "demo.hpp"
    1517#include "macs.hpp"
     
    1719#include "level.hpp"
    1820#include "game.hpp"
    19 #include <stdio.h>
     21#include "dev.hpp"
    2022#include "timing.hpp"
    2123#include "fileman.hpp"
     
    2628#include "dprint.hpp"
    2729#include "netcfg.hpp"
    28 
    29 extern char *symbol_str(char *name);
    3030
    3131#ifdef __WATCOMC__
     
    4444join_struct *join_array=NULL;      // points to an array of possible joining clients
    4545extern char *get_login();
    46 extern void set_login(char *name);
     46extern void set_login(char const *name);
    4747
    4848
     
    145145        {
    146146                dprintf("Attempting to locate server %s, please wait\n",main_net_cfg->server_name);
    147                 char *sn=main_net_cfg->server_name;
     147                char const *sn=main_net_cfg->server_name;
    148148                net_server=prot->get_node_address(sn,DEFAULT_COMM_PORT,0);
    149149                if (!net_server)
     
    219219}
    220220
    221 int NF_set_file_server(char *name)
     221int NF_set_file_server(char const *name)
    222222{
    223223  if (prot)
     
    234234
    235235
    236 int NF_open_file(char *filename, char *mode)
     236int NF_open_file(char const *filename, char const *mode)
    237237{
    238238  if (prot)
  • abuse/trunk/src/items.cpp

    r17 r39  
    66extern palette *pal;
    77
    8 boundary::boundary(bFILE *fp, char *er_name) : point_list(fp)
     8boundary::boundary(bFILE *fp, char const *er_name) : point_list(fp)
    99{
    1010  int x1,y1,x2,y2,checkx,checky,i; 
  • abuse/trunk/src/language.cpp

    r2 r39  
    11#include "lisp.hpp"
    22
    3 char *lang_string(char *symbol)
     3char const *lang_string(char const *symbol)
    44{
    55  void *v=find_symbol(symbol);
  • abuse/trunk/src/level.cpp

    r18 r39  
    12641264}
    12651265
    1266 level::level(spec_directory *sd, bFILE *fp, char *lev_name)
     1266level::level(spec_directory *sd, bFILE *fp, char const *lev_name)
    12671267{
    12681268  spec_entry *e;
     
    17441744    for (i=0;i<total_view_vars();i++)
    17451745    {
    1746       char *find_name=get_view_var_name(i);
     1746      char const *find_name = get_view_var_name(i);
    17471747      se=sd->find(find_name);
    17481748
     
    21862186
    21872187
    2188 int level::save(char *filename, int save_all)
     2188int level::save(char const *filename, int save_all)
    21892189{
    21902190        char name[255], bkname[255];
     
    23402340}
    23412341
    2342 level::level(int width, int height, char *name)
     2342level::level(int width, int height, char const *name)
    23432343{
    23442344  the_game->need_refresh();
     
    32403240}
    32413241
    3242 FILE *open_FILE(char *filename, char *mode);
    3243 
    32443242void level::write_object_info(char *filename)
    32453243{
  • abuse/trunk/src/light.cpp

    r31 r39  
    11851185
    11861186
    1187 void add_light_spec(spec_directory *sd, char *level_name)
     1187void add_light_spec(spec_directory *sd, char const *level_name)
    11881188{
    11891189  int32_t size=4+4;  // number of lights and minimum light levels
     
    12131213
    12141214
    1215 void read_lights(spec_directory *sd, bFILE *fp, char *level_name)
     1215void read_lights(spec_directory *sd, bFILE *fp, char const *level_name)
    12161216{
    12171217  delete_all_lights();
  • abuse/trunk/src/lisp.cpp

    r20 r39  
    4242int current_space;  // normally set to TMP_SPACE, unless compiling or other needs
    4343
    44 inline int streq(char *s1, char *s2)   // when you don't need as much as strcmp, this is faster...
     44// when you don't need as much as strcmp, this is faster...
     45inline int streq(char const *s1, char const *s2)
    4546{
    4647  while (*s1)
     
    9899}
    99100
    100 void lbreak(const char *format, ...)
     101void lbreak(char const *format, ...)
    101102{
    102103  break_level++;
     
    136137    else
    137138    {
    138       char *s=st;
     139      char const *s=st;
    139140      do
    140141      {
     
    151152}
    152153
    153 void need_perm_space(char *why)
     154void need_perm_space(char const *why)
    154155{
    155156  if (current_space!=PERM_SPACE && current_space!=GC_SPACE)
     
    299300}
    300301
    301 struct lisp_string *new_lisp_string(char *string)
     302struct lisp_string *new_lisp_string(char const *string)
    302303{
    303304  int size=sizeof(lisp_string)+strlen(string)+1;
     
    311312}
    312313
    313 struct lisp_string *new_lisp_string(char *string, int length)
     314struct lisp_string *new_lisp_string(char const *string, int length)
    314315{
    315316  int size=sizeof(lisp_string)+length+1;
     
    451452
    452453
    453 char *lerror(char *loc, char *cause)
     454char *lerror(char const *loc, char const *cause)
    454455{
    455456  int lines;
     
    780781
    781782/*
    782 lisp_symbol *find_symbol(char *name)
     783lisp_symbol *find_symbol(char const *name)
    783784{
    784785  cons_cell *cs;
     
    792793
    793794
    794 lisp_symbol *make_find_symbol(char *name)    // find a symbol, if it doesn't exsist it is created
     795lisp_symbol *make_find_symbol(char const *name)    // find a symbol, if it doesn't exsist it is created
    795796{
    796797  lisp_symbol *s=find_symbol(name);
     
    814815*/
    815816
    816 lisp_symbol *find_symbol(char *name)
     817lisp_symbol *find_symbol(char const *name)
    817818{
    818819  lisp_symbol *p=lsym_root;
     
    829830
    830831
    831 lisp_symbol *make_find_symbol(char *name)
     832lisp_symbol *make_find_symbol(char const *name)
    832833{
    833834  lisp_symbol *p=lsym_root;
     
    992993}
    993994
    994 lisp_symbol *add_sys_function(char *name, short min_args, short max_args, short number)
     995lisp_symbol *add_sys_function(char const *name, short min_args, short max_args, short number)
    995996{
    996997  need_perm_space("add_sys_function");
     
    10181019}
    10191020
    1020 lisp_symbol *add_c_function(char *name, short min_args, short max_args, short number)
     1021lisp_symbol *add_c_function(char const *name, short min_args, short max_args, short number)
    10211022{
    10221023  total_user_functions++;
     
    10321033}
    10331034
    1034 lisp_symbol *add_c_bool_fun(char *name, short min_args, short max_args, short number)
     1035lisp_symbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number)
    10351036{
    10361037  total_user_functions++;
     
    10471048
    10481049
    1049 lisp_symbol *add_lisp_function(char *name, short min_args, short max_args, short number)
     1050lisp_symbol *add_lisp_function(char const *name, short min_args, short max_args, short number)
    10501051{
    10511052  total_user_functions++;
     
    10611062}
    10621063
    1063 void skip_c_comment(char *&s)
     1064void skip_c_comment(char const *&s)
    10641065{
    10651066  s+=2;
     
    10731074}
    10741075
    1075 long str_token_len(char *st)
     1076long str_token_len(char const *st)
    10761077{
    10771078  long x=1;
     
    10841085}
    10851086
    1086 int read_ltoken(char *&s, char *buffer)
     1087int read_ltoken(char const *&s, char *buffer)
    10871088{
    10881089  // skip space
     
    11271128char n[MAX_LISP_TOKEN_LEN];  // assume all tokens will be < 200 characters
    11281129
    1129 int end_of_program(char *s)
     1130int end_of_program(char const *s)
    11301131{
    11311132  return !read_ltoken(s,n);
     
    11441145void *comp_optimize(void *list);
    11451146
    1146 void *compile(char *&s)
     1147void *compile(char const *&s)
    11471148{
    11481149  void *ret=NULL;
     
    11981199    do
    11991200    {
    1200       char *tmp=s;
     1201      char const *tmp=s;
    12011202      if (!read_ltoken(tmp,n))           // check for the end of the list
    12021203        lerror(NULL,"unexpected end of program");
     
    12991300
    13001301
    1301 static void lprint_string(char *st)
     1302static void lprint_string(char const *st)
    13021303{
    13031304  if (current_print_file)
    13041305  {
    1305     for (char *s=st;*s;s++)
     1306    for (char const *s=st;*s;s++)
    13061307    {
    13071308/*      if (*s=='\\')
     
    24352436                                s[l]=0;
    24362437                                delete fp;
    2437                                 char *cs=s;
     2438                                char const *cs=s;
    24382439                        #ifndef NO_LIBS
    24392440                                char msg[100];
     
    30973098
    30983099#define TOTAL_SYS_FUNCS 99
    3099                                  //  0      1    2       3       4      5      6      7
    3100 char *sys_funcs[TOTAL_SYS_FUNCS]={"print","car","cdr","length","list","cons","quote","eq",
    3101                                 // 8   9   10    11       12          13     14      15      16
    3102                                   "+","-","if","setf","symbol-list","assoc","null","acons","pairlis",
    3103                                 // 17     18     19     20     21     22    23      24
    3104                                   "let","defun","atom","not", "and", "or","progn","equal",
    3105                                 // 25               26          27       28  29   30     31
    3106                                   "concatenate","char-code","code-char","*","/","cond","select",
    3107                                 // 32            33         34     35    36    37       
    3108                                   "function", "mapcar", "funcall", ">", "<", "tmp-space",
    3109                                 //   38              39        40       41         42
    3110                                   "perm-space","symbol-name","trace","untrace","digstr",
    3111                                 //   43            44   45    46    47  48       49
    3112                                   "compile-file","abs","min","max",">=","<=","backquote",
    3113                                 //  50      51      52         53           54    55     56
    3114                                   "comma","nth","resize-tmp","resize-perm","cos","sin","atan2",
    3115                                   // 57       58     59     60     61   62              63
    3116                                   "enum", "quit","eval","break","mod","write_profile","setq",
    3117                                   // 64    65          66      67       68        69        70
    3118                                   "for", "open_file","load","bit-and","bit-or","bit-xor","make-array",
    3119                                   // 71      72          73          74        75      76
    3120                                   "aref","if-1progn","if-2progn","if-12progn","eq0","preport",
    3121                                   // 77     78         79        80       81     82     83
    3122                                   "search","elt",    "listp", "numberp", "do",  "gc", "schar",
    3123                                   // 84       85        86      87      88        89    90
    3124                                   "symbolp","num2str","nconc","first","second","third","fourth",
    3125                                   // 91       92       93       94       95      96
    3126                                   "fifth", "sixth", "seventh","eighth","ninth","tenth",
    3127                                   "substr",       // 97
    3128                                   "local_load"    // 98, filename
    3129                                 };
     3100char const *sys_funcs[TOTAL_SYS_FUNCS] =
     3101{
     3102    //  0      1    2       3       4      5      6      7
     3103    "print","car","cdr","length","list","cons","quote","eq",
     3104    // 8   9   10    11       12          13     14      15      16
     3105    "+","-","if","setf","symbol-list","assoc","null","acons","pairlis",
     3106    // 17     18     19     20     21     22    23      24
     3107    "let","defun","atom","not", "and", "or","progn","equal",
     3108    // 25               26          27       28  29   30     31
     3109    "concatenate","char-code","code-char","*","/","cond","select",
     3110    // 32            33         34     35    36    37       
     3111    "function", "mapcar", "funcall", ">", "<", "tmp-space",
     3112    //   38              39        40       41         42
     3113    "perm-space","symbol-name","trace","untrace","digstr",
     3114    //   43            44   45    46    47  48       49
     3115    "compile-file","abs","min","max",">=","<=","backquote",
     3116    //  50      51      52         53           54    55     56
     3117    "comma","nth","resize-tmp","resize-perm","cos","sin","atan2",
     3118    // 57       58     59     60     61   62              63
     3119    "enum", "quit","eval","break","mod","write_profile","setq",
     3120    // 64    65          66      67       68        69        70
     3121    "for", "open_file","load","bit-and","bit-or","bit-xor","make-array",
     3122    // 71      72          73          74        75      76
     3123    "aref","if-1progn","if-2progn","if-12progn","eq0","preport",
     3124    // 77     78         79        80       81     82     83
     3125    "search","elt",    "listp", "numberp", "do",  "gc", "schar",
     3126    // 84       85        86      87      88        89    90
     3127    "symbolp","num2str","nconc","first","second","third","fourth",
     3128    // 91       92       93       94       95      96
     3129    "fifth", "sixth", "seventh","eighth","ninth","tenth",
     3130    "substr",       // 97
     3131    "local_load"    // 98, filename
     3132};
    31303133
    31313134/* select, digistr, load-file are not a common lisp functions! */
  • abuse/trunk/src/loader2.cpp

    r17 r39  
    222222  for (fl=file_list;!NILP(fl);fl=lcdr(fl))
    223223  {
    224     char *fn=lstring_value(lcar(fl));
     224    char const *fn=lstring_value(lcar(fl));
    225225    fp=open_file(fn,"rb");
    226226    if (!fp->open_failure())
     
    321321    exit(0);
    322322  }
    323   char prog[100],*cs;
     323  char prog[100];
     324  char const *cs;
    324325
    325326  c_mouse1=cash.reg("art/dev.spe","c_mouse1",SPEC_IMAGE,0);
     
    355356
    356357
    357   char *ff;
     358  char const *ff;
    358359  if (DEFINEDP(symbol_value(make_find_symbol("frame_file"))))
    359360    ff=lstring_value(symbol_value(make_find_symbol("frame_file")));
  • abuse/trunk/src/loadgame.cpp

    r4 r39  
     1#include <string.h>
     2
    13#include "specs.hpp"
    24#include "jwindow.hpp"
     
    810#include "cache.hpp"
    911#include "gui.hpp"
     12#include "dev.hpp"
    1013#include "id.hpp"
    1114#include "demo.hpp"
    1215#include "game.hpp"
    13 #include <string.h>
    1416
    1517extern void *save_order;         // load from "saveordr.lsp", contains a list ordering the save games
     
    1820
    1921extern window_manager *eh;
    20 extern char *symbol_str(char *name);
    2122
    2223#define MAX_SAVE_GAMES 5
     
    6465  return eh->new_window(mx,yres/2-(WINDOW_FRAME_TOP+ih*5)/2,-1,-1,buts[0]);
    6566}
    66 
    67 FILE *open_FILE(char *filename, char *mode);
    6867
    6968int get_save_spot()
     
    141140}
    142141
    143 int load_game(int show_all, char *title)   // return 0 if the player escapes, else return the number of the game to load
     142int load_game(int show_all, char const *title)   // return 0 if the player escapes, else return the number of the game to load
    144143{
    145144        int total_saved=0;
  • abuse/trunk/src/menu.cpp

    r2 r39  
     1#include <math.h>
     2
    13#include "menu.hpp"
    24#include "lisp.hpp"
     
    1618#include "scroller.hpp"
    1719#include "netcfg.hpp"
    18 #include <math.h>
    1920#include "sock.hpp"
    2021
     
    298299
    299300
    300   char *ff="art/frame.spe";
     301  char const *ff = "art/frame.spe";
    301302  int t=SPEC_IMAGE;
    302303  int u_u=cash.reg(ff,"u_u",t,1),
     
    349350            if (sfx_volume>127) sfx_volume=127;
    350351            draw_sfx_vol(slider);
    351             char *s="sfx/ambtech1.wav";
     352            char const *s = "sfx/ambtech1.wav";
    352353            if (sound_avail&SFX_INITIALIZED)
    353354              cash.sfx(cash.reg(s,s,SPEC_EXTERN_SFX,1))->play(sfx_volume);
     
    360361            if (sfx_volume<0) sfx_volume=0;
    361362            draw_sfx_vol(slider);
    362             char *s="sfx/ambtech1.wav";
     363            char const *s = "sfx/ambtech1.wav";
    363364            if (sound_avail&SFX_INITIALIZED)
    364365              cash.sfx(cash.reg(s,s,SPEC_EXTERN_SFX,1))->play(sfx_volume);
     
    393394}
    394395
    395 
    396 FILE *open_FILE(char *filename, char *mode);
    397396
    398397void save_difficulty()
     
    433432//    char *prog="((\"art/help.spe\" . \"sell2\")(\"art/help.spe\" . \"sell4\")(\"art/help.spe\" . \"sell3\")(\"art/endgame.spe\" . \"credit\"))";
    434433//    char *prog="((\"art/endgame.spe\" . \"credit\") (\"art/help.spe\" . \"sell6\"))";
    435     char *prog="((\"art/endgame.spe\" . \"credit\"))";
     434    char const *prog="((\"art/endgame.spe\" . \"credit\"))";
    436435    set_symbol_value(ss,compile(prog));
    437436    current_space=sp;
     
    580579void *current_demo=NULL;
    581580
    582 static ico_button *load_icon(int num, int id, int x, int y, int &h, ifield *next, char *key)
     581static ico_button *load_icon(int num, int id, int x, int y, int &h, ifield *next, char const *key)
    583582{
    584583  char name[20];
    585   char *base="newi";
     584  char const *base = "newi";
    586585  int a,b,c;
    587586  sprintf(name,"%s%04d.pcx",base,num*3+1);
  • abuse/trunk/src/net/fileman.cpp

    r17 r39  
    269269
    270270
    271 void file_manager::remote_file::r_close(char *reason)
     271void file_manager::remote_file::r_close(char const *reason)
    272272{
    273273//  if (reason) fprintf(stderr,"remote_file : %s\n",reason);
     
    281281}
    282282
    283 file_manager::remote_file::remote_file(net_socket *sock, char *filename, char *mode, remote_file *Next) : sock(sock)
     283file_manager::remote_file::remote_file(net_socket *sock, char const *filename, char const *mode, remote_file *Next) : sock(sock)
    284284{
    285285  next=Next;
     
    382382{ r_close(NULL); }
    383383
    384 int file_manager::rf_open_file(char *&filename, char *mode)
     384int file_manager::rf_open_file(char const *&filename, char const *mode)
    385385{
    386386  net_address *fs_server_addr=NULL;
  • abuse/trunk/src/net/gserver.cpp

    r17 r39  
    88#include "jwindow.hpp"
    99#include "input.hpp"
     10#include "dev.hpp"
    1011
    1112extern base_memory_struct *base;
     
    1617extern join_struct *join_array;
    1718extern window_manager *eh;
    18 extern char *symbol_str(char *name);
    1919extern void service_net_request();
    2020
  • abuse/trunk/src/net/include/fileman.hpp

    r17 r39  
    3232    public :
    3333    net_socket *sock;
    34     void r_close(char *reason);
     34    void r_close(char const *reason);
    3535    int32_t size;   // server tells us the size of the file when we open it
    3636    int open_local;
    3737    remote_file *next;
    38     remote_file(net_socket *sock, char *filename, char *mode, remote_file *Next);
     38    remote_file(net_socket *sock, char const *filename, char const *mode, remote_file *Next);
    3939
    4040    int unbuffered_read(void *buffer, size_t count);
    41     int unbuffered_write(void *buf, size_t count) { return 0; } // not supported
     41    int unbuffered_write(void const *buf, size_t count) { return 0; } // not supported
    4242    int32_t unbuffered_tell();
    4343    int32_t unbuffered_seek(int32_t offset);
     
    6363
    6464
    65   int rf_open_file(char *&filename, char *mode);
     65  int rf_open_file(char const *&filename, char const *mode);
    6666  int32_t rf_tell(int fd);
    6767  int32_t rf_seek(int fd, int32_t offset);
  • abuse/trunk/src/net/include/sock.hpp

    r5 r39  
    2929  virtual int ready_to_read()                                      = 0;
    3030  virtual int ready_to_write()                                     = 0;
    31   virtual int write(void *buf, int size, net_address *addr=0)   = 0;
     31  virtual int write(void const *buf, int size, net_address *addr=0)   = 0;
    3232  virtual int read(void *buf, int size, net_address **addr=0)      = 0;
    3333  virtual int get_fd()                                             = 0;
     
    6666
    6767  virtual net_address *get_local_address() = 0;
    68   virtual net_address *get_node_address(char *&server_name, int def_port, int force_port) = 0;
     68  virtual net_address *get_node_address(char const *&server_name, int def_port, int force_port) = 0;
    6969  virtual net_socket *connect_to_server(net_address *addr,
    7070                                        net_socket::socket_type sock_type=net_socket::SOCKET_SECURE) =0;
    7171  virtual net_socket *create_listen_socket(int port, net_socket::socket_type sock_type) = 0;
    7272  virtual int installed() = 0;
    73   virtual char *name() = 0;
     73  virtual char const *name() = 0;
    7474  virtual int select(int block) = 0;          // return # of sockets available for read & writing
    7575  virtual void cleanup() { ; }                // should do any needed pre-exit cleanup stuff
    76   net_socket *connect_to_server(char *&server_name, int port, int force_port=0,
     76  net_socket *connect_to_server(char const *&server_name, int port, int force_port=0,
    7777                                net_socket::socket_type sock_type=net_socket::SOCKET_SECURE);
    7878
  • abuse/trunk/src/net/include/tcpip.hpp

    r4 r39  
    101101  tcpip_protocol();
    102102  net_address *get_local_address();
    103   net_address *get_node_address(char *&server_name, int def_port, int force_port);
     103  net_address *get_node_address(char const *&server_name, int def_port, int force_port);
    104104  net_socket *connect_to_server(net_address *addr,
    105105        net_socket::socket_type sock_type=net_socket::SOCKET_SECURE);
    106106  net_socket *create_listen_socket(int port, net_socket::socket_type sock_type);
    107107  int installed() { return 1; }  // always part of unix
    108   char *name() { return "UNIX generic TCPIP"; }
     108  char const *name() { return "UNIX generic TCPIP"; }
    109109  void cleanup();
    110110  int select(int block);          // return # of sockets available for read & writing
     
    139139    return FD_ISSET(fd,&write_check);
    140140  }
    141   virtual int write(void *buf, int size, net_address *addr=NULL);
     141  virtual int write(void const *buf, int size, net_address *addr=NULL);
    142142  virtual int read(void *buf, int size, net_address **addr);
    143143
     
    212212    return tr;
    213213  }
    214   virtual int write(void *buf, int size, net_address *addr=NULL)
     214  virtual int write(void const *buf, int size, net_address *addr=NULL)
    215215  {
    216216    if (addr)
  • abuse/trunk/src/net/sock.cpp

    r2 r39  
    1212// in sub-classes
    1313
    14 net_socket *net_protocol::connect_to_server(char *&server_name, int port, int force_port, net_socket::socket_type sock_type)
     14net_socket *net_protocol::connect_to_server(char const *&server_name, int port, int force_port, net_socket::socket_type sock_type)
    1515{
    1616  net_address *a=get_node_address(server_name,port,force_port);
  • abuse/trunk/src/net/tcpip.cpp

    r4 r39  
    6060//}}}///////////////////////////////////
    6161
    62 int unix_fd::write(void *buf, int size, net_address *addr)
     62int unix_fd::write(void const *buf, int size, net_address *addr)
    6363//{{{
    6464{
     
    120120        } 
    121121
    122   char tmp[4],*np;
    123         sockaddr_in host;
     122  char tmp[4];
     123  char const *np;
     124  sockaddr_in host;
    124125 
    125126  np = my_name;
     
    150151//}}}///////////////////////////////////
    151152
    152 net_address *tcpip_protocol::get_node_address(char *&server_name,
     153net_address *tcpip_protocol::get_node_address(char const *&server_name,
    153154                                                                                                                                                                                        int def_port, int force_port)
    154155//{{{
    155156{
    156   sockaddr_in host;
    157 
    158         if (server_name[0]>='0' && server_name[0]<='9')
    159         {
    160           char tmp[4],*np;
     157    sockaddr_in host;
     158
     159    if (server_name[0]>='0' && server_name[0]<='9')
     160    {
     161        char tmp[4];
     162        char const *np;
    161163         
    162164          np = server_name;
     
    193195        else
    194196        {
    195           char name[256],*np;
     197          char name[256], *np;
    196198
    197199          np=name;
  • abuse/trunk/src/netcfg.cpp

    r17 r39  
    66#include "light.hpp"
    77
     8#include "dev.hpp"
     9
    810extern char *get_login();
    911extern window_manager *eh;
    1012net_configuration *main_net_cfg=NULL;
    1113extern char lsf[256];
    12 char *symbol_str(char *name);
    1314
    1415extern net_protocol *prot;
     
    3738
    3839
    39 void net_configuration::cfg_error(char *msg)
     40void net_configuration::cfg_error(char const *msg)
    4041{
    4142  jwindow *j=eh->new_window(-1,0,-1,-1,new info_field(WINDOW_FRAME_LEFT,WINDOW_FRAME_TOP,0,msg,
     
    243244
    244245
    245 void net_configuration::error(char *message)
     246void net_configuration::error(char const *message)
    246247{
    247248  image *screen_backup=screen->copy();
     
    267268 
    268269  {   
    269     char *ok=symbol_str("ok_button");
     270    char const *ok = symbol_str("ok_button");
    270271
    271272    int bx=x+ns_w/2-strlen(ok)*fnt->width()/2-3,
     
    435436  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
    436437  ns->put_image(screen,x,y);
    437   char *nw_s=symbol_str("Networking");
     438  char const *nw_s = symbol_str("Networking");
    438439  JCFont *fnt=eh->font();
    439440
     
    443444  {
    444445
    445     char *server_str=symbol_str("server");
     446    char const *server_str = symbol_str("server");
    446447    button *sb=new button(x+40,y+ns_h-23-fnt->height(),NET_SERVER,server_str,NULL);
    447448
  • abuse/trunk/src/newlight.cpp

    r17 r39  
    819819
    820820
    821 void read_lights(spec_directory *sd, jFILE *fp, char *level_name)
     821void read_lights(spec_directory *sd, jFILE *fp, char const *level_name)
    822822{
    823823  delete_all_lights();
  • abuse/trunk/src/nfclient.cpp

    r17 r39  
    2929  int offset;
    3030  public :
    31   nfs_file(char *filename, char *mode);
     31  nfs_file(char const *filename, char const *mode);
    3232  virtual int open_failure();
    3333  virtual int unbuffered_read(void *buf, size_t count);       // returns number of bytes read
    3434  int new_read(void *buf, size_t count);       // returns number of bytes read
    35   virtual int unbuffered_write(void *buf, size_t count);      // returns number of bytes written
     35  virtual int unbuffered_write(void const *buf, size_t count);      // returns number of bytes written
    3636  virtual int unbuffered_seek(long offset, int whence);  // whence=SEEK_SET, SEEK_CUR, SEEK_END, ret=0=success
    3737  virtual int unbuffered_tell();
     
    4040} ;
    4141
    42 bFILE *open_nfs_file(char *filename,char *mode)
     42bFILE *open_nfs_file(char const *filename, char const *mode)
    4343{
    4444  return new nfs_file(filename,mode);
     
    4646
    4747
    48 nfs_file::nfs_file(char *filename, char *mode)
     48nfs_file::nfs_file(char const *filename, char const *mode)
    4949{
    5050  local=NULL;
     
    5252
    5353  int local_only=0;
    54   char *s=mode;
     54  char const *s=mode;
    5555  for (;*s;s++)    // check to see if writeable file, if so don't go through nfs
    5656    if (*s=='w' || *s=='W' || *s=='a' || *s=='A')
    5757      local_only=1;
    5858
    59   char name[256],*c,*f=filename;
    60   c=name;
     59  char name[256], *c;
     60  char const *f = filename;
     61  c = name;
    6162  while (*f) { *c=*(f++); *c=toupper(*c); c++; } *c=0;
    6263  if (strstr(name,"REGISTER"))
     
    6667  {
    6768    int fail1,fail2,fail3=0;
    68     char *local_filename=filename;
     69    char const *local_filename = filename;
    6970    if (filename[0]=='/' && filename[1]=='/')
    7071    { local_filename+=2;
     
    144145}
    145146
    146 int nfs_file::unbuffered_write(void *buf, size_t count)      // returns number of bytes written
     147int nfs_file::unbuffered_write(void const *buf, size_t count)      // returns number of bytes written
    147148{
    148149  if (local)
     
    216217
    217218
    218 int set_file_server(char *name)
     219int set_file_server(char const *name)
    219220{
    220221  if (prot)
  • abuse/trunk/src/objects.cpp

    r18 r39  
    4545
    4646
    47 obj_desc object_descriptions[TOTAL_OBJECT_VARS]={
    48                                 {"fade_dir",      RC_8 },
    49                                 {"frame_dir",     RC_8 },
    50                                 {"direction",     RC_8 },
    51                                 {"gravity_on",    RC_8 },
    52                                 {"fade_count",    RC_8 },
    53 
    54                                 {"fade_max",      RC_8 },
    55                                 {"active",        RC_8 },
    56                                 {"flags",         RC_8 },
    57                                 {"aitype",        RC_8 },
    58                                 {"xvel",          RC_32 },
    59 
    60                                 {"fxvel",         RC_8 },
    61                                 {"yvel",          RC_32 },
    62                                 {"fyvel",         RC_8 },
    63                                 {"xacel",         RC_32 },
    64                                 {"fxacel",        RC_8 },
    65 
    66                                 {"yacel",         RC_32 },
    67                                 {"fyacel",        RC_8 },
    68                                 {"x",             RC_32 },
    69                                 {"fx",            RC_8 },
    70                                 {"y",             RC_32 },
    71 
    72                                 {"fy",            RC_8 },
    73                                 {"hp",            RC_16 },
    74                                 {"mp",            RC_16 },
    75                                 {"fmp",           RC_16 },
    76                                 {"cur_frame",     RC_16 },
    77 
    78                                 {"aistate",       RC_16 },
    79                                 {"aistate_time",  RC_16 },
    80                                 {"targetable",    RC_8 }
    81 
    82                               };
     47obj_desc object_descriptions[TOTAL_OBJECT_VARS] =
     48{
     49    {"fade_dir",      RC_8 },
     50    {"frame_dir",     RC_8 },
     51    {"direction",     RC_8 },
     52    {"gravity_on",    RC_8 },
     53    {"fade_count",    RC_8 },
     54
     55    {"fade_max",      RC_8 },
     56    {"active",        RC_8 },
     57    {"flags",         RC_8 },
     58    {"aitype",        RC_8 },
     59    {"xvel",          RC_32 },
     60
     61    {"fxvel",         RC_8 },
     62    {"yvel",          RC_32 },
     63    {"fyvel",         RC_8 },
     64    {"xacel",         RC_32 },
     65    {"fxacel",        RC_8 },
     66
     67    {"yacel",         RC_32 },
     68    {"fyacel",        RC_8 },
     69    {"x",             RC_32 },
     70    {"fx",            RC_8 },
     71    {"y",             RC_32 },
     72
     73    {"fy",            RC_8 },
     74    {"hp",            RC_16 },
     75    {"mp",            RC_16 },
     76    {"fmp",           RC_16 },
     77    {"cur_frame",     RC_16 },
     78
     79    {"aistate",       RC_16 },
     80    {"aistate_time",  RC_16 },
     81    {"targetable",    RC_8 }
     82};
    8383 
    8484int32_t game_object::get_var_by_name(char *name, int &error)
     
    133133
    134134
    135 char *simple_object::var_name(int x)
     135char const *simple_object::var_name(int x)
    136136{
    137137  return object_descriptions[x].name;
  • abuse/trunk/src/property.cpp

    r2 r39  
     1#include <stdio.h>
     2#include <string.h>
     3
    14#include "property.hpp"
    25#include "jmalloc.hpp"
    3 #include <stdio.h>
    46#include "dprint.hpp"
    5 #include <string.h>
     7#include "game.hpp"
    68
    79class property
     
    1113  char *def_str;
    1214  int def_num;
    13   property(char *Name, int Def)
     15  property(char const *Name, int Def)
    1416  { name=strcpy((char *)jmalloc(strlen(Name)+1,"Property Name"),Name);
    1517    def_num=Def;
     
    1820  }
    1921
    20   property(char *Name, char *Def)
     22  property(char const *Name, char const *Def)
    2123  { name=strcpy((char *)jmalloc(strlen(Name)+1,"Property Name"),Name);
    2224    def_str=strcpy((char *)jmalloc(strlen(Def)+1,"Property text"),Def);
     
    3335  }
    3436
    35   void set(char *x)
     37  void set(char const *x)
    3638  {
    3739    if (def_str)
     
    5254} ;
    5355
    54 property *property_manager::find(char *name)
     56property *property_manager::find(char const *name)
    5557{
    5658  for (property *i=first;i;i=i->next) 
     
    7173}
    7274
    73 int property_manager::get(char *name, int def)
     75int property_manager::get(char const *name, int def)
    7476{
    7577  property *f=find(name);
     
    8082
    8183
    82 char *property_manager::get(char *name,char *def)
     84char const *property_manager::get(char const *name,char const *def)
    8385{
    8486  property *f=find(name);
     
    8991
    9092
    91 void property_manager::set(char *name, double def)
     93void property_manager::set(char const *name, double def)
    9294{
    9395  property *f=find(name);
     
    102104}
    103105
    104 void property_manager::set(char *name, char *def)
     106void property_manager::set(char const *name, char const *def)
    105107{
    106108  property *f=find(name);
     
    116118
    117119
    118 FILE *open_FILE(char *filename, char *mode);
    119 
    120 void property_manager::save(char *filename)
     120void property_manager::save(char const *filename)
    121121{
    122122  FILE *fp=open_FILE(filename,"wb");
     
    138138
    139139
    140 void property_manager::load(char *filename)
     140void property_manager::load(char const *filename)
    141141{
    142142  char buf[100],*c1,*c2,name[100],str[100];
  • abuse/trunk/src/scene.cpp

    r2 r39  
    363363
    364364
    365 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf,
     365int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf,
    366366              text_blocker *first, JCFont *font)
    367367{
     
    371371  int h=font->height()+2,w=font->width(),x=x1,dist;
    372372  y+=y1;
    373   char *word_start;
     373  char const *word_start;
    374374
    375375  while (*buf)
  • abuse/trunk/src/sdlport/event.cpp

    r23 r39  
    1919
    2020extern int confirm_quit();
    21 extern int get_key_binding( char *dir, int i );
     21extern int get_key_binding( char const *dir, int i );
    2222extern int mouse_xscale, mouse_yscale;
    2323short mouse_buttons[5] = { 0, 0, 0, 0, 0 };
  • abuse/trunk/src/sdlport/setup.cpp

    r6 r39  
    1717#include <GL/gl.h>
    1818#include <GL/glu.h>
    19 #endif  /* __APPLE__ */
    20 #endif  /* HAVE_OPENGL */
     19#endif    /* __APPLE__ */
     20#endif    /* HAVE_OPENGL */
    2121#include "specs.hpp"
    2222#include "keys.hpp"
     
    3434void showHelp()
    3535{
    36         printf( "\n" );
    37         printf( "Usage: abuse.sdl [options]\n" );
    38         printf( "Options:\n\n" );
    39         printf( "** Abuse Options **\n" );
    40         printf( "  -size <arg>       Set the size of the screen\n" );
    41         printf( "  -edit             Startup in editor mode\n" );
    42         printf( "  -a <arg>          Use addon named <arg>\n" );
    43         printf( "  -f <arg>          Load map file named <arg>\n" );
    44         printf( "  -lisp             Startup in lisp interpreter mode\n" );
    45         printf( "  -nodelay          Run at maximum speed\n" );
    46         printf( "\n" );
    47         printf( "** Abuse-SDL Options **\n" );
    48         printf( "  -datadir <arg>    Set the location of the game data to <arg>\n" );
    49         printf( "  -doublebuf        Enable double buffering\n" );
    50         printf( "  -fullscreen       Enable fullscreen mode\n" );
     36    printf( "\n" );
     37    printf( "Usage: abuse.sdl [options]\n" );
     38    printf( "Options:\n\n" );
     39    printf( "** Abuse Options **\n" );
     40    printf( "  -size <arg>       Set the size of the screen\n" );
     41    printf( "  -edit             Startup in editor mode\n" );
     42    printf( "  -a <arg>          Use addon named <arg>\n" );
     43    printf( "  -f <arg>          Load map file named <arg>\n" );
     44    printf( "  -lisp             Startup in lisp interpreter mode\n" );
     45    printf( "  -nodelay          Run at maximum speed\n" );
     46    printf( "\n" );
     47    printf( "** Abuse-SDL Options **\n" );
     48    printf( "  -datadir <arg>    Set the location of the game data to <arg>\n" );
     49    printf( "  -doublebuf        Enable double buffering\n" );
     50    printf( "  -fullscreen       Enable fullscreen mode\n" );
    5151#ifdef HAVE_OPENGL
    52         printf( "  -gl               Enable OpenGL\n" );
    53         printf( "  -antialias        Enable anti-aliasing (with -gl only)\n" );
     52    printf( "  -gl               Enable OpenGL\n" );
     53    printf( "  -antialias        Enable anti-aliasing (with -gl only)\n" );
    5454#endif
    55         printf( "  -h, --help        Display this text\n" );
    56         printf( "  -mono             Disable stereo sound\n" );
    57         printf( "  -nosound          Disable sound\n" );
    58         printf( "  -scale <arg>      Scale to <arg>\n" );
    59 //      printf( "  -x <arg>          Set the width to <arg>\n" );
    60 //      printf( "  -y <arg>          Set the height to <arg>\n" );
    61         printf( "\n" );
    62         printf( "Anthony Kruize <trandor@labyrinth.net.au>\n" );
    63         printf( "\n" );
     55    printf( "  -h, --help        Display this text\n" );
     56    printf( "  -mono             Disable stereo sound\n" );
     57    printf( "  -nosound          Disable sound\n" );
     58    printf( "  -scale <arg>      Scale to <arg>\n" );
     59//    printf( "  -x <arg>          Set the width to <arg>\n" );
     60//    printf( "  -y <arg>          Set the height to <arg>\n" );
     61    printf( "\n" );
     62    printf( "Anthony Kruize <trandor@labyrinth.net.au>\n" );
     63    printf( "\n" );
    6464}
    6565
     
    6969void createRCFile( char *rcfile )
    7070{
    71         FILE *fd = NULL;
    72 
    73         if( (fd = fopen( rcfile, "w" )) != NULL )
    74         {
    75                 fputs( "; Abuse-SDL Configuration file\n\n", fd );
    76                 fputs( "; Location of the datafiles\ndatadir=/var/games/abuse\n\n", fd );
    77                 fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd );
    78                 fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd );
    79                 fputs( "; Use mono audio only\nmono=0\n\n", fd );
    80                 fputs( "; Grab the mouse to the window\ngrabmouse=0\n\n", fd );
    81                 fputs( "; Set the scale factor\nscale=2\n\n", fd );
    82                 fputs( "; Use OpenGL\ngl=0\n\n", fd );
    83                 fputs( "; Use anti-aliasing (with gl=1 only)\nantialias=1\n\n", fd );
    84 //              fputs( "; Set the width of the window\nx=320\n\n", fd );
    85 //              fputs( "; Set the height of the window\ny=200\n\n", fd );
    86                 fputs( "; Disable the SDL parachute in the case of a crash\nnosdlparachute=0\n\n", fd );
    87                 fputs( "; Key mappings\n", fd );
    88                 fputs( "left=LEFT\nright=RIGHT\nup=UP\ndown=DOWN\n", fd );
    89                 fputs( "fire=SPACE\nweapprev=CTRL_R\nweapnext=INSERT\n", fd );
    90                 fclose( fd );
    91         }
    92         else
    93         {
    94                 printf( "Unable to create 'abuserc' file.\n" );
    95         }
     71    FILE *fd = NULL;
     72
     73    if( (fd = fopen( rcfile, "w" )) != NULL )
     74    {
     75        fputs( "; Abuse-SDL Configuration file\n\n", fd );
     76        fputs( "; Location of the datafiles\ndatadir=/var/games/abuse\n\n", fd );
     77        fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd );
     78        fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd );
     79        fputs( "; Use mono audio only\nmono=0\n\n", fd );
     80        fputs( "; Grab the mouse to the window\ngrabmouse=0\n\n", fd );
     81        fputs( "; Set the scale factor\nscale=2\n\n", fd );
     82        fputs( "; Use OpenGL\ngl=0\n\n", fd );
     83        fputs( "; Use anti-aliasing (with gl=1 only)\nantialias=1\n\n", fd );
     84//        fputs( "; Set the width of the window\nx=320\n\n", fd );
     85//        fputs( "; Set the height of the window\ny=200\n\n", fd );
     86        fputs( "; Disable the SDL parachute in the case of a crash\nnosdlparachute=0\n\n", fd );
     87        fputs( "; Key mappings\n", fd );
     88        fputs( "left=LEFT\nright=RIGHT\nup=UP\ndown=DOWN\n", fd );
     89        fputs( "fire=SPACE\nweapprev=CTRL_R\nweapnext=INSERT\n", fd );
     90        fclose( fd );
     91    }
     92    else
     93    {
     94        printf( "Unable to create 'abuserc' file.\n" );
     95    }
    9696}
    9797
     
    101101void readRCFile()
    102102{
    103         FILE *fd = NULL;
    104         char *rcfile;
    105         char buf[255];
    106         char *result;
    107 
    108         rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
    109         sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() );
    110         if( (fd = fopen( rcfile, "r" )) != NULL )
    111         {
    112                 while( fgets( buf, sizeof( buf ), fd ) != NULL )
    113                 {
    114                         result = strtok( buf, "=" );
    115                         if( strcasecmp( result, "fullscreen" ) == 0 )
    116                         {
    117                                 result = strtok( NULL, "\n" );
    118                                 flags.fullscreen = atoi( result );
    119                         }
    120                         else if( strcasecmp( result, "doublebuf" ) == 0 )
    121                         {
    122                                 result = strtok( NULL, "\n" );
    123                                 flags.doublebuf = atoi( result );
    124                         }
    125                         else if( strcasecmp( result, "mono" ) == 0 )
    126                         {
    127                                 result = strtok( NULL, "\n" );
    128                                 flags.mono = atoi( result );
    129                         }
    130                         else if( strcasecmp( result, "grabmouse" ) == 0 )
    131                         {
    132                                 result = strtok( NULL, "\n" );
    133                                 flags.grabmouse = atoi( result );
    134                         }
    135                         else if( strcasecmp( result, "scale" ) == 0 )
    136                         {
    137                                 result = strtok( NULL, "\n" );
    138                                 scale = atoi( result );
    139 //                              flags.xres = xres * atoi( result );
    140 //                              flags.yres = yres * atoi( result );
    141                         }
    142 /*                      else if( strcasecmp( result, "x" ) == 0 )
    143                         {
    144                                 result = strtok( NULL, "\n" );
    145                                 flags.xres = atoi( result );
    146                         }
    147                         else if( strcasecmp( result, "y" ) == 0 )
    148                         {
    149                                 result = strtok( NULL, "\n" );
    150                                 flags.yres = atoi( result );
    151                         }*/
    152                         else if( strcasecmp( result, "gl" ) == 0 )
    153                         {
    154                                 // We leave this in even if we don't have OpenGL so we can
    155                                 // at least inform the user.
    156                                 result = strtok( NULL, "\n" );
    157                                 flags.gl = atoi( result );
    158                         }
     103    FILE *fd = NULL;
     104    char *rcfile;
     105    char buf[255];
     106    char *result;
     107
     108    rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
     109    sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() );
     110    if( (fd = fopen( rcfile, "r" )) != NULL )
     111    {
     112        while( fgets( buf, sizeof( buf ), fd ) != NULL )
     113        {
     114            result = strtok( buf, "=" );
     115            if( strcasecmp( result, "fullscreen" ) == 0 )
     116            {
     117                result = strtok( NULL, "\n" );
     118                flags.fullscreen = atoi( result );
     119            }
     120            else if( strcasecmp( result, "doublebuf" ) == 0 )
     121            {
     122                result = strtok( NULL, "\n" );
     123                flags.doublebuf = atoi( result );
     124            }
     125            else if( strcasecmp( result, "mono" ) == 0 )
     126            {
     127                result = strtok( NULL, "\n" );
     128                flags.mono = atoi( result );
     129            }
     130            else if( strcasecmp( result, "grabmouse" ) == 0 )
     131            {
     132                result = strtok( NULL, "\n" );
     133                flags.grabmouse = atoi( result );
     134            }
     135            else if( strcasecmp( result, "scale" ) == 0 )
     136            {
     137                result = strtok( NULL, "\n" );
     138                scale = atoi( result );
     139//                flags.xres = xres * atoi( result );
     140//                flags.yres = yres * atoi( result );
     141            }
     142/*            else if( strcasecmp( result, "x" ) == 0 )
     143            {
     144                result = strtok( NULL, "\n" );
     145                flags.xres = atoi( result );
     146            }
     147            else if( strcasecmp( result, "y" ) == 0 )
     148            {
     149                result = strtok( NULL, "\n" );
     150                flags.yres = atoi( result );
     151            }*/
     152            else if( strcasecmp( result, "gl" ) == 0 )
     153            {
     154                // We leave this in even if we don't have OpenGL so we can
     155                // at least inform the user.
     156                result = strtok( NULL, "\n" );
     157                flags.gl = atoi( result );
     158            }
    159159#ifdef HAVE_OPENGL
    160                         else if( strcasecmp( result, "antialias" ) == 0 )
    161                         {
    162                                 result = strtok( NULL, "\n" );
    163                                 if( atoi( result ) )
    164                                 {
    165                                         flags.antialias = GL_LINEAR;
    166                                 }
    167                         }
     160            else if( strcasecmp( result, "antialias" ) == 0 )
     161            {
     162                result = strtok( NULL, "\n" );
     163                if( atoi( result ) )
     164                {
     165                    flags.antialias = GL_LINEAR;
     166                }
     167            }
    168168#endif
    169                         else if( strcasecmp( result, "nosdlparachute" ) == 0 )
    170                         {
    171                                 result = strtok( NULL, "\n" );
    172                                 flags.nosdlparachute = atoi( result );
    173                         }
    174                         else if( strcasecmp( result, "datadir" ) == 0 )
    175                         {
    176                                 result = strtok( NULL, "\n" );
    177                                 set_filename_prefix( result );
    178                         }
    179                         else if( strcasecmp( result, "left" ) == 0 )
    180                         {
    181                                 result = strtok( NULL,"\n" );
    182                                 keys.left = key_value( result );
    183                         }
    184                         else if( strcasecmp( result, "right" ) == 0 )
    185                         {
    186                                 result = strtok( NULL,"\n" );
    187                                 keys.right = key_value( result );
    188                         }
    189                         else if( strcasecmp( result, "up" ) == 0 )
    190                         {
    191                                 result = strtok( NULL,"\n" );
    192                                 keys.up = key_value( result );
    193                         }
    194                         else if( strcasecmp( result, "down" ) == 0 )
    195                         {
    196                                 result = strtok( NULL,"\n" );
    197                                 keys.down = key_value( result );
    198                         }
    199                         else if( strcasecmp( result, "fire" ) == 0 )
    200                         {
    201                                 result = strtok( NULL,"\n" );
    202                                 keys.b2 = key_value( result );
    203                         }
    204                         else if( strcasecmp( result, "special" ) == 0 )
    205                         {
    206                                 result = strtok( NULL,"\n" );
    207                                 keys.b1 = key_value( result );
    208                         }
    209                         else if( strcasecmp( result, "weapprev" ) == 0 )
    210                         {
    211                                 result = strtok( NULL,"\n" );
    212                                 keys.b3 = key_value( result );
    213                         }
    214                         else if( strcasecmp( result, "weapnext" ) == 0 )
    215                         {
    216                                 result = strtok( NULL,"\n" );
    217                                 keys.b4 = key_value( result );
    218                         }
    219                 }
    220                 fclose( fd );
    221         }
    222         else
    223         {
    224                 // Couldn't open the abuserc file so let's create a default one
    225                 createRCFile( rcfile );
    226         }
    227         jfree( rcfile );
     169            else if( strcasecmp( result, "nosdlparachute" ) == 0 )
     170            {
     171                result = strtok( NULL, "\n" );
     172                flags.nosdlparachute = atoi( result );
     173            }
     174            else if( strcasecmp( result, "datadir" ) == 0 )
     175            {
     176                result = strtok( NULL, "\n" );
     177                set_filename_prefix( result );
     178            }
     179            else if( strcasecmp( result, "left" ) == 0 )
     180            {
     181                result = strtok( NULL,"\n" );
     182                keys.left = key_value( result );
     183            }
     184            else if( strcasecmp( result, "right" ) == 0 )
     185            {
     186                result = strtok( NULL,"\n" );
     187                keys.right = key_value( result );
     188            }
     189            else if( strcasecmp( result, "up" ) == 0 )
     190            {
     191                result = strtok( NULL,"\n" );
     192                keys.up = key_value( result );
     193            }
     194            else if( strcasecmp( result, "down" ) == 0 )
     195            {
     196                result = strtok( NULL,"\n" );
     197                keys.down = key_value( result );
     198            }
     199            else if( strcasecmp( result, "fire" ) == 0 )
     200            {
     201                result = strtok( NULL,"\n" );
     202                keys.b2 = key_value( result );
     203            }
     204            else if( strcasecmp( result, "special" ) == 0 )
     205            {
     206                result = strtok( NULL,"\n" );
     207                keys.b1 = key_value( result );
     208            }
     209            else if( strcasecmp( result, "weapprev" ) == 0 )
     210            {
     211                result = strtok( NULL,"\n" );
     212                keys.b3 = key_value( result );
     213            }
     214            else if( strcasecmp( result, "weapnext" ) == 0 )
     215            {
     216                result = strtok( NULL,"\n" );
     217                keys.b4 = key_value( result );
     218            }
     219        }
     220        fclose( fd );
     221    }
     222    else
     223    {
     224        // Couldn't open the abuserc file so let's create a default one
     225        createRCFile( rcfile );
     226    }
     227    jfree( rcfile );
    228228}
    229229
     
    233233void parseCommandLine( int argc, char **argv )
    234234{
    235         for( int ii = 1; ii < argc; ii++ )
    236         {
    237                 if( !strcasecmp( argv[ii], "-fullscreen" ) )
    238                 {
    239                         flags.fullscreen = 1;
    240                 }
    241                 else if( !strcasecmp( argv[ii], "-doublebuf" ) )
    242                 {
    243                         flags.doublebuf = 1;
    244                 }
    245                 else if( !strcasecmp( argv[ii], "-size" ) )
    246                 {
    247                         if( !sscanf( argv[++ii], "%d", &xres ) )
    248                         {
    249                                 xres = 320;
    250                         }
    251                         if( !sscanf( argv[++ii], "%d", &yres ) )
    252                         {
    253                                 yres = 200;
    254                         }
    255                 }
    256                 else if( !strcasecmp( argv[ii], "-scale" ) )
    257                 {
    258                         int result;
    259                         if( sscanf( argv[++ii], "%d", &result ) )
    260                         {
    261                                 scale = result;
    262 /*                              flags.xres = xres * scale;
    263                                 flags.yres = yres * scale;*/
    264                         }
    265                 }
    266 /*              else if( !strcasecmp( argv[ii], "-x" ) )
    267                 {
    268                         int x;
    269                         if( sscanf( argv[++ii], "%d", &x ) )
    270                         {
    271                                 flags.xres = x;
    272                         }
    273                 }
    274                 else if( !strcasecmp( argv[ii], "-y" ) )
    275                 {
    276                         int y;
    277                         if( sscanf( argv[++ii], "%d", &y ) )
    278                         {
    279                                 flags.yres = y;
    280                         }
    281                 }*/
    282                 else if( !strcasecmp( argv[ii], "-nosound" ) )
    283                 {
    284                         flags.nosound = 1;
    285                 }
    286                 else if( !strcasecmp( argv[ii], "-gl" ) )
    287                 {
    288                         // We leave this in even if we don't have OpenGL so we can
    289                         // at least inform the user.
    290                         flags.gl = 1;
    291                 }
     235    for( int ii = 1; ii < argc; ii++ )
     236    {
     237        if( !strcasecmp( argv[ii], "-fullscreen" ) )
     238        {
     239            flags.fullscreen = 1;
     240        }
     241        else if( !strcasecmp( argv[ii], "-doublebuf" ) )
     242        {
     243            flags.doublebuf = 1;
     244        }
     245        else if( !strcasecmp( argv[ii], "-size" ) )
     246        {
     247            if( !sscanf( argv[++ii], "%d", &xres ) )
     248            {
     249                xres = 320;
     250            }
     251            if( !sscanf( argv[++ii], "%d", &yres ) )
     252            {
     253                yres = 200;
     254            }
     255        }
     256        else if( !strcasecmp( argv[ii], "-scale" ) )
     257        {
     258            int result;
     259            if( sscanf( argv[++ii], "%d", &result ) )
     260            {
     261                scale = result;
     262/*                flags.xres = xres * scale;
     263                flags.yres = yres * scale;*/
     264            }
     265        }
     266/*        else if( !strcasecmp( argv[ii], "-x" ) )
     267        {
     268            int x;
     269            if( sscanf( argv[++ii], "%d", &x ) )
     270            {
     271                flags.xres = x;
     272            }
     273        }
     274        else if( !strcasecmp( argv[ii], "-y" ) )
     275        {
     276            int y;
     277            if( sscanf( argv[++ii], "%d", &y ) )
     278            {
     279                flags.yres = y;
     280            }
     281        }*/
     282        else if( !strcasecmp( argv[ii], "-nosound" ) )
     283        {
     284            flags.nosound = 1;
     285        }
     286        else if( !strcasecmp( argv[ii], "-gl" ) )
     287        {
     288            // We leave this in even if we don't have OpenGL so we can
     289            // at least inform the user.
     290            flags.gl = 1;
     291        }
    292292#ifdef HAVE_OPENGL
    293                 else if( !strcasecmp( argv[ii], "-antialias" ) )
    294                 {
    295                         flags.antialias = GL_LINEAR;
    296                 }
     293        else if( !strcasecmp( argv[ii], "-antialias" ) )
     294        {
     295            flags.antialias = GL_LINEAR;
     296        }
    297297#endif
    298                 else if( !strcasecmp( argv[ii], "-mono" ) )
    299                 {
    300                         flags.mono = 1;
    301                 }
    302                 else if( !strcasecmp( argv[ii], "-datadir" ) )
    303                 {
    304                         char datadir[255];
    305                         if( sscanf( argv[++ii], "%s", datadir ) )
    306                         {
    307                                 set_filename_prefix( datadir );
    308                         }
    309                 }
    310                 else if( !strcasecmp( argv[ii], "-h" ) || !strcasecmp( argv[ii], "--help" ) )
    311                 {
    312                         showHelp();
    313                         exit( 0 );
    314                 }
    315         }
     298        else if( !strcasecmp( argv[ii], "-mono" ) )
     299        {
     300            flags.mono = 1;
     301        }
     302        else if( !strcasecmp( argv[ii], "-datadir" ) )
     303        {
     304            char datadir[255];
     305            if( sscanf( argv[++ii], "%s", datadir ) )
     306            {
     307                set_filename_prefix( datadir );
     308            }
     309        }
     310        else if( !strcasecmp( argv[ii], "-h" ) || !strcasecmp( argv[ii], "--help" ) )
     311        {
     312            showHelp();
     313            exit( 0 );
     314        }
     315    }
    316316}
    317317
     
    321321void setup( int argc, char **argv )
    322322{
    323         // Initialise default settings
    324         flags.fullscreen                = 0;                    // Start in a window
    325         flags.doublebuf                 = 0;                    // No double buffering
    326         flags.mono                              = 0;                    // Enable stereo sound
    327         flags.nosound                   = 0;                    // Enable sound
    328         flags.grabmouse                 = 0;                    // Don't grab the mouse
    329         flags.nosdlparachute    = 0;                    // SDL error handling
    330         flags.xres = xres               = 320;                  // Default window width
    331         flags.yres = yres               = 200;                  // Default window height
    332         flags.gl                                = 0;                    // Don't use opengl
     323    // Initialise default settings
     324    flags.fullscreen        = 0;            // Start in a window
     325    flags.doublebuf            = 0;            // No double buffering
     326    flags.mono                = 0;            // Enable stereo sound
     327    flags.nosound            = 0;            // Enable sound
     328    flags.grabmouse            = 0;            // Don't grab the mouse
     329    flags.nosdlparachute    = 0;            // SDL error handling
     330    flags.xres = xres        = 320;            // Default window width
     331    flags.yres = yres        = 200;            // Default window height
     332    flags.gl                = 0;            // Don't use opengl
    333333#ifdef HAVE_OPENGL
    334         flags.antialias                 = GL_NEAREST;   // Don't anti-alias
     334    flags.antialias            = GL_NEAREST;    // Don't anti-alias
    335335#endif
    336         keys.up                                 = key_value( "UP" );
    337         keys.down                               = key_value( "DOWN" );
    338         keys.left                               = key_value( "LEFT" );
    339         keys.right                              = key_value( "RIGHT" );
    340         keys.b3                                 = key_value( "CTRL_R" );
    341         keys.b4                                 = key_value( "INSERT" );
    342         scale                                   = 2;                    // Default scale amount
    343 
    344         // Display our name and version
    345         printf( "%s %s\n", PACKAGE, VERSION );
    346 
    347         // Initialize SDL with video and audio support
    348         if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0 )
    349         {
    350                 printf( "Unable to initialise SDL : %s\n", SDL_GetError() );
    351                 exit( 1 );
    352         }
    353         atexit( SDL_Quit );
    354 
    355         // Set the savegame directory
    356         char *homedir;
    357         char *savedir;
    358         FILE *fd = NULL;
    359 
    360         if( (homedir = getenv( "HOME" )) != NULL )
    361         {
    362                 savedir = (char *)jmalloc( strlen( homedir ) + 9, "savedir" );
    363                 sprintf( savedir, "%s/.abuse/", homedir );
    364                 // Check if we already have a savegame directory
    365                 if( (fd = fopen( savedir, "r" )) == NULL )
    366                 {
    367                         // FIXME: Add some error checking here
    368                         mkdir( savedir, S_IRUSR | S_IWUSR | S_IXUSR );
    369                 }
    370                 else
    371                 {
    372                         fclose( fd );
    373                 }
    374                 set_save_filename_prefix( savedir );
    375                 jfree( savedir );
    376         }
    377         else
    378         {
    379                 // Warn the user that we couldn't set the savename prefix
    380                 printf( "WARNING: Unable to get $HOME environment variable.\n" );
    381                 printf( "         Savegames will probably fail.\n" );
    382                 // Just use the working directory.
    383                 // Hopefully they have write permissions....
    384                 set_save_filename_prefix( "" );
    385         }
    386 
    387         // Set the datadir to a default value
    388         // (The current directory)
    389         set_filename_prefix( EXPDATADIR );
    390 
    391         // Load the users configuration
    392         readRCFile();
    393 
    394         // Handle command-line parameters
    395         parseCommandLine( argc, argv );
    396 
    397         // Calculate the scaled window size.
    398         flags.xres = xres * scale;
    399         flags.yres = yres * scale;
    400 
    401         // Stop SDL handling some errors
    402         if( flags.nosdlparachute )
    403         {
    404                 // segmentation faults
    405                 signal( SIGSEGV, SIG_DFL );
    406                 // floating point errors
    407                 signal( SIGFPE, SIG_DFL );
    408         }
     336    keys.up                    = key_value( "UP" );
     337    keys.down                = key_value( "DOWN" );
     338    keys.left                = key_value( "LEFT" );
     339    keys.right                = key_value( "RIGHT" );
     340    keys.b3                    = key_value( "CTRL_R" );
     341    keys.b4                    = key_value( "INSERT" );
     342    scale                    = 2;            // Default scale amount
     343
     344    // Display our name and version
     345    printf( "%s %s\n", PACKAGE, VERSION );
     346
     347    // Initialize SDL with video and audio support
     348    if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0 )
     349    {
     350        printf( "Unable to initialise SDL : %s\n", SDL_GetError() );
     351        exit( 1 );
     352    }
     353    atexit( SDL_Quit );
     354
     355    // Set the savegame directory
     356    char *homedir;
     357    char *savedir;
     358    FILE *fd = NULL;
     359
     360    if( (homedir = getenv( "HOME" )) != NULL )
     361    {
     362        savedir = (char *)jmalloc( strlen( homedir ) + 9, "savedir" );
     363        sprintf( savedir, "%s/.abuse/", homedir );
     364        // Check if we already have a savegame directory
     365        if( (fd = fopen( savedir, "r" )) == NULL )
     366        {
     367            // FIXME: Add some error checking here
     368            mkdir( savedir, S_IRUSR | S_IWUSR | S_IXUSR );
     369        }
     370        else
     371        {
     372            fclose( fd );
     373        }
     374        set_save_filename_prefix( savedir );
     375        jfree( savedir );
     376    }
     377    else
     378    {
     379        // Warn the user that we couldn't set the savename prefix
     380        printf( "WARNING: Unable to get $HOME environment variable.\n" );
     381        printf( "         Savegames will probably fail.\n" );
     382        // Just use the working directory.
     383        // Hopefully they have write permissions....
     384        set_save_filename_prefix( "" );
     385    }
     386
     387    // Set the datadir to a default value
     388    // (The current directory)
     389    set_filename_prefix( EXPDATADIR );
     390
     391    // Load the users configuration
     392    readRCFile();
     393
     394    // Handle command-line parameters
     395    parseCommandLine( argc, argv );
     396
     397    // Calculate the scaled window size.
     398    flags.xres = xres * scale;
     399    flags.yres = yres * scale;
     400
     401    // Stop SDL handling some errors
     402    if( flags.nosdlparachute )
     403    {
     404        // segmentation faults
     405        signal( SIGSEGV, SIG_DFL );
     406        // floating point errors
     407        signal( SIGFPE, SIG_DFL );
     408    }
    409409}
    410410
     
    412412// Get the key binding for the requested function
    413413//
    414 int get_key_binding( char *dir, int i )
    415 {
    416         if( strcasecmp( dir, "left" ) == 0 )
    417         {
    418                 return keys.left;
    419         }
    420         else if( strcasecmp( dir, "right" ) == 0 )
    421         {
    422                 return keys.right;
    423         }
    424         else if( strcasecmp( dir, "up" ) == 0 )
    425         {
    426                 return keys.up;
    427         }
    428         else if( strcasecmp( dir, "down" ) == 0 )
    429         {
    430                 return keys.down;
    431         }
    432         else if( strcasecmp( dir, "b1" ) == 0 )
    433         {
    434                 return keys.b1;
    435         }
    436         else if( strcasecmp( dir, "b2" ) == 0 )
    437         {
    438                 return keys.b2;
    439         }
    440         else if( strcasecmp( dir, "b3" ) == 0 )
    441         {
    442                 return keys.b3;
    443         }
    444         else if( strcasecmp( dir, "b4" ) == 0 )
    445         {
    446                 return keys.b4;
    447         }
    448         return 0;
    449 }
     414int get_key_binding(char const *dir, int i)
     415{
     416    if( strcasecmp( dir, "left" ) == 0 )
     417        return keys.left;
     418    else if( strcasecmp( dir, "right" ) == 0 )
     419        return keys.right;
     420    else if( strcasecmp( dir, "up" ) == 0 )
     421        return keys.up;
     422    else if( strcasecmp( dir, "down" ) == 0 )
     423        return keys.down;
     424    else if( strcasecmp( dir, "b1" ) == 0 )
     425        return keys.b1;
     426    else if( strcasecmp( dir, "b2" ) == 0 )
     427        return keys.b2;
     428    else if( strcasecmp( dir, "b3" ) == 0 )
     429        return keys.b3;
     430    else if( strcasecmp( dir, "b4" ) == 0 )
     431        return keys.b4;
     432
     433    return 0;
     434}
  • abuse/trunk/src/sdlport/sound.cpp

    r11 r39  
    278278//
    279279
    280 song::song( char * filename )
     280song::song( char const * filename )
    281281{
    282282        data = NULL;
  • abuse/trunk/src/server2.cpp

    r17 r39  
    99#include "dev.hpp"
    1010
    11 char *get_username();
     11extern char const *get_username();
    1212int start_running=0;
    1313
  • abuse/trunk/src/setup.cpp

    r2 r39  
    4545
    4646
    47 int get_option(char *name);
     47int get_option(char const *name);
    4848
    4949JCFont *cfg_font;
     
    5454extern int jmalloc_max_size;
    5555
    56 FILE *open_FILE(char *filename, char *mode);
    5756void setup(int argc, char **argv)
    5857{
  • abuse/trunk/src/specache.cpp

    r17 r39  
    3535
    3636
    37 spec_directory *spec_directory_cache::get_spec_directory(char *filename, bFILE *fp)
     37spec_directory *spec_directory_cache::get_spec_directory(char const *filename, bFILE *fp)
    3838{
    3939  filename_node **parent=0,*p=fn_root;
  • abuse/trunk/src/text_gui.cpp

    r2 r39  
    426426  t=eval(t); msg=eval(msg); y=eval(y); n=eval(n);
    427427  int c;
    428   char *yes=lstring_value(y);
    429   char *no=lstring_value(n);
     428  char const *yes = lstring_value(y);
     429  char const *no = lstring_value(n);
    430430  do
    431431  {
  • abuse/trunk/src/unixnfc.cpp

    r17 r39  
    3737#endif
    3838
    39 extern int crc_man_write_crc_file(char *filename);
     39extern int crc_man_write_crc_file(char const *filename);
    4040int net_installed=0,net_out_fd,net_in_fd;
    4141int net_child=-1;
     
    180180}
    181181
    182 int NF_open_file(char *filename, char *mode)
     182int NF_open_file(char const *filename, char const *mode)
    183183{
    184184  if (net_installed)
  • abuse/trunk/src/username.cpp

    r2 r39  
    11#ifdef __WATCOMC__
    2 char *get_username() { return "DOS user"; }
     2char const *get_username() { return "DOS user"; }
    33#elif (defined(__APPLE__) && !defined(__MACH__))
    4 char *get_username() { return "Mac user"; }
     4char const *get_username() { return "Mac user"; }
    55#else
    66 
     
    1010#include        <unistd.h>
    1111
    12 char *get_username()
     12char const *get_username()
    1313{
    14   struct passwd         *pw;
    15   char                  *name;
     14  struct passwd *pw;
     15  char const *name;
    1616
    1717  if (!(name = getlogin()))
  • abuse/trunk/src/version.cpp

    r29 r39  
    77uint8_t minor_version=00;
    88
    9 extern int get_option(char *name);
     9extern int get_option(char const *name);
    1010
    1111#ifdef __WATCOMC__
  • abuse/trunk/src/view.cpp

    r17 r39  
    1919#define SHIFT_RIGHT_DEFAULT 0
    2020
    21 extern int get_key_binding( char *dir, int i );
     21extern int get_key_binding( char const *dir, int i );
    2222extern window_manager *eh;
    2323view *player_list=NULL;
     
    184184#endif
    185185
    186 void set_login(char *name)
     186void set_login(char const *name)
    187187{ strncpy(cur_user_name,name,20); }
    188188
     
    950950#define TVV (V_FREEZE_TIME+1)
    951951
    952 static char *vv_names[TVV]={
    953   "view.cx1",  "view.cy1",  "view.cx2",  "view.cy2",
    954   "view.shift_down",  "view.shift_right",
    955   "view.god",
    956   "view.player_number",
    957   "view.draw_solid",
    958   "view.lives",
    959   "view.current_weapon",
    960   "view.x_suggestion",  "view.y_suggestion", 
    961    "view.b1_suggestion",  "view.b2_suggestion",  "view.b3_suggestion",  "view.b4_suggestion",
    962   "view.pan_x",  "view.pan_y",
    963   "view.no_xleft",  "view.no_xright",  "view.no_ytop",  "view.no_ybottom",
    964   "view.last_x",  "view.last_y",  "view.last_left",  "view.last_right",  "view.last_up",  "view.last_down",
    965   "view.last_b1",  "view.last_b2",  "view.last_b3",  "view.last_b4",
    966   "view.last_hp",
    967   "view.secrets",  "view.kills",  "view.tsecrets",  "view.tkills",
    968   "view.ambient",
    969   "view.pointer_x",  "view.pointer_y",
    970   "view.last_last_x",  "view.last_last_y",
    971   "view.freeze_time"
     952static char const *vv_names[TVV] =
     953{
     954    "view.cx1",  "view.cy1",  "view.cx2",  "view.cy2",
     955    "view.shift_down",  "view.shift_right",
     956    "view.god",
     957    "view.player_number",
     958    "view.draw_solid",
     959    "view.lives",
     960    "view.current_weapon",
     961    "view.x_suggestion",  "view.y_suggestion", 
     962    "view.b1_suggestion",  "view.b2_suggestion",  "view.b3_suggestion",  "view.b4_suggestion",
     963    "view.pan_x",  "view.pan_y",
     964    "view.no_xleft",  "view.no_xright",  "view.no_ytop",  "view.no_ybottom",
     965    "view.last_x",  "view.last_y",  "view.last_left",  "view.last_right",  "view.last_up",  "view.last_down",
     966    "view.last_b1",  "view.last_b2",  "view.last_b3",  "view.last_b4",
     967    "view.last_hp",
     968    "view.secrets",  "view.kills",  "view.tsecrets",  "view.tkills",
     969    "view.ambient",
     970    "view.pointer_x",  "view.pointer_y",
     971    "view.last_last_x",  "view.last_last_y",
     972    "view.freeze_time"
    972973};
    973974
     
    977978}
    978979
    979 char *get_view_var_name(int num)
     980char const *get_view_var_name(int num)
    980981{ return vv_names[num]; }
    981982
Note: See TracChangeset for help on using the changeset viewer.