| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/program.cpp $ |
| 21 | * $Revision: 8 $ |
| 22 | * $Date: 5/13/99 3:41p $ |
| 23 | * $Author: Ardussi $ |
| 24 | * |
| 25 | * program state info |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/program.cpp $ |
| 28 | * |
| 29 | * 8 5/13/99 3:41p Ardussi |
| 30 | * changes for compiling on the Mac |
| 31 | * |
| 32 | * 7 4/15/99 1:42a Jeff |
| 33 | * changes for linux compile |
| 34 | * |
| 35 | * 6 4/14/99 3:57a Jeff |
| 36 | * fixed case mismatch in #includes |
| 37 | * |
| 38 | * 5 10/18/98 9:12p Matt |
| 39 | * Use new symbolic constant for the program name. |
| 40 | * |
| 41 | * 4 10/12/98 1:45p Samir |
| 42 | * added version key to database. |
| 43 | * |
| 44 | * 3 10/08/98 7:30p Samir |
| 45 | * changed version numbers. |
| 46 | * |
| 47 | * 2 10/02/98 12:30p Samir |
| 48 | * added version information for beta/demo. |
| 49 | * |
| 50 | * 3 2/04/97 5:07p Samir |
| 51 | * Added windowed state to determine if we run in a window |
| 52 | * |
| 53 | * 2 2/04/97 2:30p Samir |
| 54 | * Changed program_state to program_version. |
| 55 | * |
| 56 | * 1 2/03/97 4:42p Samir |
| 57 | * Program version control |
| 58 | * |
| 59 | * $NoKeywords: $ |
| 60 | */ |
| 61 | |
| 62 | #include "program.h" |
| 63 | #include "pserror.h" |
| 64 | #include "descent.h" |
| 65 | |
| 66 | #include "appdatabase.h" |
| 67 | |
| 68 | program_version Program_version; |
| 69 | |
| 70 | // Initializes the current program state |
| 71 | |
| 72 | void ProgramVersion(int version_type, uint8_t major, uint8_t minor, uint8_t build) { |
| 73 | oeLnxAppDatabase dbase((oeLnxAppDatabase *)Database); |
| 74 | |
| 75 | Program_version.version_type = version_type; |
| 76 | Program_version.major = major; |
| 77 | Program_version.minor = minor; |
| 78 | Program_version.build = build; |
| 79 | |
| 80 | PROGRAM(beta) = 0; |
| 81 | PROGRAM(demo) = 0; |
| 82 | |
| 83 | if (version_type & BETA_VERSION) |
| 84 | PROGRAM(beta) = 1; |
| 85 | if (version_type & DEMO_VERSION) |
| 86 | PROGRAM(demo) = 1; |
| 87 | |
| 88 | switch (version_type & (~0xf000)) { |
| 89 | case DEVELOPMENT_VERSION: |
| 90 | PROGRAM(debug) = 1; |
| 91 | PROGRAM(editor) = 0; |
| 92 | PROGRAM(release) = 0; |
| 93 | PROGRAM(windowed) = 0; |
| 94 | break; |
| 95 | |
| 96 | case RELEASE_VERSION: |
| 97 | PROGRAM(debug) = 0; |
| 98 | PROGRAM(editor) = 0; |
| 99 | PROGRAM(release) = 0; |
| 100 | PROGRAM(windowed) = 0; |
| 101 | break; |
| 102 | |
| 103 | default: |
| 104 | Int3(); // NO NO NO |
| 105 | } |
| 106 | |
| 107 | if (dbase.lookup_record("Version")) { |
| 108 | dbase.write("Major", Program_version.major); |
| 109 | dbase.write("Minor", Program_version.minor); |
| 110 | dbase.write("Build", Program_version.build); |
| 111 | } else { |
| 112 | Error("Unable to find version key for %s", PRODUCT_NAME); |
| 113 | } |
| 114 | } |