<commit_before>//////////////////////////////////////////////////////////////////////////
//
// SneezyMUD - All rights reserved, SneezyMUD Coding Team
//
//////////////////////////////////////////////////////////////////////////


#include "stdsneezy.h"
#include "obj_general_weapon.h"
#include "obj_base_weapon.h"
#include "obj_gun.h"
#include "range.h"
#include "obj_arrow.h"

enum ammoTypeT {
  AMMO_NONE = 0,                // 0
  AMMO_10MM_PISTOL,             // 1
  AMMO_9MM_PARABELLEM_PISTOL,   // 2
  AMMO_45CAL_ACP_PISTOL,        // 3
  AMMO_50CAL_AE_PISTOL,         // 4
  AMMO_44CAL_MAGNUM_PISTOL,     // 5
  AMMO_32CAL_ACP_PISTOL,        // 6
  AMMO_50CAL_BMG_PISTOL,        // 7
  AMMO_556MM_NATO_PISTOL,       // 8
  AMMO_SS190,                   // 9
  AMMO_9MM_PARABELLEM_RIFLE,    // 10
  AMMO_45CAL_ACP_RIFLE,         // 11
  AMMO_556MM_RIFLE,             // 12
  AMMO_762MM_RIFLE,             // 13
  AMMO_30CAL_RIFLE,             // 14
  AMMO_FLECHETTE,               // 15
  AMMO_LAW,                     // 16
  AMMO_MAX
};

const char *shelldesc [] =
{
  "None",                       // 0
  "10mm pistol",                // 1
  "9mm Parabellem pistol",      // 2
  ".45cal ACP pistol",          // 3
  ".50cal Action Express",      // 4
  ".44cal Magnum",              // 5
  ".32cal ACP",                 // 6
  ".50cal BMG",                 // 7
  "5.56mm NATO pistol",         // 8
  "SS190",                      // 9
  "9mm Parabellem rifle",       // 10
  ".45cal ACP rifle",           // 11
  "5.56mm rifle",               // 12
  "7.62mm rifle",               // 13
  "30cal rifle",                // 14
  "flechette",                  // 15
  "LAW rocket",                 // 16
};

const char *shellkeyword [] = 
{
  "None",                       // 0
  "10mmPistol",                 // 1
  "9mmPistol",                  // 2
  "45calPistol",                // 3
  "50calAE",                    // 4
  "44calMag",                   // 5
  "32calACP",                   // 6
  "50calBMG",                   // 7
  "556mmPistol",                 // 8
  "SS190",                      // 9
  "9mmRifle",                   // 10
  "45calRifle",                 // 11
  "556mmRifle",                 // 12
  "762mmRifle",                 // 13
  "30calRifle",                  // 14
  "flechette",                   // 15
  "lawrocket",
};



const char *getAmmoKeyword(int ammo){
  if(ammo < AMMO_NONE ||
     ammo >= AMMO_MAX){
    return shellkeyword[0];
  }
  
  return shellkeyword[ammo];
}



const char *getAmmoDescr(int ammo){
  if(ammo < AMMO_NONE ||
     ammo >= AMMO_MAX){
    return shelldesc[0];
  }
  
  return shelldesc[ammo];
}


void dropSpentCasing(TRoom *roomp, int ammo){
  TObj *obj;
  char buf[256];

  int robj = real_object(13874);
  if (robj < 0 || robj >= (signed int) obj_index.size()) {
    vlogf(LOG_BUG, "dropSpentCasing(): No object (%d) in database!", 13874);
    return;
  }
  
  obj = read_object(robj, REAL);

  obj->swapToStrung();
  
  sprintf(buf, "casing spent %s", getAmmoDescr(ammo));
  delete [] obj->name;
  obj->name = mud_str_dup(buf);
  
  sprintf(buf, "<o>a spent %s casing<1>", getAmmoDescr(ammo));
  delete [] obj->shortDescr;
  obj->shortDescr = mud_str_dup(buf);

  sprintf(buf, "A spent <o>%s casing<1> lies here.", getAmmoDescr(ammo));
  delete [] obj->descr;
  obj->setDescr(mud_str_dup(buf));

  *roomp += *obj;

  return;
}



void gload_usage(TBeing *tb){
  tb->sendTo("Syntax : (loading)   gload <gun> <ammo>\n\r");
  tb->sendTo("Syntax : (unloading) gload unload <gun>\n\r");
  return;
}


void TBeing::doGload(string arg)
{
  char    arg1[128], arg2[128];
  string buf;
  TObj  *bow;
  TThing  *arrow;
  TGun *gun;
  TAmmo *ammo;
  int nargs;
  TBeing *tb;

  nargs=scanf(arg.c_str(), "%s %s", arg1, arg2);

  if(nargs<1 || nargs>2){
    gload_usage(this);
    return;
  }
  
  if(strcmp(arg1, "unload")){
    generic_find(arg1, FIND_OBJ_INV | FIND_OBJ_EQUIP, this, &tb, &bow);
    <commit_msg>initialized ammo to NULL so this file will compile something weird going on I think<commit_after>//////////////////////////////////////////////////////////////////////////
//
// SneezyMUD - All rights reserved, SneezyMUD Coding Team
//
//////////////////////////////////////////////////////////////////////////


#include "stdsneezy.h"
#include "obj_general_weapon.h"
#include "obj_base_weapon.h"
#include "obj_gun.h"
#include "range.h"
#include "obj_arrow.h"

enum ammoTypeT {
  AMMO_NONE = 0,                // 0
  AMMO_10MM_PISTOL,             // 1
  AMMO_9MM_PARABELLEM_PISTOL,   // 2
  AMMO_45CAL_ACP_PISTOL,        // 3
  AMMO_50CAL_AE_PISTOL,         // 4
  AMMO_44CAL_MAGNUM_PISTOL,     // 5
  AMMO_32CAL_ACP_PISTOL,        // 6
  AMMO_50CAL_BMG_PISTOL,        // 7
  AMMO_556MM_NATO_PISTOL,       // 8
  AMMO_SS190,                   // 9
  AMMO_9MM_PARABELLEM_RIFLE,    // 10
  AMMO_45CAL_ACP_RIFLE,         // 11
  AMMO_556MM_RIFLE,             // 12
  AMMO_762MM_RIFLE,             // 13
  AMMO_30CAL_RIFLE,             // 14
  AMMO_FLECHETTE,               // 15
  AMMO_LAW,                     // 16
  AMMO_MAX
};

const char *shelldesc [] =
{
  "None",                       // 0
  "10mm pistol",                // 1
  "9mm Parabellem pistol",      // 2
  ".45cal ACP pistol",          // 3
  ".50cal Action Express",      // 4
  ".44cal Magnum",              // 5
  ".32cal ACP",                 // 6
  ".50cal BMG",                 // 7
  "5.56mm NATO pistol",         // 8
  "SS190",                      // 9
  "9mm Parabellem rifle",       // 10
  ".45cal ACP rifle",           // 11
  "5.56mm rifle",               // 12
  "7.62mm rifle",               // 13
  "30cal rifle",                // 14
  "flechette",                  // 15
  "LAW rocket",                 // 16
};

const char *shellkeyword [] = 
{
  "None",                       // 0
  "10mmPistol",                 // 1
  "9mmPistol",                  // 2
  "45calPistol",                // 3
  "50calAE",                    // 4
  "44calMag",                   // 5
  "32calACP",                   // 6
  "50calBMG",                   // 7
  "556mmPistol",                 // 8
  "SS190",                      // 9
  "9mmRifle",                   // 10
  "45calRifle",                 // 11
  "556mmRifle",                 // 12
  "762mmRifle",                 // 13
  "30calRifle",                  // 14
  "flechette",                   // 15
  "lawrocket",
};



const char *getAmmoKeyword(int ammo){
  if(ammo < AMMO_NONE ||
     ammo >= AMMO_MAX){
    return shellkeyword[0];
  }
  
  return shellkeyword[ammo];
}



const char *getAmmoDescr(int ammo){
  if(ammo < AMMO_NONE ||
     ammo >= AMMO_MAX){
    return shelldesc[0];
  }
  
  return shelldesc[ammo];
}


void dropSpentCasing(TRoom *roomp, int ammo){
  TObj *obj;
  char buf[256];

  int robj = real_object(13874);
  if (robj < 0 || robj >= (signed int) obj_index.size()) {
    vlogf(LOG_BUG, "dropSpentCasing(): No object (%d) in database!", 13874);
    return;
  }
  
  obj = read_object(robj, REAL);

  obj->swapToStrung();
  
  sprintf(buf, "casing spent %s", getAmmoDescr(ammo));
  delete [] obj->name;
  obj->name = mud_str_dup(buf);
  
  sprintf(buf, "<o>a spent %s casing<1>", getAmmoDescr(ammo));
  delete [] obj->shortDescr;
  obj->shortDescr = mud_str_dup(buf);

  sprintf(buf, "A spent <o>%s casing<1> lies here.", getAmmoDescr(ammo));
  delete [] obj->descr;
  obj->setDescr(mud_str_dup(buf));

  *roomp += *obj;

  return;
}



void gload_usage(TBeing *tb){
  tb->sendTo("Syntax : (loading)   gload <gun> <ammo>\n\r");
  tb->sendTo("Syntax : (unloading) gload unload <gun>\n\r");
  return;
}


void TBeing::doGload(string arg)
{
  char    arg1[128], arg2[128];
  string buf;
  TObj  *bow;
  TThing  *arrow;
  TGun *gun;
  TAmmo *ammo=NULL;
  int nargs;
  TBeing *tb;

  nargs=scanf(arg.c_str(), "%s %s", arg1, arg2);

  if(nargs<1 || nargs>2){
    gload_usage(this);
    return;
  }
  
  if(strcmp(arg1, "unload")){
    generic_find(arg1, FIND_OBJ_INV | FIND_OBJ_EQUIP, this, &tb, &bow);
    
{'fraction_non_alphanumeric': 0.17551934320189078, 'fraction_numerical': 0.048015922378405275, 'mean_word_length': 1.4715647094989242, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1948114', 'n_tokens_mistral': 3336, 'n_tokens_neox': 2954, 'n_words': 596}