Galactic Bloodshed
Functions
shlmisc.h File Reference
#include <optional>
#include <string>
#include "gb/races.h"
#include "gb/ships.h"
#include "gb/vars.h"
Include dependency graph for shlmisc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::optional< shipnum_tstring_to_shipnum (std::string_view)
 Convert input string to a shipnum_t. More...
 
bool authorized (governor_t, const Ship &)
 
shipnum_t start_shiplist (GameObj &, const std::string_view)
 Get start of ship lists from either a ship number or ScopeLevel. More...
 
shipnum_t do_shiplist (Ship **, shipnum_t *)
 
bool in_list (const player_t, std::string_view, const Ship &, shipnum_t *)
 Check is the ship is in the given input string. More...
 
void DontOwnErr (int, int, shipnum_t)
 
int enufAP (int, int, unsigned short, int)
 
std::tuple< player_t, governor_tgetracenum (const std::string &, const std::string &)
 Find the player/governor that matches passwords. More...
 
player_t get_player (const std::string &)
 
void allocateAPs (const command_t &, GameObj &)
 
void deductAPs (const player_t, const governor_t, unsigned int, starnum_t, int)
 
double morale_factor (double)
 

Function Documentation

◆ allocateAPs()

void allocateAPs ( const command_t ,
GameObj  
)

Definition at line 175 of file shlmisc.cc.

References getsdata(), getstar(), putsdata(), and putstar().

Here is the call graph for this function:

◆ authorized()

bool authorized ( governor_t  ,
const Ship  
)

Definition at line 46 of file shlmisc.cc.

◆ deductAPs()

void deductAPs ( const player_t  ,
const governor_t  ,
unsigned  int,
starnum_t  ,
int   
)

Definition at line 214 of file shlmisc.cc.

References getsdata(), getstar(), putsdata(), and putstar().

Referenced by bombard(), capital(), capture(), declare(), defend(), dump(), examine(), fire(), insurgency(), land(), launch(), mobilize(), move_popn(), name(), page(), scrap(), sell(), send_message(), tax(), technology(), toxicity(), transfer(), and walk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_shiplist()

shipnum_t do_shiplist ( Ship **  ,
shipnum_t  
)

Definition at line 94 of file shlmisc.cc.

Referenced by bombard(), capture(), detonate(), fire(), grant(), jettison(), land(), launch(), load(), mount(), order(), and scrap().

Here is the caller graph for this function:

◆ DontOwnErr()

void DontOwnErr ( int  ,
int  ,
shipnum_t   
)

Definition at line 126 of file shlmisc.cc.

Referenced by testship().

Here is the caller graph for this function:

◆ enufAP()

int enufAP ( int  ,
int  ,
unsigned  short,
int   
)

Definition at line 131 of file shlmisc.cc.

Referenced by bombard(), capital(), capture(), declare(), defend(), dump(), fire(), insurgency(), jettison(), land(), launch(), load(), mobilize(), move_popn(), page(), scrap(), sell(), send_message(), tax(), technology(), toxicity(), transfer(), and walk().

Here is the caller graph for this function:

◆ get_player()

player_t get_player ( const std::string &  )

Definition at line 163 of file shlmisc.cc.

◆ getracenum()

std::tuple<player_t, governor_t> getracenum ( const std::string &  racepass,
const std::string &  govpass 
)

Find the player/governor that matches passwords.

Parameters
racepassPassword for the race
govpassPassword for the governor
Returns
player and governor numbers, or 0 and 0 if not found

Definition at line 147 of file shlmisc.cc.

◆ in_list()

bool in_list ( const player_t  playernum,
const std::string_view  list,
const Ship s,
shipnum_t nextshipno 
)

Check is the ship is in the given input string.

See start_shiplist's comment for more details.

Definition at line 109 of file shlmisc.cc.

◆ morale_factor()

double morale_factor ( double  )

Definition at line 239 of file shlmisc.cc.

Referenced by capture(), ground_attack(), insurgency(), mech_attack_people(), and people_attack_mech().

Here is the caller graph for this function:

◆ start_shiplist()

shipnum_t start_shiplist ( GameObj g,
const std::string_view  p 
)

Get start of ship lists from either a ship number or ScopeLevel.

start_shiplist and in_list work together so that a user can enter one of:

  • 1234 - a ship number
  • #1234 - a ship number prefixed by an octothorpe.
  • f - a letter representing the type of ship
  • frd - A sequence of letters representing the type of ship. Processing stops after first match.
  • * - An Asterisk as a wildcard for first match.

When a letter or asterisk is given, the shiplist is taken from the current scope.

Parameters
gGame object for scope
pString that might contain ship number
Returns
Ship number at the start of the ship list.

Definition at line 68 of file shlmisc.cc.

References getplanet(), getsdata(), and getstar().

Here is the call graph for this function:

◆ string_to_shipnum()

std::optional<shipnum_t> string_to_shipnum ( std::string_view  s)

Convert input string to a shipnum_t.

Parameters
sUser-provided input string
Returns
If the user provided a valid number, return it.

Definition at line 34 of file shlmisc.cc.