| Mirage Source http://web.miragesource.net/forums/ |
|
| Remove Code http://web.miragesource.net/forums/viewtopic.php?f=210&t=1474 |
Page 1 of 2 |
| Author: | William [ Fri Mar 09, 2007 12:34 am ] |
| Post subject: | Remove Code |
AddChar Find and Remove: Code: ' Prevent being me If LCase(Trim(Name)) = "consty" Then Call AlertMsg(Index, "Lets get one thing straight, you are not me, ok? :)") Exit Sub End If Weather This is not so much of a bug fix, but it's useless code unless you add a weather system to your game. So do not remove this if you have or going to add a weather system. Server Side Find and Remove: Code: 'WeatherSeconds = WeatherSeconds + 1 'TimeSeconds = TimeSeconds + 1 ' Lets change the weather if its time to If WeatherSeconds >= 60 Then i = Int(Rnd * 3) If i <> GameWeather Then GameWeather = i Call SendWeatherToAll End If WeatherSeconds = 0 End If ' Check if we need to switch from day to night or night to day If TimeSeconds >= 60 Then If GameTime = TIME_DAY Then GameTime = TIME_NIGHT Else GameTime = TIME_DAY End If Call SendTimeToAll TimeSeconds = 0 End If Find and Remove: Code: ' Used for weather effects Public GameWeather As Long Public WeatherSeconds As Long Public GameTime As Long Public TimeSeconds As Long Find and Remove: Code: ' Init atmosphere GameWeather = WEATHER_NONE WeatherSeconds = 0 GameTime = TIME_DAY TimeSeconds = 0 Find and Remove: Code: ' Weather constants Public Const WEATHER_NONE = 0 Public Const WEATHER_RAINING = 1 Public Const WEATHER_SNOWING = 2 ' Time constants Public Const TIME_DAY = 0 Public Const TIME_NIGHT = 1 Find and Remove: Code: Sub SendWeatherTo(ByVal Index As Long) Dim Packet As String Packet = "WEATHER" & SEP_CHAR & GameWeather & SEP_CHAR & END_CHAR Call SendDataTo(Index, Packet) End Sub Sub SendWeatherToAll() Dim i As Long For i = 1 To MAX_PLAYERS If IsPlaying(i) Then Call SendWeatherTo(i) End If Next i End Sub Sub SendTimeTo(ByVal Index As Long) Dim Packet As String Packet = "TIME" & SEP_CHAR & GameTime & SEP_CHAR & END_CHAR Call SendDataTo(Index, Packet) End Sub Sub SendTimeToAll() Dim i As Long For i = 1 To MAX_PLAYERS If IsPlaying(i) Then Call SendTimeTo(i) End If Next i End Sub Client Side Find and Remove: Code: ' Weather constants Public Const WEATHER_NONE = 0 Public Const WEATHER_RAINING = 1 Public Const WEATHER_SNOWING = 2 ' Time constants Public Const TIME_DAY = 0 Public Const TIME_NIGHT = 1 Find and Remove: Code: ' Used for atmosphere Public GameWeather As Long Public GameTime As Long Find and Remove: Code: ' ::::::::::::::::::::
' :: Weather packet :: ' :::::::::::::::::::: If (LCase(Parse(0)) = "weather") Then GameWeather = Val(Parse(1)) End If ' ::::::::::::::::: ' :: Time packet :: ' ::::::::::::::::: If (LCase(Parse(0)) = "time") Then GameTime = Val(Parse(1)) End If Thats all useless code unless you add a weather system. |
|
| Author: | Coke [ Fri Mar 09, 2007 11:26 am ] |
| Post subject: | |
Just a suggestion, better to comment them out then they dont affect your program anymore but are there for the future |
|
| Author: | William [ Fri Mar 09, 2007 12:18 pm ] |
| Post subject: | |
Fox wrote: Just a suggestion, better to comment them out then they dont affect your program anymore but are there for the future
Bad idea to keep comenting everything, its easy to get the code back now when it is here |
|
| Author: | Coke [ Fri Mar 09, 2007 12:44 pm ] |
| Post subject: | |
Really? I thought comments were not seen at runtime? o.0 |
|
| Author: | William [ Fri Mar 09, 2007 12:47 pm ] |
| Post subject: | |
Fox wrote: Really? I thought comments were not seen at runtime? o.0
It is not there at runtime. But the thing is the programming style, it's bad idea to comment out everything, it will just mess things up. The same goes for indents. |
|
| Author: | Coke [ Fri Mar 09, 2007 12:48 pm ] |
| Post subject: | |
So its not really bad... just if your hyper neat like you ^_^ |
|
| Author: | William [ Fri Mar 09, 2007 12:54 pm ] |
| Post subject: | |
Fox wrote: So its not really bad... just if your hyper neat like you ^_^
Doesn't comments make the .exe bigger? |
|
| Author: | one [ Fri Mar 09, 2007 2:30 pm ] |
| Post subject: | |
William wrote: Fox wrote: So its not really bad... just if your hyper neat like you ^_^ Doesn't comments make the .exe bigger? no. why should there be comments in a compiled application? |
|
| Author: | William [ Fri Mar 09, 2007 2:34 pm ] |
| Post subject: | |
I remember there being a discussion about this before. There was no real final answer I think. It might not effect much. We all program in different ways. Myself only have those things in the game that is being used. Other stuffs just take up place. |
|
| Author: | Robin [ Fri Mar 09, 2007 5:18 pm ] |
| Post subject: | |
Why would comments be compiled into native code? They are there IDE but on in the .exe Of course, you could be a little swot and go paste 1000 lines of commented code and 1000 lines of uncommented and see if they change the .exe |
|
| Author: | William [ Fri Mar 09, 2007 5:24 pm ] |
| Post subject: | |
Comments do not effect the size of the exe. So comment it if you wish. |
|
| Author: | Robin [ Fri Mar 09, 2007 5:26 pm ] |
| Post subject: | |
but you just said they did ;_; |
|
| Author: | Verrigan [ Fri Mar 09, 2007 5:30 pm ] |
| Post subject: | |
He asked if they did... Big difference. Obviously he got his answer. [edit] Okay... he said it, and then he asked it.. Obviously he was unsure... Now he knows. |
|
| Author: | William [ Fri Mar 09, 2007 5:35 pm ] |
| Post subject: | |
Kite, I wrote: William wrote: I remember there being a discussion about this before. There was no real final answer I think. It might not effect much.
I was not sure if comments effected it something. But now I know that they dont. |
|
| Author: | Coke [ Fri Mar 09, 2007 10:08 pm ] |
| Post subject: | |
Comments 1 William 0 haha only joking Its good to know that it isnt in the .exe, useful thread even if its just for that |
|
| Author: | Obsidian [ Fri Mar 09, 2007 11:42 pm ] |
| Post subject: | |
William wrote: The same goes for indents.
Dammit man... i hate it sooooo much when people don't properly nest code (in ANY language)... i should probably just start a topic about it in rants/raves, but how people can go through and code without nesting just blows me away. I can't function properly in different IDEs with improperly nested code. (Not pointed at you william, you just brought it up, so i thought i'd rant about it) |
|
| Author: | William [ Fri Mar 09, 2007 11:49 pm ] |
| Post subject: | |
What are you talking about Obsidian? There has been no discussion about nesting here.. We discussed about commenting not affecting the exe size.. ?? |
|
| Author: | Obsidian [ Fri Mar 09, 2007 11:57 pm ] |
| Post subject: | |
You brought up 'indenting'. Indenting = Nesting |
|
| Author: | Xlithan [ Sat Mar 10, 2007 6:38 am ] |
| Post subject: | |
just use CodeFixer. It will comment out anything that's not used or called, and will save a few bytes when compiling |
|
| Author: | William [ Sat Mar 10, 2007 8:41 am ] |
| Post subject: | |
Obsidian wrote: You brought up 'indenting'. Indenting = Nesting
Yeah guess I did |
|
| Author: | ShadowLife [ Sat Mar 10, 2007 10:06 am ] |
| Post subject: | |
I keep it simple, Tab. Makes lines a bit long at times, but I like having a homogenous structure. |
|
| Author: | Robin [ Sat Mar 10, 2007 12:21 pm ] |
| Post subject: | |
ShadowLife wrote: I keep it simple, Tab.
Makes lines a bit long at times, but I like having a homogenous structure. Heheh. Homo. Anyway, just keep it as two space indent. Makes it look a lot neater. |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|