Call this function to get the list of requirements that the given module needs in order to be playable. Returns the number of requirements it needs...-1 on error.
| 776 | // Call this function to get the list of requirements that the given module needs in order |
| 777 | // to be playable. Returns the number of requirements it needs...-1 on error. |
| 778 | int GetDLLRequirements(const char *name, char *requirements, int buflen) { |
| 779 | ASSERT(buflen >= 0); |
| 780 | ASSERT(requirements); |
| 781 | tDLLOptions opt; |
| 782 | if (!GetDLLGameInfo(name, &opt)) { |
| 783 | mprintf(0, "Unable to get %s's requirements\n", name); |
| 784 | return -1; |
| 785 | } |
| 786 | strncpy(requirements, opt.requirements, buflen - 1); |
| 787 | requirements[buflen - 1] = '\0'; |
| 788 | uint32_t opt_req_len = strlen(opt.requirements); |
| 789 | if (opt_req_len > strlen(requirements)) { |
| 790 | // too small of a buffer! |
| 791 | mprintf(0, "Too small of a buffer to fill in all requirements!...need %d\n", opt_req_len + 1); |
| 792 | Int3(); |
| 793 | // cut off last requirement (which is shortened) |
| 794 | char *p = strrchr(requirements, ','); |
| 795 | if (p) { |
| 796 | *p = '\0'; |
| 797 | } else { |
| 798 | *requirements = '\0'; |
| 799 | } |
| 800 | } |
| 801 | // go through requirements and count em |
| 802 | char *p = requirements; |
| 803 | int count = 0; |
| 804 | while (*p) { |
| 805 | if (*p == ',') |
| 806 | count++; |
| 807 | p++; |
| 808 | } |
| 809 | count++; |
| 810 | return count; |
| 811 | } |
| 812 | // Call this function to get information about the number of teams for the game |
| 813 | // Returns true if it's a team game...false if it's a non-team game. |
| 814 | // If it returns true, then min is filled in with the minumum number of teams needed for the game |
no test coverage detected