[Change] Change data type to unsigned int for prices rather than signed

int.
This commit is contained in:
Allanis 2014-03-10 14:59:09 +00:00
parent 30e89fe1c8
commit d71dadfa05
5 changed files with 14 additions and 14 deletions

View File

@ -119,7 +119,7 @@ int comm_open(unsigned int pilot) {
static void comm_bribe(unsigned int wid, char* unused) {
(void)unused;
int answer;
int price;
unsigned int price;
char* str;
lua_State* L;

View File

@ -3,7 +3,7 @@
typedef struct Commodity_ {
char* name;
char* description;
int low, medium, high; /* Prices. */
unsigned int low, medium, high; /* Prices. */
} Commodity;
/* Commidity stuff. */

View File

@ -97,7 +97,7 @@ static void shipyard_yoursUpdate(unsigned int wid, char* str);
static void shipyard_yoursChange(unsigned int wid, char* str);
static void shipyard_yoursSell(unsigned int wid, char* str);
static void shipyard_yoursTransport(unsigned int wid, char* str);
static int shipyard_yoursTransportPrice(char* shipname);
static unsigned int shipyard_yoursTransportPrice(char* shipname);
/* Spaceport bar. */
static void spaceport_bar_open(void);
/* News. */
@ -108,7 +108,7 @@ static void misn_accept(unsigned int wid, char* str);
static void misn_genList(unsigned int wid, int first);
static void misn_update(unsigned int wid, char* str);
/* Refuel. */
static int refuel_price(void);
static unsigned int refuel_price(void);
static void spaceport_refuel(unsigned int wid, char* str);
/* The local market. */
@ -415,7 +415,7 @@ static int outfit_canBuy(Outfit* outfit, int q, int errmsg) {
return 0;
}
/* Not enough $$. */
else if(q*(int)outfit->price >= player->credits) {
else if(q*outfit->price >= player->credits) {
if(errmsg != 0) {
credits2str(buf, q*outfit->price - player->credits, 2);
dialogue_alert("You need %s more SCred.", buf);
@ -776,7 +776,7 @@ static void shipyard_yoursUpdate(unsigned int wid, char* str) {
char* shipname;
Pilot* ship;
char* loc;
int price;
unsigned int price;
shipname = toolkit_getList(wid, "lstYourShips");
if(strcmp(shipname, "None")==0) {
@ -904,7 +904,7 @@ static void shipyard_yoursSell(unsigned int wid, char* str) {
static void shipyard_yoursTransport(unsigned int wid, char* str) {
(void)str;
int price;
unsigned int price;
char* shipname, buf[16];
shipname = toolkit_getList(wid, "lstYourShips");
@ -935,7 +935,7 @@ static void shipyard_yoursTransport(unsigned int wid, char* str) {
shipyard_yoursUpdate(wid, NULL);
}
static int shipyard_yoursTransportPrice(char* shipname) {
static unsigned int shipyard_yoursTransportPrice(char* shipname) {
char* loc;
Pilot* ship;
int price;
@ -1100,8 +1100,8 @@ static void misn_update(unsigned int wid, char* str) {
}
/* Return how much it will cost to refuel the player. */
static int refuel_price(void) {
return (player->fuel_max - player->fuel)*3;
static unsigned int refuel_price(void) {
return (unsigned int)((player->fuel_max - player->fuel)*3);
}
/* Refuel the player. */

View File

@ -153,7 +153,7 @@ typedef struct Pilot_ {
double jam_chance; /**< Jam chance. */
/* Cargo. */
int credits; /**< Moniez the pilot has. */
unsigned int credits; /**< Moniez the pilot has. */
PilotCommodity* commodities; /**< Commodity and quantity. */
int ncommodities; /**< Number of commodies. */
int cargo_free; /**< Free commodity space. */

View File

@ -52,7 +52,7 @@ typedef struct Ship_ {
ShipClass class; /* Ship class. */
/* Store stuff. */
int price; /* Price! */
unsigned int price; /* Price! */
int tech;
char* fabricator; /* Manufacturer. */
char* description; /* Sales pitch. */