Announcement

Collapse
No announcement yet.

Design: New SLIC functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Originally posted by tombom
    One problem I'm running into now is that I have no idea how to set the ACTIVISION_ORIGINAL thing in the .y files. Martin's changes have this around them with no problems, but I can't get it to work.
    It is very simple, the *.y files don't create original code. They allow additional slic santax but that doesn't do anything. The stuff on the right side of the expression in braces is put into a source file and therefore you can only use preprocessor derectives within the braces, of course then you cannot put it into one line as you did.

    Of course you should mark every change you do by ACTIVISION_ORIGNAL at least in source and header files, as long as our svn server is not running with the final version of all revisions. And of course as well take a look into the files that we have modified, they all have at the top a description about what we did. Please add a description of your alterations there, so that we know what you did to the file.

    At least I would like know if you did anything with the slicif.h, as it seems that the SOP_EXP enum member was already there in the original source code.

    Originally posted by J Bytheway
    (I doubt we'll ever want bitwise XOR in SLIC, but then again, you never know...)
    Are you sure, espeacilly if you consider that some unit properties are stored in integers, like CanSee and VisionClass, MovementType, and of course not only for units but also for armies.

    -Martin
    Last edited by Martin Gühmann; January 25, 2005, 10:46.
    Civ2 military advisor: "No complaints, Sir!"

    Comment


    • #62
      Originally posted by Martin Gühmann
      Are you sure, espeacilly if you consider that some unit properties are stored in integers, like CanSee and VisionClass, MovementType, and of course not only for units but also for armies.
      (Incidentally, you misattributed your quote)

      I would say that it's probably not a good idea to expose such fields in their raw form in SLIC, but perhaps it is.

      In any case, bitwise AND and OR are considerably more useful than XOR, but on the other hand it would be silly to include some but not all of the standard operations. But even if we do I'm sure we can find another symbol. I like '^' for exponentation, but I'm happy to be overruled.

      Comment


      • #63
        Originally posted by J Bytheway
        (Incidentally, you misattributed your quote)
        Sorry, I fixed that.

        Originally posted by J Bytheway
        I would say that it's probably not a good idea to expose such fields in their raw form in SLIC, but perhaps it is.

        In any case, bitwise AND and OR are considerably more useful than XOR, but on the other hand it would be silly to include some but not all of the standard operations. But even if we do I'm sure we can find another symbol. I like '^' for exponentation, but I'm happy to be overruled.
        Well the were occasion, when I could use it. I mean it makes the code more compact and faster, of course harder to understand as well. But in order to expose these bit flags to slic it might be easier to expose then in raw form then in single bit form.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #64
          Originally posted by Martin Gühmann
          At least I would like know if you did anything with the slicif.h, as it seems that the SOP_EXP enum member was already there in the original source code.
          I hadn't thought of checking for that already there as it wasn't in any of the other pieces of code. Odd.

          Sorry for the rest. i was really just testing it out. I've attached a new version which should hopefully fix everything you've said, although I haven't been able to test it because I haven't downloaded DirectX 9.0b SDK yet. One thing though - even before adding these changes, I always get one shift/reduce conflict while yacc does this file. is this normal?

          EDIT: Attachments are playing up. this attachment is for the post below.

          EDIT2: Just uploaded a new one which includes a file I'd missed before.
          Attached Files
          Last edited by tombom; January 26, 2005, 03:19.
          Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
          -Intercal reference manual

          People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

          Comment


          • #65
            Here is a version which uses ** instead of ^. No real reason, it just seemed more natural to reserve ^ etc for the same things they are in C. I had to make changes to the lexer too so now that is included. Comments added at the top of all files.
            Last edited by tombom; January 25, 2005, 17:22.
            Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
            -Intercal reference manual

            People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

            Comment


            • #66
              Originally posted by tombom
              One thing though - even before adding these changes, I always get one shift/reduce conflict while yacc does this file. is this normal?
              Yes, that's always happened. I had planned to investigate it, but I forgot about it...

              Comment


              • #67
                Well The Big Mc obviously I should show you what I mean, here is my idea of the AddSlaves function based on the AddPops function:

                Code:
                SFN_ERROR Slic_AddSlaves::Call(SlicArgList *args)
                {
                	if(args->m_numArgs != 3)
                		return SFN_ERROR_NUM_ARGS;
                
                	Unit city;
                	if(!args->GetCity(0, city))
                		return SFN_ERROR_TYPE_ARGS;
                
                	sint32 count;
                	if(!args->GetInt(1, count))
                		return SFN_ERROR_TYPE_ARGS;
                
                	sint32 victim;
                	if(!args->GetPlayer(2, victim))
                		return SFN_ERROR_TYPE_ARGS;
                
                	MapPoint pos; 
                	city.GetPos(pos);
                	
                	sint32 i;
                	if(count > 0) {
                		for (i=0; iAddEvent(GEV_INSERT_Tail, GEV_MakePop,
                						   GEA_City, city.m_id,
                						   GEA_Player, victim,
                						   GEA_End);
                			
                		}
                	} else {
                		// Add code to convert count slaves to normal pops here later.
                		for(i = count; i < 0; i++) {
                			// Add pop remove code here later (KillPop event).
                		}
                	}
                
                	
                	sint32 delta_martial_law;
                	CityData *cd = city.GetData()->GetCityData();
                	cd->GetHappy()->CalcHappiness(*cd, FALSE, delta_martial_law, TRUE);
                
                	return SFN_ERROR_OK;
                }
                I changed it so that the function expect three parameters.
                I optimized the city retrieval code.
                And I passed an additional GEA_Player argument to the MakePop event via the event manager.

                And as we know that the MakePop event works also with adding slaves, I can hope that this works without a crash. But now it's your turn to test the code. I don't all the work for you.

                -Martin
                Civ2 military advisor: "No complaints, Sir!"

                Comment


                • #68
                  martin the code will not work as you will still have the problem I have. my add slave function works fine for a human player however the ai changes something stupid with it that cases it to crash. However it does seam to.
                  "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                  The BIG MC making ctp2 a much unsafer place.
                  Visit the big mc’s website

                  Comment


                  • #69
                    Obviously I have to test it on my own, but rather next weekend than this one. By the way if it crashes it must generate a crash log espeacilly a debug version should write into its log asserts. So what are these asserts?

                    -Martin
                    Civ2 military advisor: "No complaints, Sir!"

                    Comment


                    • #70
                      here
                      Attached Files
                      "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                      The BIG MC making ctp2 a much unsafer place.
                      Visit the big mc’s website

                      Comment


                      • #71
                        These two stack traces aren't very helpful, I can see that the problem is related to the number of workers you have in the city. My guess is that something wasn't registered at all, and therefore my idea to use the event. And the event solution really doesn't work?

                        Code:
                            c3debug.cpp@300 : Assertion (WorkerCount() >= delta) Failed in File:C:\Program Files\Activision\CTP2code\ctp2_code\gs\gameobj\CityData.cpp, Line:5226
                            c3debug.cpp@303 : Stack Trace: '  0x00451a30  [(unknown) + 0x0]
                          0x0044c7f4  [(unknown) + 0x0]
                          0x0055ac1c  [(unknown) + 0x0]
                          0x00a895be  [(unknown) + 0x0]
                          0x00a88cda  [(unknown) + 0x0]
                          0x00a97567  [(unknown) + 0x0]
                          0x005b86bb  [(unknown) + 0x0]
                          0x006c15f1  [(unknown) + 0x0]
                          0x006c14b8  [(unknown) + 0x0]
                          0x006c2e83  [(unknown) + 0x0]
                          0x006bf038  [(unknown) + 0x0]
                          0x006c2a55  [(unknown) + 0x0]
                          0x006c2919  [(unknown) + 0x0]
                          0x006c27c5  [(unknown) + 0x0]
                          0x006c25a6  [(unknown) + 0x0]
                          0x004adc11  [(unknown) + 0x0]
                          0x004a3d94  [(unknown) + 0x0]
                          0x004a144a  [(unknown) + 0x0]
                          0x00468222  [(unknown) + 0x0]
                          0x0046877e  [(unknown) + 0x0]
                          0x0045c422  [(unknown) + 0x0]
                          0x0045ba52  [(unknown) + 0x0]
                          0x00abea63  [(unknown) + 0x0]
                          0x77e814c7  [(unknown) + 0x0]
                        '
                          civ3_main.cpp@1629: Exception: 'Breakpoint' thrown.
                          civ3_main.cpp@1634: Exception Stack Trace:
                          0x0044c843
                          0x0055ac1c
                          0x00a895be
                          0x00a88cda
                          0x00a97567
                          0x005b86bb
                          0x006c15f1
                          0x006c14b8
                          0x006c2e83
                          0x006bf038
                          0x006c2a55
                          0x006c2919
                          0x006c27c5
                          0x006c25a6
                          0x004adc11
                          0x004a3d94
                          0x004a144a
                          0x00468222
                          0x0046877e
                          0x0045c422
                          0x0045ba52
                          0x00abea63
                          0x77e814c7
                        Two things are wrong here first the assert line is not line number 5226 but it is 5570, so your version of CityData.cpp must be hopless outdated. And the stack traces just contain numbers, not actual the paths from where the problematic code was called. And as the log tells me that you copied it to the following position: C:\Program Files\Activision\Copy of Call To Power 2\ctp2_program\ctp\CivCTP_dbg.exe
                        even if the code lies there: C:\Program Files\Activision\CTP2code\ctp2_code\ means that you don't execute the program from the VC++ IDE directly, that means that you don't use the debugers full potential. Not a very good idea. So next time execute the program from C:\Program Files\Activision\CTP2code\ctp2_code\ctp\ at best from the VC++ IDE to do this just press Ctrl+F5 and the program is compiled if necessary and executed.

                        -Martin
                        Civ2 military advisor: "No complaints, Sir!"

                        Comment


                        • #72
                          Here is the power of operator. It works, but I get an assert when quitting the game in one of the aui files. I doubt this was caused by this though.

                          If it's OK, I'll put it in the altered sources thread.
                          Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
                          -Intercal reference manual

                          People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

                          Comment


                          • #73
                            I forgot the file
                            Attached Files
                            Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
                            -Intercal reference manual

                            People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

                            Comment


                            • #74
                              Did you consider the precedence of the operator? What do you want (2 * 10 ** 2) to evaluate to?

                              Comment


                              • #75
                                Suddenly the code has started getting asserts in SlicSymTab.cpp. It was working fine before so i don't know what's happened. If anybody else has tried it could they say if this is happening to them?

                                Precedence: haven't thought of that much. I think it should come after all the numeric operators so that would evaluate to 20 ** 2.
                                Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
                                -Intercal reference manual

                                People often remark of me, "You say sorry far to much!". To which my common-sense reply is "I apologise".

                                Comment

                                Working...
                                X