Jump to content
  • Advertisement

BiiXteR

Member
  • Content Count

    126
  • Joined

  • Last visited

Community Reputation

395 Neutral

About BiiXteR

  • Rank
    Member

Personal Information

  • Role
    Amateur / Hobbyist
    Game Designer
    Programmer
  • Interests
    |programmer|
  1.   Oh I have never seen a line like "void (*)(void)" before, but I did some reading and I understand now :) It compiles perfectly now, thank you.   And all the intellisense errors are gone now, so I think I was correct about intellisense messing with me.
  2. Me again, with another LuaBridge problem, once again I can't find a solution to it. >.>   This time I tried using this code :  void LuaManager::LinkFunctionsWithScript(const std::string& file) { if (mLuaScripts.find(file)->second == nullptr) { gDebugger.PrintError(__FILE__, "Could not link script '" + file + "' with C++ functions, the script file could not be found."); return; } luabridge::getGlobalNamespace(mLuaScripts.find(file)->second) .beginClass<Debugger>("Debugger") .addConstructor<void*>() .addFunction("PrintError", &Debugger::PrintError) .endClass(); } Which results in build errors in Namespace.h (which is a part of LuaBridge) :  namespace.h(857): error C2039: 'Params': is not a member of 'luabridge::FuncTraits<MemFn,MemFn>' namespace.h(857): note: see declaration of 'luabridge::FuncTraits<MemFn,MemFn>' And when checking the rest of the file I noticed several other intellisense errors :  identifier 'rawgetfield' is undefined (line 223) identifier 'getIdentityKey' is undefined (line 266) identifier 'rawsetfield' is undefined (line 289) /* The weird thing here, to me, is that the same functions are used several times more without getting any errors and I've heard that intellisense isn't that trustable, so maybe this is nothing? */ name followed by '::' must be a class or namespace name (line 276) /* And then those same errors repeat SOMETIMES troughout the entire file, some times it uses the same function and says it's an error, and sometimes not. */ When looking around some more I also noticed more intellisense errors in Stack.h, dump.h.   And once again I have no idea whats going on.   (And just to prevent me from spamming this forum so much, maybe you could tell me the steps I should do to solve this problem on my own? >.< )
  3.   Yeah that made it work, how come the order makes any difference though? And why does it "matter" which way LuaBridge includes their stuff? :o
  4.   The source of LuaBridge is here : https://github.com/vinniefalco/LuaBridge       Can't find any circular inclusions, unless here are some in either Lua or LuaBridge which i highly doubt.       What do you mean by "including the lua header files in a non-default namespace" ?
  5. Now I'm even more confused...   I randomly played around with the code hoping to find a solution somehow, and removed the line which includes LuaBridge.h, and after removing it the solution compiles and runs like it should? o.o How does including LuaBridge.h result in lua_State being "undefined" ?   What.
  6.   I did not supply a library to link since I'm just using the source of Lua. And I checked both versions, none of them work.   In the build output I get these errors at the same line :  1>c:\users\alex\desktop\untitledcppgame\untitledcppgame\luamanager.h(21): error C2143: syntax error: missing ';' before '*' 1>c:\users\alex\desktop\untitledcppgame\untitledcppgame\luamanager.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\alex\desktop\untitledcppgame\untitledcppgame\luamanager.h(21): error C2238: unexpected token(s) preceding ';' And lua_State should be in there somewhere.     Unsure what you mean, if you mean the Lua source files, I have replaced them several times just in case I might have deleted something or modified them by mistake.
  7. I'm trying to use the Lua source code in my application but C++ won't let me.   I have this piece of code, on line 21 it tells me that lua_State is undefined, and as far as I know I haven't missed including any files? #pragma once #include <External\LuaBridge\LuaBridge.h> extern "C" { #include <External/Lua/lua.h> #include <External/Lua/lualib.h> #include <External/Lua/lauxlib.h> } class LuaManager { public: LuaManager(); ~LuaManager(); private: lua_State* L; // Error here. }; Have no idea what I'm doing wrong :(
  8.   I would like to look at the source code of that, if that's possible.
  9.   Forgot to create the XMLDocument before using it, why do I never notice this :(       Does "forgetting to call new on the XMLDocument before using it" count as a simple user error? :P
  10. I'm trying to load a simple XML file using TinyXml2 but it just crashes. This is the contents of the file I'm trying to load :  <Texture Name='Grass' Path='Data/Textures/Grass.png'> </Texture> My file structure looks like this :      Here's how I'm attempting to load the file :  XMLFile file; file.LoadFile("Data/Textures/textures.xml"); XMLFile::LoadFile() is this :  bool XMLFile::LoadFile(const std::string& filePath) { if (mDocument->LoadFile(filePath.c_str()) != XML_SUCCESS) { gDebugger.PrintError(__FILE__, "Failed to load file : " + filePath + " from disk."); return false; } return true; } mDocument is this in the header file :  tinyxml2::XMLDocument* mDocument; It tells me that it crashed in tinyxml2.cpp on line 765 : void XMLNode::DeleteChildren() { while( _firstChild ) { /* Crashes here */ TIXMLASSERT( _lastChild ); DeleteChild( _firstChild ); } _firstChild = _lastChild = 0; } I can't understand what I'm doing wrong? :/
  11.   Yeah, thought it'd be complex, but now I at least know where to start. And I'm surprised I didn't find that wiki, I've been googling for about 2 hours now....
  12. Decided I want my game to use some sort of random world generation. However I have no idea where to start.   I made a super simple generator which basically has a 50% chance to spawn a Stone or a Grass tile, and then it has a 80% chance to spawn a pink tile on the above layer of tiles : Grey = Stone, Green = Grass, Pink = Pink)     However,this is not at all what I want.   What I do want is a island which has a specific biome (like forest or desert, depending on what the player choose), and if it is a desert it should generate stone and sand, and sometimes (or rarely might be a better word) generate a "puddle" of water. But if it's a forest it should generate grass, trees and stone, mountains etc. So depending on the biome the generation should be different. I also want the island to be surrounded by water.   But I have no idea, at all how to accomplish this.
  13.   Technically it's not the content you're looking for, but the tag name. The content is the text between the tags.    The problem is that FirstChildElement only looks at children - not grandchildren, or great-grandchildren, etc. I don't know if TinyXML2 offers a 'find element anywhere' function; if not, you'll have to do this manually.   One way to approach this is to write a recursive function. It would examine a node, and call itself on any children of that node. Unfortunately recursive functions can be hard to understand.   TinyXml2 also offers a Visitor pattern where you can create a visitor that examines each node in turn and can do whatever you like when it finds it. Unfortunately writing visitor functions can also be hard to understand.   My idea didn't work out very well, but I used another system. Instead of the location of the element being located automatically, the programmer (me) will have to do it manually like this :    Let's say I have this in my XML file :  <Batman> <Friends> <Robin> Hello </Robin> <AnotherRobin> <Bat> Hi </Bat> </AnotherRobin> </Friends> </Batman> Then I would have to do something like this to print whatever is inside the tags of "Robin" : NextElement(Batman); NextElement(Friends); NextElement(Robin); std::cout << GrabString() << std::endl; Not the best, but it's good enough for what I'm using it for. :)
  14.   Technically it's not the content you're looking for, but the tag name. The content is the text between the tags.         Nor can I, because there's no element 'Robin'. Anyway....   The problem is that FirstChildElement only looks at children - not grandchildren, or great-grandchildren, etc. I don't know if TinyXML2 offers a 'find element anywhere' function; if not, you'll have to do this manually.   One way to approach this is to write a recursive function. It would examine a node, and call itself on any children of that node. Unfortunately recursive functions can be hard to understand.   TinyXml2 also offers a Visitor pattern where you can create a visitor that examines each node in turn and can do whatever you like when it finds it. Unfortunately writing visitor functions can also be hard to understand.     Yeah, sorry. Edited. Have no idea why I wrote Robin instead of Earth lol :P   Alright, that makes sense, I think I prefer the first approach over the visitor one. I think I have an idea on how to implement it, I'll come back here if I have any questions, and if I succeed on implementing it I'll mark your answer.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!