* Handles Click event for the "+" button in starport window. * * @return True, always. */
| 1411 | * @return True, always. |
| 1412 | */ |
| 1413 | bool GUI_Purchase_Plus_Click(Widget *w) |
| 1414 | { |
| 1415 | FactoryWindowItem *item = GUI_FactoryWindow_GetItem(g_factoryWindowSelected); |
| 1416 | ObjectInfo *oi = item->objectInfo; |
| 1417 | House *h = g_playerHouse; |
| 1418 | bool canCreateMore = true; |
| 1419 | uint16 type = item->objectType; |
| 1420 | |
| 1421 | GUI_Widget_MakeNormal(w, false); |
| 1422 | |
| 1423 | if (g_table_unitInfo[type].movementType != MOVEMENT_WINGER && g_table_unitInfo[type].movementType != MOVEMENT_SLITHER) { |
| 1424 | if (g_starPortEnforceUnitLimit && h->unitCount >= h->unitCountMax) canCreateMore = false; |
| 1425 | } |
| 1426 | |
| 1427 | if (item->amount < oi->available && item->credits <= h->credits && canCreateMore) { |
| 1428 | item->amount++; |
| 1429 | |
| 1430 | GUI_FactoryWindow_UpdateDetails(item); |
| 1431 | |
| 1432 | g_factoryWindowOrdered++; |
| 1433 | |
| 1434 | h->credits -= item->credits; |
| 1435 | |
| 1436 | GUI_FactoryWindow_DrawCaption(NULL); |
| 1437 | } |
| 1438 | |
| 1439 | return true; |
| 1440 | } |
| 1441 | |
| 1442 | /** |
| 1443 | * Handles Click event for the "-" button in startport window. |
nothing calls this directly
no test coverage detected