New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move parse.cpp from engine to gamelogic #1105
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gamelogic This code has been located in the engine, but it is only used by the gamelogic through trap calls. So it can be moved into the gamelogic and the trap calls removed. Diff of parse.cpp versus the engine version: diff --git a/daemon/src/engine/qcommon/parse.cpp b/src/shared/parse.cpp index 71947a71c..b56bf1d61 100644 --- a/daemon/src/engine/qcommon/parse.cpp +++ b/src/shared/parse.cpp @@ -1,28 +1,43 @@ /* =========================================================================== + +Unvanquished GPL Source Code Copyright (C) 1999-2005 Id Software, Inc. Copyright (C) 2000-2009 Darklegion Development -This file is part of Daemon. +This file is part of the Unvanquished GPL Source Code (Unvanquished Source Code). -Daemon is free software; you can redistribute it +Unvanquished is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -Daemon is distributed in the hope that it will be +Unvanquished is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Daemon; if not, write to the Free Software +along with Unvanquished; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + =========================================================================== */ -#include "qcommon/q_shared.h" -#include "qcommon.h" +#ifdef BUILD_CGAME +#include "cgame/cg_local.h" +#else +#include "sgame/sg_local.h" +#endif + +static void* Z_Malloc(size_t size) +{ + return calloc(size, 1); +} +static void Z_Free(void* ptr) +{ + free(ptr); +} //script flags static const int SCFL_NOERRORS = 0x0001; @@ -47,6 +62,9 @@ static const int TT_FLOAT = 0x0800; // floating point number static const int TT_INTEGER = 0x1000; // integer number static const int TT_LONG = 0x2000; // long number static const int TT_UNSIGNED = 0x4000; // unsigned number + +namespace { + //punctuation sub type //-------------------- enum class punctuationSub_t { @@ -224,10 +242,6 @@ struct directive_t #define DEFINEHASHSIZE 1024 -static bool Parse_ReadToken( source_t *source, token_t *token ); -static bool Parse_AddDefineToSourceFromString( source_t *source, - char *string ); - int numtokens; //list with global defines added to every source loaded @@ -309,6 +323,12 @@ punctuation_t Default_Punctuations[] = { nullptr, Util::enum_cast<punctuationSub_t>(0), nullptr } }; +} // namespace + +static bool Parse_ReadToken( source_t *source, token_t *token ); +static bool Parse_AddDefineToSourceFromString( source_t *source, + char *string ); + /* =============== Parse_CreatePunctuationTable @@ -1143,7 +1163,7 @@ static script_t *Parse_LoadScriptFile( const char *filename ) void *buffer; script_t *script; - length = FS_FOpenFileRead( filename, &fp, false ); + length = trap_FS_FOpenFile( filename, &fp, fsMode_t::FS_READ ); if ( !fp ) { return nullptr; } @@ -1168,8 +1188,8 @@ static script_t *Parse_LoadScriptFile( const char *filename ) // Parse_SetScriptPunctuations( script, nullptr ); // - FS_Read( script->buffer, length, fp ); - FS_FCloseFile( fp ); + trap_FS_Read( script->buffer, length, fp ); + trap_FS_FCloseFile( fp ); // return script;
Now fixes #503 |
DolceTriade
approved these changes
Jan 28, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.