| 1894 | } |
| 1895 | |
| 1896 | void control_drop_gold(char vkey) |
| 1897 | { |
| 1898 | char input[6]; |
| 1899 | |
| 1900 | if (plr[myplr]._pHitPoints >> 6 <= 0) { |
| 1901 | dropGoldFlag = FALSE; |
| 1902 | dropGoldValue = 0; |
| 1903 | return; |
| 1904 | } |
| 1905 | |
| 1906 | memset(input, 0, sizeof(input)); |
| 1907 | snprintf(input, sizeof(input), "%d", dropGoldValue); |
| 1908 | if (vkey == VK_RETURN) { |
| 1909 | if (dropGoldValue > 0) |
| 1910 | control_remove_gold(myplr, initialDropGoldIndex); |
| 1911 | dropGoldFlag = FALSE; |
| 1912 | } else if (vkey == VK_ESCAPE) { |
| 1913 | dropGoldFlag = FALSE; |
| 1914 | dropGoldValue = 0; |
| 1915 | } else if (vkey == VK_BACK) { |
| 1916 | input[strlen(input) - 1] = '\0'; |
| 1917 | dropGoldValue = atoi(input); |
| 1918 | } else if (vkey - '0' >= 0 && vkey - '0' <= 9) { |
| 1919 | if (dropGoldValue || atoi(input) <= initialDropGoldValue) { |
| 1920 | input[strlen(input)] = vkey; |
| 1921 | if (atoi(input) > initialDropGoldValue) |
| 1922 | return; |
| 1923 | if (strlen(input) > strlen(input)) |
| 1924 | return; |
| 1925 | } else { |
| 1926 | input[0] = vkey; |
| 1927 | } |
| 1928 | dropGoldValue = atoi(input); |
| 1929 | } |
| 1930 | } |
| 1931 | |
| 1932 | void control_remove_gold(int pnum, int gold_index) |
| 1933 | { |
no test coverage detected