- Removed deprecated parameter
- Added more debug logging for LUA functions
This commit is contained in:
parent
8d053ba314
commit
d38b46a529
|
@ -1372,7 +1372,7 @@ void Game::render3d(){
|
|||
|
||||
//surface
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
renderer.renderSurface(avgRenderFps,world.getFrameCount());
|
||||
renderer.renderSurface(avgRenderFps);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderSurface]\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
|
@ -1384,13 +1384,13 @@ void Game::render3d(){
|
|||
|
||||
//units
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
renderer.renderUnits(avgRenderFps,world.getFrameCount());
|
||||
renderer.renderUnits(avgRenderFps);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderUnits]\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
//objects
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
renderer.renderObjects(avgRenderFps,world.getFrameCount());
|
||||
renderer.renderObjects(avgRenderFps);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderObjects]\n",__FILE__,__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ const int ScriptManager::messageWrapCount= 30;
|
|||
const int ScriptManager::displayTextWrapCount= 64;
|
||||
|
||||
void ScriptManager::init(World* world, GameCamera *gameCamera){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const Scenario* scenario= world->getScenario();
|
||||
|
||||
this->world= world;
|
||||
|
@ -140,14 +142,20 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
|||
gameOver= false;
|
||||
gameWon = false;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//call startup function
|
||||
luaScript.beginCall("startup");
|
||||
luaScript.endCall();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
// ========================== events ===============================================
|
||||
|
||||
void ScriptManager::onMessageBoxOk(){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
if(!messageQueue.empty()){
|
||||
|
@ -160,11 +168,15 @@ void ScriptManager::onMessageBoxOk(){
|
|||
}
|
||||
|
||||
void ScriptManager::onResourceHarvested(){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
luaScript.beginCall("resourceHarvested");
|
||||
luaScript.endCall();
|
||||
}
|
||||
|
||||
void ScriptManager::onUnitCreated(const Unit* unit){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
lastCreatedUnitName= unit->getType()->getName();
|
||||
lastCreatedUnitId= unit->getId();
|
||||
luaScript.beginCall("unitCreated");
|
||||
|
@ -174,6 +186,8 @@ void ScriptManager::onUnitCreated(const Unit* unit){
|
|||
}
|
||||
|
||||
void ScriptManager::onUnitDied(const Unit* unit){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
lastDeadUnitName= unit->getType()->getName();
|
||||
lastDeadUnitId= unit->getId();
|
||||
luaScript.beginCall("unitDied");
|
||||
|
@ -181,17 +195,20 @@ void ScriptManager::onUnitDied(const Unit* unit){
|
|||
}
|
||||
|
||||
void ScriptManager::onGameOver(bool won) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
gameWon = won;
|
||||
luaScript.beginCall("gameOver");
|
||||
luaScript.endCall();
|
||||
}
|
||||
|
||||
void ScriptManager::onTimerTriggerEvent() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] TimerTriggerEventList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,TimerTriggerEventList.size());
|
||||
if(TimerTriggerEventList.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] TimerTriggerEventList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,TimerTriggerEventList.size());
|
||||
|
||||
for(std::map<int,TimerTriggerEvent>::iterator iterMap = TimerTriggerEventList.begin();
|
||||
iterMap != TimerTriggerEventList.end(); iterMap++) {
|
||||
|
||||
|
@ -212,14 +229,14 @@ void ScriptManager::onTimerTriggerEvent() {
|
|||
}
|
||||
|
||||
void ScriptManager::onCellTriggerEvent(Unit *movingUnit) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] movingUnit = %p, CellTriggerEventList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,movingUnit,CellTriggerEventList.size());
|
||||
if(CellTriggerEventList.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] movingUnit = %p, CellTriggerEventList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,movingUnit,CellTriggerEventList.size());
|
||||
|
||||
// remove any delayed removals
|
||||
unregisterCellTriggerEvent(-1);
|
||||
}
|
||||
|
||||
inCellTriggerEvent = true;
|
||||
if(movingUnit != NULL) {
|
||||
|
@ -365,6 +382,8 @@ void ScriptManager::setDisplayText(const string &text){
|
|||
}
|
||||
|
||||
void ScriptManager::DisplayFormattedText(const char *fmt, ...) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
|
||||
va_list argList;
|
||||
|
@ -381,42 +400,50 @@ void ScriptManager::DisplayFormattedText(const char *fmt, ...) {
|
|||
}
|
||||
|
||||
void ScriptManager::setCameraPosition(const Vec2i &pos){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
gameCamera->centerXZ(pos.x, pos.y);
|
||||
}
|
||||
|
||||
void ScriptManager::createUnit(const string &unitName, int factionIndex, Vec2i pos){
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->createUnit(unitName, factionIndex, pos);
|
||||
}
|
||||
|
||||
void ScriptManager::giveResource(const string &resourceName, int factionIndex, int amount){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->giveResource(resourceName, factionIndex, amount);
|
||||
}
|
||||
|
||||
void ScriptManager::givePositionCommand(int unitId, const string &commandName, const Vec2i &pos){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->givePositionCommand(unitId, commandName, pos);
|
||||
}
|
||||
|
||||
void ScriptManager::giveAttackCommand(int unitId, int unitToAttackId) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->giveAttackCommand(unitId, unitToAttackId);
|
||||
}
|
||||
|
||||
void ScriptManager::giveProductionCommand(int unitId, const string &producedName){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->giveProductionCommand(unitId, producedName);
|
||||
}
|
||||
|
||||
void ScriptManager::giveUpgradeCommand(int unitId, const string &producedName){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->giveUpgradeCommand(unitId, producedName);
|
||||
}
|
||||
|
||||
void ScriptManager::disableAi(int factionIndex){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
if(factionIndex<GameConstants::maxPlayers){
|
||||
playerModifiers[factionIndex].disableAi();
|
||||
|
@ -425,6 +452,7 @@ void ScriptManager::disableAi(int factionIndex){
|
|||
}
|
||||
|
||||
void ScriptManager::enableAi(int factionIndex){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
if(factionIndex<GameConstants::maxPlayers){
|
||||
playerModifiers[factionIndex].enableAi();
|
||||
|
@ -439,6 +467,7 @@ bool ScriptManager::getAiEnabled(int factionIndex){
|
|||
}
|
||||
|
||||
void ScriptManager::disableConsume(int factionIndex){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
if(factionIndex<GameConstants::maxPlayers){
|
||||
playerModifiers[factionIndex].disableConsume();
|
||||
|
@ -446,6 +475,7 @@ void ScriptManager::disableConsume(int factionIndex){
|
|||
}
|
||||
|
||||
void ScriptManager::enableConsume(int factionIndex){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
if(factionIndex<GameConstants::maxPlayers){
|
||||
playerModifiers[factionIndex].enableConsume();
|
||||
|
@ -605,14 +635,17 @@ int ScriptManager::getTimerEventSecondsElapsed(int eventId) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void ScriptManager::setPlayerAsWinner(int factionIndex){
|
||||
void ScriptManager::setPlayerAsWinner(int factionIndex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
if(factionIndex<GameConstants::maxPlayers){
|
||||
playerModifiers[factionIndex].setAsWinner();
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptManager::endGame(){
|
||||
void ScriptManager::endGame() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
gameOver= true;
|
||||
}
|
||||
|
@ -643,28 +676,33 @@ Vec2i ScriptManager::getPerformanceTimerResults() {
|
|||
return world->getGame()->getPerformanceTimerResults();
|
||||
}
|
||||
|
||||
Vec2i ScriptManager::getStartLocation(int factionIndex){
|
||||
Vec2i ScriptManager::getStartLocation(int factionIndex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getStartLocation(factionIndex);
|
||||
}
|
||||
|
||||
|
||||
Vec2i ScriptManager::getUnitPosition(int unitId){
|
||||
Vec2i ScriptManager::getUnitPosition(int unitId) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getUnitPosition(unitId);
|
||||
}
|
||||
|
||||
int ScriptManager::getUnitFaction(int unitId){
|
||||
int ScriptManager::getUnitFaction(int unitId) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getUnitFactionIndex(unitId);
|
||||
}
|
||||
|
||||
int ScriptManager::getResourceAmount(const string &resourceName, int factionIndex){
|
||||
int ScriptManager::getResourceAmount(const string &resourceName, int factionIndex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getResourceAmount(resourceName, factionIndex);
|
||||
}
|
||||
|
||||
const string &ScriptManager::getLastCreatedUnitName(){
|
||||
const string &ScriptManager::getLastCreatedUnitName() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return lastCreatedUnitName;
|
||||
}
|
||||
|
@ -684,27 +722,32 @@ bool ScriptManager::getGameWon() {
|
|||
return gameWon;
|
||||
}
|
||||
|
||||
int ScriptManager::getLastCreatedUnitId(){
|
||||
int ScriptManager::getLastCreatedUnitId() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return lastCreatedUnitId;
|
||||
}
|
||||
|
||||
const string &ScriptManager::getLastDeadUnitName(){
|
||||
const string &ScriptManager::getLastDeadUnitName() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return lastDeadUnitName;
|
||||
}
|
||||
|
||||
int ScriptManager::getLastDeadUnitId(){
|
||||
int ScriptManager::getLastDeadUnitId() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return lastDeadUnitId;
|
||||
}
|
||||
|
||||
int ScriptManager::getUnitCount(int factionIndex){
|
||||
int ScriptManager::getUnitCount(int factionIndex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getUnitCount(factionIndex);
|
||||
}
|
||||
|
||||
int ScriptManager::getUnitCountOfType(int factionIndex, const string &typeName){
|
||||
int ScriptManager::getUnitCountOfType(int factionIndex, const string &typeName) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return world->getUnitCountOfType(factionIndex, typeName);
|
||||
}
|
||||
|
@ -1000,6 +1043,7 @@ int ScriptManager::getUnitCountOfType(LuaHandle* luaHandle){
|
|||
}
|
||||
|
||||
int ScriptManager::DisplayFormattedText(LuaHandle* luaHandle) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//const char *ret;
|
||||
//lua_lock(luaHandle);
|
||||
|
|
|
@ -1261,7 +1261,7 @@ void Renderer::renderMessageBox(const GraphicMessageBox *messageBox) {
|
|||
|
||||
// ==================== complex rendering ====================
|
||||
|
||||
void Renderer::renderSurface(const int renderFps, const int worldFrameCount) {
|
||||
void Renderer::renderSurface(const int renderFps) {
|
||||
IF_DEBUG_EDITION(
|
||||
if (getDebugRenderer().willRenderSurface()) {
|
||||
getDebugRenderer().renderSurface(visibleQuad / Map::cellScale);
|
||||
|
@ -1457,7 +1457,7 @@ void Renderer::renderSurface(const int renderFps, const int worldFrameCount) {
|
|||
)
|
||||
}
|
||||
|
||||
void Renderer::renderObjects(const int renderFps, const int worldFrameCount) {
|
||||
void Renderer::renderObjects(const int renderFps) {
|
||||
const World *world= game->getWorld();
|
||||
const Map *map= world->getMap();
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ void Renderer::renderWater() {
|
|||
assertGl();
|
||||
}
|
||||
|
||||
void Renderer::renderUnits(const int renderFps, const int worldFrameCount) {
|
||||
void Renderer::renderUnits(const int renderFps) {
|
||||
Unit *unit=NULL;
|
||||
const World *world= game->getWorld();
|
||||
MeshCallbackTeamColor meshCallbackTeamColor;
|
||||
|
|
|
@ -321,11 +321,11 @@ public:
|
|||
void renderMessageBox(const GraphicMessageBox *listBox);
|
||||
|
||||
//complex rendering
|
||||
void renderSurface(const int renderFps, const int worldFrameCount);
|
||||
void renderObjects(const int renderFps, const int worldFrameCount);
|
||||
void renderSurface(const int renderFps);
|
||||
void renderObjects(const int renderFps);
|
||||
|
||||
void renderWater();
|
||||
void renderUnits(const int renderFps, const int worldFrameCount);
|
||||
void renderUnits(const int renderFps);
|
||||
|
||||
void renderSelectionEffects();
|
||||
void renderWaterEffects();
|
||||
|
|
Loading…
Reference in New Issue
Block a user