From d71dadfa05176304ca289baa9800130b67613729 Mon Sep 17 00:00:00 2001 From: Allanis Date: Mon, 10 Mar 2014 14:59:09 +0000 Subject: [PATCH] [Change] Change data type to unsigned int for prices rather than signed int. --- src/comm.c | 2 +- src/economy.h | 2 +- src/land.c | 16 ++++++++-------- src/pilot.h | 2 +- src/ship.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/comm.c b/src/comm.c index efcf89f..a35ed86 100644 --- a/src/comm.c +++ b/src/comm.c @@ -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; diff --git a/src/economy.h b/src/economy.h index 4d54fe8..cc44583 100644 --- a/src/economy.h +++ b/src/economy.h @@ -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. */ diff --git a/src/land.c b/src/land.c index 9244cc2..091132a 100644 --- a/src/land.c +++ b/src/land.c @@ -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. */ diff --git a/src/pilot.h b/src/pilot.h index a07922e..c04a4b6 100644 --- a/src/pilot.h +++ b/src/pilot.h @@ -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. */ diff --git a/src/ship.h b/src/ship.h index bd44fc9..d4830ae 100644 --- a/src/ship.h +++ b/src/ship.h @@ -52,10 +52,10 @@ 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. */ + char* fabricator; /* Manufacturer. */ + char* description; /* Sales pitch. */ /* Movement. */ double thrust, turn, speed;