mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 08:52:26 +00:00
Move Script* classes to Script namespace
- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
ScriptContext.* → Context.*
ScriptInterface.* → Interface.*
ScriptRequest.* → Request.*
ScriptEngine.* → Engine.*
ScriptConversions.* → Conversions.*
ScriptExceptions.* → Exceptions.*
ScriptForward.* → ForwardDeclarations.*
ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
ScriptInterface_impl → Interface_impl
ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
macro) by adding them to suppressions-list.txt (these are not caused
by this refactor)
Fixes #7516
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "scriptinterface/FunctionWrapper.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
#include "scriptinterface/ScriptRequest.h"
|
||||
#include "scriptinterface/Request.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <js/RootingAPI.h>
|
||||
@@ -56,7 +56,7 @@ std::string canonfloat(T value, int prec)
|
||||
return r;
|
||||
}
|
||||
|
||||
CDebugSerializer::CDebugSerializer(const ScriptInterface& scriptInterface, std::ostream& stream, bool includeDebugInfo) :
|
||||
CDebugSerializer::CDebugSerializer(const Script::Interface& scriptInterface, std::ostream& stream, bool includeDebugInfo) :
|
||||
m_ScriptInterface(scriptInterface), m_Stream(stream), m_IsDebug(includeDebugInfo), m_Indent(0)
|
||||
{
|
||||
}
|
||||
@@ -153,14 +153,14 @@ void CDebugSerializer::PutString(const char* name, const std::string& value)
|
||||
|
||||
void CDebugSerializer::PutScriptVal(const char* name, JS::MutableHandleValue value)
|
||||
{
|
||||
ScriptRequest rq(m_ScriptInterface);
|
||||
Script::Request rq(m_ScriptInterface);
|
||||
|
||||
JS::RootedValue serialize(rq.cx);
|
||||
if (Script::GetProperty(rq, value, "Serialize", &serialize) && !serialize.isNullOrUndefined())
|
||||
{
|
||||
// If the value has a Serialize property, pretty-parse that instead.
|
||||
// (this gives more accurate OOS reports).
|
||||
ScriptFunction::Call(rq, value, "Serialize", &serialize);
|
||||
Script::Function::Call(rq, value, "Serialize", &serialize);
|
||||
std::string serialized_source = Script::ToString(rq, &serialize, true);
|
||||
m_Stream << INDENT << name << ": " << serialized_source << "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user