Permalink
Browse files

Whitespace, typo and general style cleanup.

  • Loading branch information...
1 parent 94933f3 commit 3ed157bbc9bc78b2cfa5fb03bafab8795cb4dfef @Deiz Deiz committed Jun 24, 2011
View
@@ -289,9 +289,8 @@ void background_renderStars( const double dt )
glDrawArrays( GL_POINTS, 0, nstars ); /* This second pass is when the lines are very short that they "lose" intensity. */
glShadeModel(GL_FLAT);
}
- else {
+ else
glDrawArrays( GL_POINTS, 0, nstars );
- }
/* Clear star movement. */
star_x = 0.;
View
@@ -431,9 +431,8 @@ static void cam_updatePilotZoom( Pilot *follow, Pilot *target, double dt )
/* Get zoom. */
tz = MIN( dx, dy );
}
- else {
+ else
tz = znear; /* Aim at in. */
- }
/* We'll increment based on current time compression. */
if (dt_mod > 2.)
View
@@ -427,9 +427,8 @@ static void comm_bribePilot( unsigned int wid, char *unused )
/* Bribe message. */
str = comm_getString( "bribe_prompt" );
- if (str == NULL) {
+ if (str == NULL)
answer = dialogue_YesNo( "Bribe Pilot", "\"I'm gonna need at least %"CREDITS_PRI" credits to not leave you as a hunk of floating debris.\"\n\nPay %"CREDITS_PRI" credits?", price, price );
- }
else
answer = dialogue_YesNo( "Bribe Pilot", "%s\n\nPay %"CREDITS_PRI" credits?", str, price );
View
@@ -474,9 +474,8 @@ int conf_loadConfig ( const char* file )
/* set the keybind */
input_setKeybind( keybind_info[i][0], type, key, m );
}
- else {
+ else
WARN("Malformed keybind for '%s' in '%s'.", keybind_info[i][0], file);
- }
}
/* clean up after table stuff */
lua_pop(L,1);
@@ -591,9 +590,8 @@ void conf_parseCLI( int argc, char** argv )
}
/** @todo handle multiple ndata. */
- if (optind < argc) {
+ if (optind < argc)
conf.ndata = strdup( argv[ optind ] );
- }
}
View
@@ -378,17 +378,20 @@ static void cli_input( unsigned int wid, char *unused )
/* Set up state. */
L = cli_state;
+
/* Set up for concat. */
- if (!cli_firstline) { /* o */
+ if (!cli_firstline) /* o */
lua_pushliteral(L, "\n"); /* o \n */
- }
+
/* Load the string. */
lua_pushstring( L, str ); /* s */
+
/* Concat. */
- if (!cli_firstline) { /* o \n s */
+ if (!cli_firstline) /* o \n s */
lua_concat(L, 3); /* s */
- }
+
status = luaL_loadbuffer( L, lua_tostring(L,-1), lua_strlen(L,-1), "=cli" );
+
/* String isn't proper Lua yet. */
if (status == LUA_ERRSYNTAX) {
size_t lmsg;
View
@@ -959,12 +959,10 @@ static void sysedit_checkButtons (void)
}
/* Jump dependent. */
- if (sel_jump) {
+ if (sel_jump)
window_enableButton( sysedit_wid, "btnReset" );
- }
- else {
+ else
window_disableButton( sysedit_wid, "btnReset" );
- }
/* Editor - just one planet. */
if ((sel_planet==1) && (sel_jump==0))
View
@@ -801,9 +801,8 @@ static void uniedit_selectText (void)
l += snprintf( &buf[l], sizeof(buf)-l, "%s%s", uniedit_sys[i]->name,
(i == uniedit_nsys-1) ? "" : ", " );
}
- if (l == 0) {
+ if (l == 0)
uniedit_deselect();
- }
else {
window_modifyText( uniedit_wid, "txtSelected", buf );
@@ -831,9 +830,8 @@ static void uniedit_selectText (void)
window_modifyText( uniedit_wid, "txtPresence", buf );
}
- else {
+ else
window_modifyText( uniedit_wid, "txtPresence", "Multiple selected" );
- }
}
}
@@ -940,14 +938,12 @@ static void uniedit_editGenList( unsigned int wid )
/* Virtual asset button. */
for (i=0; i<n; i++) {
p = sys->planets[i];
- if (p->real == ASSET_VIRTUAL) {
+ if (p->real == ASSET_VIRTUAL)
str[j++] = strdup( p->name );
- }
}
}
- else {
+ else
str[j++] = strdup("None");
- }
/* Add list. */
h = UNIEDIT_EDIT_HEIGHT+y-20 - 2*(BUTTON_HEIGHT+20);
View
@@ -639,9 +639,8 @@ int economy_update( unsigned int dt )
*/
scale = 1.;
offset = 1.;
- for (i=0; i<systems_nstack; i++) {
+ for (i=0; i<systems_nstack; i++)
systems_stack[i].prices[j] = X[i] * scale + offset;
- }
}
/* Clean up. */
View
@@ -355,9 +355,8 @@ static void equipment_renderColumn( double x, double y, double w, double h,
else
dc = &cInert;
}
- else {
+ else
dc = outfit_slotSizeColour( &lst[i].slot );
- }
/* Choose colours based on size. */
if (i==selected && dc == NULL)
@@ -701,16 +700,13 @@ static void equipment_renderOverlaySlots( double bx, double by, double bw, doubl
return;
/* Get the slot. */
- if (wgt->mouseover < p->outfit_nweapon) {
+ if (wgt->mouseover < p->outfit_nweapon)
slot = &p->outfit_weapon[wgt->mouseover];
- }
- else if (wgt->mouseover < p->outfit_nweapon + p->outfit_nutility) {
+ else if (wgt->mouseover < p->outfit_nweapon + p->outfit_nutility)
slot = &p->outfit_utility[ wgt->mouseover - p->outfit_nweapon ];
- }
- else {
+ else
slot = &p->outfit_structure[ wgt->mouseover -
p->outfit_nweapon - p->outfit_nutility ];
- }
/* For comfortability. */
o = slot->outfit;
@@ -1330,9 +1326,8 @@ static void equipment_genLists( unsigned int wid )
slottype[i][0] = typename[0];
slottype[i][1] = '\0';
}
- else {
+ else
slottype[i] = NULL;
- }
}
toolkit_setImageArrayAlt( wid, EQUIPMENT_OUTFITS, alt );
toolkit_setImageArrayQuantity( wid, EQUIPMENT_OUTFITS, quantity );
@@ -1711,17 +1706,20 @@ static void equipment_unequipShip( unsigned int wid, char* str )
ship = eq_wgt.selected;
- /* There are two conditionts when you can't unequip all, first off
- * is when you have deployed ships, second off is when you have more cargo
- * than you can carry "naked". */
+ /*
+ * Unequipping is disallowed under two conditions. Firstly, the ship may not
+ * be unequipped when it has fighters deployed in space. Secondly, it cannot
+ * unequip if it's carrying more cargo than the ship normally fits, i.e.
+ * by equipping cargo pods.
+ */
for (i=0; i<ship->noutfits; i++) {
/* Must have outfit. */
if (ship->outfits[i]->outfit == NULL)
continue;
/* Must be fighter bay. */
if (!outfit_isFighterBay( ship->outfits[i]->outfit))
continue;
- /* Must not have deployed. */
+ /* Must not have deployed fighters. */
if (ship->outfits[i]->u.ammo.deployed > 0) {
dialogue_alert( "You can not unequip your ship while you have deployed fighters!" );
return;
@@ -1798,9 +1796,8 @@ static void equipment_sellShip( unsigned int wid, char* str )
/* Check if player really wants to sell. */
if (!dialogue_YesNo( "Sell Ship",
- "Are you sure you want to sell your ship %s for %s credits?", shipname, buf)) {
+ "Are you sure you want to sell your ship %s for %s credits?", shipname, buf))
return;
- }
/* Sold. */
name = strdup(shipname);
@@ -1812,8 +1809,7 @@ static void equipment_sellShip( unsigned int wid, char* str )
equipment_regenLists( wid, 0, 1 );
/* Display widget. */
- dialogue_msg( "Ship Sold", "You have sold your ship %s for %s credits.",
- name, buf );
+ dialogue_msg( "Ship Sold", "You have sold your ship %s for %s credits.", name, buf );
free(name);
}
/**
@@ -1846,6 +1842,7 @@ void equipment_cleanup (void)
/* Destroy the VBO. */
if (equipment_vbo != NULL)
gl_vboDestroy( equipment_vbo );
+
equipment_vbo = NULL;
}
View
@@ -387,9 +387,8 @@ int event_alreadyRunning( int data )
/* Find events. */
for (i=0; i<event_nactive; i++) {
ev = &event_active[i];
- if (ev->data == data) {
+ if (ev->data == data)
return 1;
- }
}
return 0;
@@ -654,9 +653,9 @@ void events_cleanup (void)
/* Free active events. */
for (i=0; i<event_nactive; i++)
event_cleanup( &event_active[i] );
- if (event_active != NULL) {
+ if (event_active != NULL)
free(event_active);
- }
+
event_active = NULL;
event_nactive = 0;
event_mactive = 0;
Oops, something went wrong.

0 comments on commit 3ed157b

Please sign in to comment.